Let admins skip SMS on user, class, and invoice actions, and let users change their own password with the current one.
18 lines
367 B
JavaScript
18 lines
367 B
JavaScript
// /utils/passwordRules.js
|
|
'use strict';
|
|
|
|
const AppError = require('./AppError');
|
|
|
|
const MIN_PASSWORD_LENGTH = 6;
|
|
|
|
const assertPasswordStrength = (password) => {
|
|
if (typeof password !== 'string' || password.trim().length < MIN_PASSWORD_LENGTH) {
|
|
throw new AppError('WEAK_PASSWORD');
|
|
}
|
|
};
|
|
|
|
module.exports = {
|
|
MIN_PASSWORD_LENGTH,
|
|
assertPasswordStrength
|
|
};
|