remember signed in user session

pull/105/head
Alex Turchyn 2 years ago
parent 658e8a7bd6
commit 1f29e624e7

@ -56,6 +56,10 @@ class User < ApplicationRecord
!deleted_at? !deleted_at?
end end
def remember_me
true
end
def initials def initials
[first_name.first, last_name.first].join.upcase [first_name.first, last_name.first].join.upcase
end end

@ -10,14 +10,6 @@
<%= f.label :password, class: 'label' %> <%= f.label :password, class: 'label' %>
<%= f.password_field :password, autocomplete: 'current-password', class: 'base-input' %> <%= f.password_field :password, autocomplete: 'current-password', class: 'base-input' %>
</div> </div>
<% if devise_mapping.rememberable? %>
<div class="form-control">
<%= f.label :remember_me, class: 'flex items-center cursor-pointer' do %>
<%= f.check_box :remember_me, checked: true, class: 'base-checkbox' %>
<span class="label">Remember me</span>
<% end %>
</div>
<% end %>
</div> </div>
<div class="form-control"> <div class="form-control">
<%= f.button button_title(title: 'Log In', disabled_with: 'Logging In'), class: 'base-button' %> <%= f.button button_title(title: 'Log In', disabled_with: 'Logging In'), class: 'base-button' %>

@ -159,7 +159,7 @@ Devise.setup do |config|
# ==> Configuration for :rememberable # ==> Configuration for :rememberable
# The time the user will be remembered without asking for credentials again. # The time the user will be remembered without asking for credentials again.
# config.remember_for = 2.weeks config.remember_for = 2.years
# Invalidates all the remember me tokens when the user signs out. # Invalidates all the remember me tokens when the user signs out.
config.expire_all_remember_me_on_sign_out = true config.expire_all_remember_me_on_sign_out = true

Loading…
Cancel
Save