Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix reset password
  • Loading branch information
tpt2213 committed Feb 17, 2016
commit 0411b73762278415f71b1bcbf428a5b716e3cd0c
18 changes: 9 additions & 9 deletions client/views/resetPassword/resetPassword.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ Template.entryResetPassword.events

'submit #resetPassword': (event) ->
event.preventDefault()
password = $('input[type="password"]').val()
password = $('input[name="new-password"]').val()

passwordErrors = do (password)->
errMsg = []
msg = false
if password.length < 7
if password.length < 6
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.pwOneDigit")
# if password.search(/[a-z]/i) < 0
# errMsg.push t9n("error.pwOneLetter")
# if password.search(/[0-9]/) < 0
# errMsg.push t9n("error.pwOneDigit")

if errMsg.length > 0
msg = ""
Expand All @@ -34,7 +34,7 @@ Template.entryResetPassword.events

Accounts.resetPassword Session.get('resetToken'), password, (error) ->
if error
Session.set('entryError', (error.reason || "Unknown error"))
Session.set 'entryError', (error.reason || "Unknown error")
else
Session.set('resetToken', null)
Router.go AccountsEntry.settings.dashboardRoute
Session.set 'resetToken', null
Router.go AccountsEntry.settings.dashboardRoute
4 changes: 2 additions & 2 deletions shared/router.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ Router.map ->
onBeforeAction: ->
if Meteor.user()
Router.go AccountsEntry.settings.dashboardRoute
Session.set('entryError', undefined)
Session.set('resetToken', @params.resetToken)
Session.set 'entryError', null
Session.set 'resetToken', @params.resetToken
@next()

# Get all the accounts-entry routes one time
Expand Down