Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
added minLength requireDigits requireAlpha settings
  • Loading branch information
sxross committed Jan 20, 2015
commit c716e712d8454919d2c345fe5268c3f038a31e38
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ Since this is a young package, we are maintaining compatibility with accounts-ui
type: "text", // The type of field you want
required: true // Adds html 5 required property if true
}]
requireDigits = true, // true by default, set to false if digits not required in password
requireAlpha = true, // true by default, set to false if alpha not required in password
minLength = 7 // 7 characters by default, set to whatever is required
});
});
```
Expand Down
7 changes: 4 additions & 3 deletions client/views/signUp/signUp.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,12 @@ AccountsEntry.entrySignUpEvents = {
passwordErrors = do (password)->
errMsg = []
msg = false
if password.length < 7
minLength = if AccountsEntry.settings.minLength? then AccountsEntry.settings.minLength else 7
if password.length < minLength
errMsg.push t9n("error.minChar")
if password.search(/[a-z]/i) < 0
errMsg.push t9n("error.pwOneLetter")
if password.search(/[0-9]/) < 0
errMsg.push t9n("error.pwOneLetter") and AccountsEntry.settings.requireAlpha?
if password.search(/[0-9]/) < 0 and AccountsEntry.settings.requireDigits?
errMsg.push t9n("error.pwOneDigit")

if errMsg.length > 0
Expand Down