janko / rodauth-rails

Rails integration for Rodauth authentication framework
https://github.com/jeremyevans/rodauth
MIT License
593 stars 40 forks source link

`verify_account_email_sent_redirect` seems to be ignored #286

Closed gruschis closed 6 months ago

gruschis commented 6 months ago

Hi Janko,

I'm trying to change the location for the redirect that happens after sending the password reset. verify_account_email_sent_redirect doesn't seem to have an effect.

Reference: https://rodauth.jeremyevans.net/rdoc/files/doc/verify_account_rdoc.html

class RodauthMain < Rodauth::Rails::Auth
  configure do
    # …
    verify_account_email_sent_redirect { login_path } # tried strings as well, i.e. '/login'
    # …
  end
end

When submitting the form, you'll see that the redirect still points to '/'.

12:09:43 web.1  |   Sequel (0.6ms)  INSERT INTO "account_password_reset_keys" ("id", "key", "deadline") VALUES (3, 'WS7MkIJoz_5GMakc4KNwY3TXbhrWf0PLwEPSDVfbS9k', (CAST(CURRENT_TIMESTAMP AS timestamp) + make_interval(days := 1))) RETURNING "id"
12:09:43 web.1  |   ↳ app/misc/rodauth_app.rb:15:in `block in <class:RodauthApp>'
12:09:43 web.1  |   TRANSACTION (0.2ms)  RELEASE SAVEPOINT active_record_1
12:09:43 web.1  |   ↳ app/misc/rodauth_app.rb:15:in `block in <class:RodauthApp>'
12:09:43 web.1  |   TRANSACTION (0.7ms)  COMMIT
12:09:43 web.1  |   ↳ app/misc/rodauth_app.rb:15:in `block in <class:RodauthApp>'
12:09:43 web.1  | [ActiveJob] Enqueued ActionMailer::MailDeliveryJob (Job ID: 556ea5a8-b523-43e4-9f91-5a6ff625516c) to Async(default) with arguments: "RodauthMailer", "reset_password", "deliver_now", {:args=>[nil, 3, "WS7MkIJoz_5GMakc4KNwY3TXbhrWf0PLwEPSDVfbS9k"]}
12:09:43 web.1  | Redirected to /
12:09:43 web.1  | Completed 302 Found in 47ms (ActiveRecord: 3.7ms | Allocations: 56208)

Am I missing a setting somewhere?

Thanks and all the best.

janko commented 6 months ago

The reset_password feature doesn't use verify_account_email_sent_redirect, the verify_account feature uses that, as the configuration name indicates. You're probably looking for reset_password_redirect, see https://rodauth.jeremyevans.net/rdoc/files/doc/reset_password_rdoc.html.

gruschis commented 6 months ago

Oh man 🙈 Not sure how I missed that. Thank you!