Skip to content

Commit

Permalink
Fix unconfirmed user alert message (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurariza committed May 17, 2023
1 parent 0416b6f commit 0e9d1de
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ class SessionsController < ApplicationController
@user = User.find_by(email: params[:user][:email].downcase)
if @user
if @user.unconfirmed?
redirect_to new_confirmation_path, alert: "Incorrect email or password."
redirect_to new_confirmation_path, alert: "Please confirm your email first."
elsif @user.authenticate(params[:user][:password])
login @user
redirect_to root_path, notice: "Signed in."
Expand Down Expand Up @@ -1283,7 +1283,7 @@ class SessionsController < ApplicationController
@user = User.authenticate_by(email: params[:user][:email].downcase, password: params[:user][:password])
if @user
if @user.unconfirmed?
redirect_to new_confirmation_path, alert: "Incorrect email or password."
redirect_to new_confirmation_path, alert: "Please confirm your email first."
else
after_login_path = session[:user_return_to] || root_path
login @user
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def create
@user = User.authenticate_by(email: params[:user][:email].downcase, password: params[:user][:password])
if @user
if @user.unconfirmed?
redirect_to new_confirmation_path, alert: "Incorrect email or password."
redirect_to new_confirmation_path, alert: "Please confirm your email first."
else
after_login_path = session[:user_return_to] || root_path
active_session = login @user
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/sessions_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class SessionsControllerTest < ActionDispatch::IntegrationTest
password: @unconfirmed_user.password
}
}
assert_equal "Incorrect email or password.", flash[:alert]
assert_equal "Please confirm your email first.", flash[:alert]
assert_nil current_user
assert_redirected_to new_confirmation_path
end
Expand Down

0 comments on commit 0e9d1de

Please sign in to comment.