Skip to content

Commit ac98964

Browse files
authored
We should only use _url when changing the host, otherwise _path is better (rails#53445)
1 parent acffb99 commit ac98964

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

railties/lib/rails/generators/rails/authentication/templates/app/controllers/concerns/authentication.rb.tt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module Authentication
3333

3434
def request_authentication
3535
session[:return_to_after_authenticating] = request.url
36-
redirect_to new_session_url
36+
redirect_to new_session_path
3737
end
3838

3939
def after_authentication_url

railties/lib/rails/generators/rails/authentication/templates/app/controllers/passwords_controller.rb.tt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,24 @@ class PasswordsController < ApplicationController
1010
PasswordsMailer.reset(user).deliver_later
1111
end
1212

13-
redirect_to new_session_url, notice: "Password reset instructions sent (if user with that email address exists)."
13+
redirect_to new_session_path, notice: "Password reset instructions sent (if user with that email address exists)."
1414
end
1515

1616
def edit
1717
end
1818

1919
def update
2020
if @user.update(params.permit(:password, :password_confirmation))
21-
redirect_to new_session_url, notice: "Password has been reset."
21+
redirect_to new_session_path, notice: "Password has been reset."
2222
else
23-
redirect_to edit_password_url(params[:token]), alert: "Passwords did not match."
23+
redirect_to edit_password_path(params[:token]), alert: "Passwords did not match."
2424
end
2525
end
2626

2727
private
2828
def set_user_by_token
2929
@user = User.find_by_password_reset_token!(params[:token])
3030
rescue ActiveSupport::MessageVerifier::InvalidSignature
31-
redirect_to new_password_url, alert: "Password reset link is invalid or has expired."
31+
redirect_to new_password_path, alert: "Password reset link is invalid or has expired."
3232
end
3333
end

railties/lib/rails/generators/rails/authentication/templates/app/controllers/sessions_controller.rb.tt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ class SessionsController < ApplicationController
1010
start_new_session_for user
1111
redirect_to after_authentication_url
1212
else
13-
redirect_to new_session_url, alert: "Try another email address or password."
13+
redirect_to new_session_path, alert: "Try another email address or password."
1414
end
1515
end
1616

1717
def destroy
1818
terminate_session
19-
redirect_to new_session_url
19+
redirect_to new_session_path
2020
end
2121
end

0 commit comments

Comments
 (0)