-
Notifications
You must be signed in to change notification settings - Fork 21.9k
Add a default password reset token to has_secure_password #52483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Unrelated failures. |
# Only generate tokens for records that are capable of doing so (Active Records, not vanilla Active Models) | ||
if reset_token && respond_to?(:generates_token_for) | ||
generates_token_for :"#{attribute}_reset", expires_in: 15.minutes do | ||
public_send(:"#{attribute}_salt")&.last(10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dhh does this mean we'll need password_digest
and password_salt
columns?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
password_digest is already generated in the migration and salt is virtual.
Extends rails#52483 Ability to change the default `expires_in` for `has_secure_password` token generator. ```ruby class User < ApplicationRecord has_secure_password reset_password_token_expires_in: 30.minutes end ```
Extends rails#52483 Ability to change the default `expires_in` for `has_secure_password` token generator. ```ruby class User < ApplicationRecord has_secure_password reset_token_expires_in: 30.minutes end ```
Extends rails#52483 Ability to change the default `expires_in` for `has_secure_password` token generator. ```ruby class User < ApplicationRecord has_secure_password reset_token: { expires_in: 30.minutes } end ```
Extends rails#52483 Ability to change the default `expires_in` for `has_secure_password` token generator. ```ruby class User < ApplicationRecord has_secure_password reset_token: { expires_in: 30.minutes } end ```
* Add a default password reset token to has_secure_password * I hate this * Assist debugging * Add CHANGELOG entry
Add a default configuration for a 15-minute password reset token when using has_secure_password: