mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
mvp for password validation
This commit is contained in:
parent
7d109ce77d
commit
639f73ea74
3 changed files with 42 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
||||||
define [
|
define [
|
||||||
"base"
|
"base"
|
||||||
|
"libs/passfield"
|
||||||
], (App) ->
|
], (App) ->
|
||||||
App.directive "asyncForm", ($http) ->
|
App.directive "asyncForm", ($http) ->
|
||||||
return {
|
return {
|
||||||
|
@ -71,3 +72,41 @@ define [
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
App.directive 'complexPassword', ->
|
||||||
|
require: ['^asyncForm', 'ngModel']
|
||||||
|
|
||||||
|
link: (scope, element, attrs, controllers) ->
|
||||||
|
|
||||||
|
passwordStrengthOptions = {
|
||||||
|
pattern: "aA$3",
|
||||||
|
allowEmpty: false,
|
||||||
|
allowAnyChars: false,
|
||||||
|
isMasked: true,
|
||||||
|
showToggle: false,
|
||||||
|
showGenerate: false,
|
||||||
|
checkMode:PassField.CheckModes.STRICT,
|
||||||
|
length: { min: 8, max: 50 },
|
||||||
|
showTip:false,
|
||||||
|
showWarn:false
|
||||||
|
}
|
||||||
|
|
||||||
|
passwordStrengthOptions.chars = {
|
||||||
|
digits: "1234567890",
|
||||||
|
letters: "abcdefghijklmnopqrstuvwxyz",
|
||||||
|
letters_up: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
||||||
|
symbols: "@#$%^&*()-_=+[]{};:<>/?!£€"
|
||||||
|
}
|
||||||
|
|
||||||
|
passField = new PassField.Field("passwordFeild", passwordStrengthOptions);
|
||||||
|
console.log controllers
|
||||||
|
controllers.$parsers.unshift (viewValue)->
|
||||||
|
console.log scope.parent, scope.password, attrs.email, viewValue
|
||||||
|
scope.complexPasswordErrorMessage = passField.getPassValidationMessage()
|
||||||
|
console.log scope.complexPasswordErrorMessage
|
||||||
|
isValid = passField.validatePass()
|
||||||
|
controllers.$setValidity('complexPassword', isValid)
|
||||||
|
return viewValue
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,4 +9,5 @@ define [
|
||||||
"libs/fineuploader"
|
"libs/fineuploader"
|
||||||
"libs/angular-sanitize-1.2.17"
|
"libs/angular-sanitize-1.2.17"
|
||||||
"libs/angular-cookie"
|
"libs/angular-cookie"
|
||||||
|
"libs/passfield"
|
||||||
], () ->
|
], () ->
|
||||||
|
|
2
services/web/public/js/libs/passfield.js
Normal file
2
services/web/public/js/libs/passfield.js
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue