Use path and url helpers for password links

This commit is contained in:
Andy Allan 2023-12-06 18:39:25 +00:00
parent 0c2e471708
commit 1d0f588d62
2 changed files with 2 additions and 3 deletions

View file

@ -34,8 +34,7 @@ class UserMailer < ApplicationMailer
def lost_password(user, token)
with_recipient_locale user do
@url = url_for(:controller => "passwords", :action => "reset_password",
:token => token.token)
@url = user_reset_password_url(:token => token.token)
mail :to => user.email,
:subject => t(".subject")

View file

@ -13,7 +13,7 @@
<%= hidden_field_tag("referer", h(params[:referer]), :autocomplete => "off") %>
<%= f.text_field :username, :label => t(".email or username"), :tabindex => 1, :value => params[:username] %>
<%= f.password_field :password, :label => t(".password"), :tabindex => 2, :value => "", :help => link_to(t(".lost password link"), :controller => "passwords", :action => "lost_password") %>
<%= f.password_field :password, :label => t(".password"), :tabindex => 2, :value => "", :help => link_to(t(".lost password link"), user_forgot_password_path) %>
<%= f.form_group do %>
<%= f.check_box :remember_me, { :label => t(".remember"), :tabindex => 3, :checked => (params[:remember_me] == "yes") }, "yes" %>
<% end %>