mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-08 08:39:03 +02:00
Fix ordering of boolean check to be more readable
This commit is contained in:
@@ -39,11 +39,11 @@ module.exports = AuthenticationManager =
|
||||
if !password?
|
||||
return { message: 'password not set' }
|
||||
if (Settings.passwordStrengthOptions?.length?.max? and
|
||||
Settings.passwordStrengthOptions?.length?.max < password.length)
|
||||
return { message: 'password is too short' }
|
||||
if (Settings.passwordStrengthOptions?.length?.min? and
|
||||
Settings.passwordStrengthOptions?.length?.min > password.length)
|
||||
password.length > Settings.passwordStrengthOptions?.length?.max)
|
||||
return { message: "password is too long" }
|
||||
if (Settings.passwordStrengthOptions?.length?.min? and
|
||||
password.length < Settings.passwordStrengthOptions?.length?.min)
|
||||
return { message: 'password is too short' }
|
||||
return null
|
||||
|
||||
setUserPassword: (user_id, password, callback = (error) ->) ->
|
||||
|
||||
@@ -135,6 +135,8 @@ describe "AuthenticationManager", ->
|
||||
|
||||
it "should return validation error object if too long", ->
|
||||
result = @AuthenticationManager.validatePassword 'dsdsadsadsadsadsadkjsadjsadjsadljs'
|
||||
expect(result).to.not.equal null
|
||||
expect(result.message).to.equal 'password is too long'
|
||||
|
||||
describe "setUserPassword", ->
|
||||
beforeEach ->
|
||||
|
||||
Reference in New Issue
Block a user