Skip to content

Commit 3b39fa4

Browse files
committed
Add reset_password_request_for_unverified_account configuration method
This allows for configurable behavior, instead of always showing an error on the login parameter.
1 parent 588b865 commit 3b39fa4

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
=== master
2+
3+
* Add reset_password_request_for_unverified_account configuration method (jeremyevans) (#481)
4+
15
=== 2.39.0 (2025-05-22)
26

37
* Allow usage with Roda's plain_hash_response_headers plugin and Rack 3+ (jeremyevans)

doc/reset_password.rdoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ reset_password_email_link :: The link to the reset password form in the reset pa
5959
reset_password_email_sent_response :: Return a response after successfully sending a password reset email. By default, redirects to +reset_password_email_sent_redirect+.
6060
reset_password_key_insert_hash :: The hash to insert into the +reset_password_table+.
6161
reset_password_key_value :: The reset password key for the current account.
62+
reset_password_request_for_unverified_account :: What to do if there is a request to reset a password for an unverified account. By default, shows an error for the login parameter.
6263
reset_password_request_view :: The HTML to use for the reset password request form.
6364
reset_password_response :: Return a response after successfully resetting a password. By default, redirects to +reset_password_redirect+.
6465
reset_password_view :: The HTML to use for the reset password form.

lib/rodauth/features/reset_password.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ module Rodauth
5050
:reset_password_email_link,
5151
:reset_password_key_insert_hash,
5252
:reset_password_key_value,
53+
:reset_password_request_for_unverified_account,
5354
:set_reset_password_email_last_sent
5455
)
5556
auth_private_methods(
@@ -73,9 +74,7 @@ module Rodauth
7374
throw_error_reason(:no_matching_login, no_matching_login_error_status, login_param, no_matching_login_message)
7475
end
7576

76-
unless open_account?
77-
throw_error_reason(:unverified_account, unopen_account_error_status, login_param, unverified_account_message)
78-
end
77+
reset_password_request_for_unverified_account unless open_account?
7978

8079
if reset_password_email_recently_sent?
8180
set_redirect_error_flash reset_password_email_recently_sent_error_flash
@@ -174,6 +173,10 @@ def create_reset_password_key
174173
end
175174
end
176175

176+
def reset_password_request_for_unverified_account
177+
throw_error_reason(:unverified_account, unopen_account_error_status, login_param, unverified_account_message)
178+
end
179+
177180
def remove_reset_password_key
178181
password_reset_ds.delete
179182
end

0 commit comments

Comments
 (0)