Skip to content

Commit

Permalink
fix lgtm warnings MM-246
Browse files Browse the repository at this point in the history
  • Loading branch information
fedelmar committed Oct 21, 2021
1 parent 4b76b5c commit 4308e6b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions services/UserService.js
Expand Up @@ -162,9 +162,8 @@ module.exports.edit = async function edit(id, name, password, profileId) {
if (!password) throw missingPassword;
if (!profileId) throw missingProfileId;
try {
const passwordValidation = password && (Constants.COMMON_PASSWORDS.includes(password) || password.length < Constants.PASSWORD_MIN_LENGTH);

if (passwordValidation) throw Messages.VALIDATION.COMMON_PASSWORD;
if (Constants.COMMON_PASSWORDS.includes(password)) throw Messages.VALIDATION.COMMON_PASSWORD;
if (password.length < Constants.PASSWORD_MIN_LENGTH) throw Messages.VALIDATION.LENGTH_INVALID('password', 5);

const profile = await Profile.getById(profileId);
if (!profile) return Promise.reject(Messages.PROFILE.ERR.GET);
Expand Down

0 comments on commit 4308e6b

Please sign in to comment.