-
Notifications
You must be signed in to change notification settings - Fork 106
Optional Implicit Verification of accounts when successfully resetting password #499
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
Merged
jeremyevans
merged 4 commits into
jeremyevans:master
from
manfrin:feature/implicitly-verify
Feb 21, 2026
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
1df3182
Adding tests for the implicit verification of accounts that have thei…
manfrin 5e1ff38
If reset_password_implicitly_verifies? is set to true, verify an acco…
manfrin 15ed86e
Adding documentation for reset_password_implicily_verifies? option.
manfrin aa7b398
Removing errant editor autoformatting.
manfrin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,6 +32,7 @@ module Rodauth | |
| auth_value_method :reset_password_deadline_interval, {:days=>1}.freeze | ||
| auth_value_method :reset_password_key_param, 'key' | ||
| auth_value_method :reset_password_autologin?, false | ||
| auth_value_method :reset_password_implicitly_verifies?, false | ||
| auth_value_method :reset_password_table, :account_password_reset_keys | ||
| auth_value_method :reset_password_id_column, :id | ||
| auth_value_method :reset_password_key_column, :key | ||
|
|
@@ -174,7 +175,7 @@ def create_reset_password_key | |
| end | ||
|
|
||
| def reset_password_request_for_unverified_account | ||
| throw_error_reason(:unverified_account, unopen_account_error_status, login_param, unverified_account_message) | ||
| throw_error_reason(:unverified_account, unopen_account_error_status, login_param, unverified_account_message) unless reset_password_implicitly_verifies? | ||
| end | ||
|
|
||
| def remove_reset_password_key | ||
|
|
@@ -231,6 +232,14 @@ def after_login_failure | |
| super | ||
| end | ||
|
|
||
| def after_reset_password | ||
| super if defined?(super) | ||
| if reset_password_implicitly_verifies? && !open_account? | ||
| verify_account | ||
| remove_verify_account_key | ||
| end | ||
| end | ||
|
|
||
| def generate_reset_password_key_value | ||
| @reset_password_key_value = random_key | ||
| end | ||
|
|
@@ -254,7 +263,13 @@ def password_reset_ds(id=account_id) | |
| end | ||
|
|
||
| def _account_from_reset_password_key(token) | ||
| account_from_key(token, account_open_status_value){|id| get_password_reset_key(id)} | ||
| account_from_key(token, reset_password_account_status_value){|id| get_password_reset_key(id)} | ||
| end | ||
|
|
||
| def reset_password_account_status_value | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can keep this method inside the |
||
| statuses = [account_open_status_value] | ||
| statuses << account_unverified_status_value if reset_password_implicitly_verifies? | ||
| statuses | ||
| end | ||
| end | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The main issue here is you can set
reset_password_implicitly_verifies?to true without loading theverify_accountfeature, in which case you end up with aNoMethodErrorhere. It's possible to check that, but I think it's simpler to add a new feature that depends on bothreset_passwordandverify_account, and has these changes (as you mentioned when submitting).