You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
redirect_to new_confirmation_path, alert:"You must confirm your email before you can sign in."
522
+
redirect_to new_confirmation_path, alert:"Incorrect email or password."
523
523
elsif@user.authenticate(params[:user][:password])
524
524
login @user
525
525
redirect_to root_path, notice:"Signed in."
@@ -578,6 +578,7 @@ end
578
578
> - The `create` method simply checks if the user exists and is confirmed. If they are, then we check their password. If the password is correct, we log them in via the `login` method we created in the `Authentication` Concern. Otherwise, we render an alert.
579
579
> - We're able to call `user.authenticate` because of [has_secure_password](https://api.rubyonrails.org/classes/ActiveModel/SecurePassword/ClassMethods.html#method-i-has_secure_password)
580
580
> - Note that we call `downcase` on the email to account for case sensitivity when searching.
581
+
> - Note that we set the flash to "Incorrect email or password." if the user is unconfirmed. This prevents leaking email addresses.
581
582
> - The `destroy` method simply calls the `logout` method we created in the `Authentication` Concern.
582
583
> - The login form is passed a `scope: :user` option so that the params are namespaced as `params[:user][:some_value]`. This is not required, but it helps keep things organized.
583
584
@@ -1324,7 +1325,7 @@ class SessionsController < ApplicationController
0 commit comments