ianmartorell / meteor-accounts-ui-bootstrap-3

accounts-ui package with Bootstrap 3 and localization support
150 stars 109 forks source link

Accounts sendEnrollmentEmail - first time setting user password, retype confirmation #172

Closed sylido closed 9 years ago

sylido commented 9 years ago
  1. Send enrollment e-mail.
  2. User clicks on link and is transported to main page, prompted to enter his password for the first time.
  3. User has to enter the password twice for verification.
  4. User doesn't enter the password in the second field, but password is still accepted and set correctly to the first one.

Not sure how much control over this accounts-ui-bootstrap-3 has, maybe it's the accounts package that is messing up ?

sylido commented 9 years ago

Seems like it is an issue for here. I've located the problematic code in login_buttons.js starting on line 160. The function validatePassword takes in the two arguments and checks the password length, after that it checks for passwordAgain which in this case would be `(the empty string) and it will result in the function returningtrue. I guess this function handleschangePasswordandsignupas well, where you don't havepasswordAgain, you just pass inpassword` for a length validation.

ianmartorell commented 9 years ago

Nice work finding where the issue was! However, I think the better approach to fixing this is to modify the Accounts._loginButtons.validatePassword function to check the existance of passwordAgain properly.

ianmartorell commented 9 years ago

It should work now!

sylido commented 9 years ago

Hey man thanks, yeah I was just trying to get your attention so I applied this quick fix :) thank you for fixing it

sylido commented 9 years ago

Also noticed you are doing password != passwordAgain why not password !== passwordAgain ?

ianmartorell commented 9 years ago

Well, I don't see the advantage of using !== in this case. The only difference is that 1234567 !== '1234567' but 1234567 == '1234567' (== and != type cast), and in this case we know for sure both vars will be a string. And even if they weren't, it doesn't really matter.