Category : Ruby On Rails
Category : Ruby On Rails
While working with devise gem, I need to show the failure messages like “Invalid username / password” (As shown in the below image) when user enters a wrong username/password.
I have added the flash massage to show the error as shown in below code in app/view/devise/sessions/new
1 2 3 |
<%= flash[:alert]%> |
Hope this helps
Categories: Ruby On Rails
This situation arises, when we need to login through a different unique key other than email and wanted email to be optional in the entry form.
Make sure in config/initializers/devise.rb to set the config.authentication_keys to some other field (not email, which is default) in devise.rb
1 2 3 4 |
# config.authentication_keys = [:email] config.authentication_keys = [:user_name] |
In the model rb (user.rb in my case) file,
1 2 3 4 5 6 7 8 9 |
def email_required? false end def email_changed? false end |
Categories: Ruby On Rails