Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Safari autofills hidden "reset password token" input

Safari is actually overwriting a HIDDEN form field that is supposed to represent a password reset token (ID is user_reset_password_token and name is user[reset_password_token]) with my email address.

As you can imagine, resetting the password doesn't work when the token is incorrect, so I've got an issue.

I've confirmed that it works just fine if I disable autofill in Safari, or use any browser other than Safari.

Does anyone have a solution to this issue?

like image 683
elsurudo Avatar asked Nov 21 '17 09:11

elsurudo


1 Answers

Just had the same issue. I solved the problem with adding readonly attribute to my hidden input, like this:

= f.hidden_field :reset_password_token, readonly: true

so I've got this:

<input id="user_reset_password_token" name="user[reset_password_token]" readonly="readonly" type="hidden" value="YXHRuRgppyzxqsdEXiNm">
like image 171
enjaku Avatar answered Oct 07 '22 19:10

enjaku