mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-23 10:13:57 +00:00
wip
This commit is contained in:
parent
fe1caa806a
commit
0d0f0e8604
5 changed files with 20 additions and 10 deletions
|
@ -29,6 +29,9 @@ module.exports = AuthenticationManager =
|
||||||
callback null, null
|
callback null, null
|
||||||
|
|
||||||
setUserPassword: (user_id, password, callback = (error) ->) ->
|
setUserPassword: (user_id, password, callback = (error) ->) ->
|
||||||
|
if Settings.passwordStrengthOptions?.length?.max? and Settings.passwordStrengthOptions?.length?.max < password.length
|
||||||
|
return error("password is too long")
|
||||||
|
|
||||||
bcrypt.genSalt BCRYPT_ROUNDS, (error, salt) ->
|
bcrypt.genSalt BCRYPT_ROUNDS, (error, salt) ->
|
||||||
return callback(error) if error?
|
return callback(error) if error?
|
||||||
bcrypt.hash password, salt, (error, hash) ->
|
bcrypt.hash password, salt, (error, hash) ->
|
||||||
|
|
|
@ -3,7 +3,7 @@ extends ../layout
|
||||||
block content
|
block content
|
||||||
- locals.supressDefaultJs = true
|
- locals.supressDefaultJs = true
|
||||||
script(data-main=jsPath+'main.js', src=jsPath+'libs/require.js', baseurl=jsPath)
|
script(data-main=jsPath+'main.js', src=jsPath+'libs/require.js', baseurl=jsPath)
|
||||||
script(src=buildJsPath('libs/recurly.min.js'))
|
script(src=buildJsPath('libs/recurly.min.js', {fingerprint:false}))
|
||||||
|
|
||||||
.content.content-alt
|
.content.content-alt
|
||||||
.container
|
.container
|
||||||
|
|
|
@ -79,7 +79,7 @@ block content
|
||||||
required,
|
required,
|
||||||
complex-password
|
complex-password
|
||||||
)
|
)
|
||||||
span.small.text-primary(ng-show="changePasswordForm.newPassword1.$error.complexPassword && changePasswordForm.currentPassword.$dirty", ng-bind-html="complexPasswordErrorMessage")
|
span.small.text-primary(ng-show="changePasswordForm.newPassword1.$error.complexPassword && changePasswordForm.newPassword1.$dirty", ng-bind-html="complexPasswordErrorMessage")
|
||||||
.form-group
|
.form-group
|
||||||
label(for='newPassword2') #{translate("confirm_new_password")}
|
label(for='newPassword2') #{translate("confirm_new_password")}
|
||||||
input.form-control(
|
input.form-control(
|
||||||
|
@ -88,9 +88,11 @@ block content
|
||||||
placeholder='*********',
|
placeholder='*********',
|
||||||
ng-model="newPassword2",
|
ng-model="newPassword2",
|
||||||
equals="passwordField"
|
equals="passwordField"
|
||||||
)
|
)
|
||||||
span.small.text-primary(ng-show="changePasswordForm.newPassword2.$invalid && changePasswordForm.newPassword2.$dirty")
|
span.small.text-primary(ng-show="changePasswordForm.newPassword2.$error.areEqual && changePasswordForm.newPassword2.$dirty")
|
||||||
| #{translate("doesnt_match")}
|
| #{translate("doesnt_match")}
|
||||||
|
span.small.text-primary(ng-show="!changePasswordForm.newPassword2.$error.areEqual && changePasswordForm.newPassword2.$invalid && changePasswordForm.newPassword2.$dirty")
|
||||||
|
| #{translate("Invalid Password")}
|
||||||
.actions
|
.actions
|
||||||
button.btn.btn-primary(
|
button.btn.btn-primary(
|
||||||
type='submit',
|
type='submit',
|
||||||
|
|
|
@ -190,11 +190,11 @@ module.exports = settings =
|
||||||
# -----------
|
# -----------
|
||||||
# These restrict the passwords users can use when registering
|
# These restrict the passwords users can use when registering
|
||||||
# opts are from http://antelle.github.io/passfield
|
# opts are from http://antelle.github.io/passfield
|
||||||
# passwordStrengthOptions:
|
passwordStrengthOptions:
|
||||||
# pattern: "aA$3"
|
# pattern: "aA$3"
|
||||||
# length:
|
length:
|
||||||
# min: 8
|
min: 1
|
||||||
# max: 50
|
max: 10
|
||||||
|
|
||||||
# Email support
|
# Email support
|
||||||
# -------------
|
# -------------
|
||||||
|
|
|
@ -112,6 +112,8 @@ define [
|
||||||
[asyncFormCtrl, ngModelCtrl] = ctrl
|
[asyncFormCtrl, ngModelCtrl] = ctrl
|
||||||
|
|
||||||
ngModelCtrl.$parsers.unshift (modelValue) ->
|
ngModelCtrl.$parsers.unshift (modelValue) ->
|
||||||
|
|
||||||
|
|
||||||
isValid = passField.validatePass()
|
isValid = passField.validatePass()
|
||||||
email = asyncFormCtrl.getEmail() || window.usersEmail
|
email = asyncFormCtrl.getEmail() || window.usersEmail
|
||||||
if !isValid
|
if !isValid
|
||||||
|
@ -121,5 +123,8 @@ define [
|
||||||
if modelValue.indexOf(email) != -1 or modelValue.indexOf(startOfEmail) != -1
|
if modelValue.indexOf(email) != -1 or modelValue.indexOf(startOfEmail) != -1
|
||||||
isValid = false
|
isValid = false
|
||||||
scope.complexPasswordErrorMessage = "Password can not contain email address"
|
scope.complexPasswordErrorMessage = "Password can not contain email address"
|
||||||
|
if opts.length.max? and modelValue.length == opts.length.max
|
||||||
|
isValid = false
|
||||||
|
scope.complexPasswordErrorMessage = "Maxium password length #{opts.length.max} reached"
|
||||||
ngModelCtrl.$setValidity('complexPassword', isValid)
|
ngModelCtrl.$setValidity('complexPassword', isValid)
|
||||||
return modelValue
|
return modelValue
|
||||||
|
|
Loading…
Reference in a new issue