I'd like to change the url of password reminder made by RoR. More detail, want to insert I18n.locale following domain. Let's say
ttp://mydomain.com/users/password/edit?reset_password_token=gPudhxxxxxx2xTZ4hBeHeA
to
ttp://mydomain.com/en/users/password/edit?reset_password_token=gPudhxxxxxx2xTZ4hBeHeA
In my reset_password_instructions.html.slim, code is like this.
p
= (I18n.t "resetpassword_mailbody", email: @resource.email).html_safe
p
= link_to (I18n.t "change_my_passwd"), edit_password_url(@resource, reset_password_token: @token)
p
= (I18n.t "mail_footer").html_safe
Need I override edit_password_url? What should I do? Please give me some advise.
Change the routes for password controller with devise.
devise_scope :user do
get 'cutom_url', to: 'devise/passwords#edit', as: :edit_user_registration
end
I figure out how.
p
= link_to (I18n.t "change_my_passwd"), edit_password_url(@resource, reset_password_token: @token, locale: I18n.locale)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.