I have a Ruby on Rails app.I am using Devise for authentication.I have set a 30 minutes timeout for the users which auto logs out the users on 30 minutes of browser inactivity.The problem I am facing is that when the session logs out on timeout after 30 minutes,it takes to the login screen and the browser saved email address and password shows up in the login text boxes.But on clicking the login button it doesn't logs me into the application.When the page reloads after the login fail,I can login as usual. When i checked the problem further,I found that the email address and password values are nil even though it shows up on the browser screen.
The Login form code is given below:
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name,:role => "super_admin")) do |f| %>
<%= f.email_field :email, :placeholder => "EMAIL", :data => { :'placeholder' => 'EMAIL'}, :class => 'with_holder' %>
<%= f.password_field :password, :placeholder => "PASSWORD", :class => 'disablecopypaste with_holder' , :data => { :'placeholder' => 'PASSWORD'}%>
<% if devise_mapping.rememberable? -%>
<%= f.check_box :remember_me %>
<% end -%>
<a id="save_post" href="javascript:void(0);">LOG IN</a>
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
<%= link_to "FORGOT PASSWORD?", new_password_path(resource_name, :role => 'super_admin') %>
<% end -%>
Am I doing anything wrong here?it would be really helpful if anyone can help me with this problem
If you see Email and Password on your login form when reloading the page, it is the browser behavior, not your Devise. It could be because your input has autocomplete attribute and you have selected to Save Password on your browser. Try setting autocomplete=off on your input to see if it helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With