mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-17 05:54:30 +00: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 [
|
||||
"base"
|
||||
"libs/passfield"
|
||||
], (App) ->
|
||||
App.directive "asyncForm", ($http) ->
|
||||
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/angular-sanitize-1.2.17"
|
||||
"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