mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-12 07:36:46 +00:00
Fix ordering of boolean check to be more readable
This commit is contained in:
parent
f26f30e677
commit
e129172553
2 changed files with 6 additions and 4 deletions
|
@ -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 ->
|
||||
|
|
Loading…
Add table
Reference in a new issue