1
0
Fork 0

Override method User#active_for_authentication?

This commit is contained in:
Alex Kotov 2019-09-10 03:17:13 +05:00
parent 73bc59d772
commit 686b12e8d7
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
1 changed files with 8 additions and 0 deletions

View File

@ -33,6 +33,14 @@ class User < ApplicationRecord
# Methods #
###########
def active_for_authentication?
super && (
!Rails.env.production? ||
Rails.application.restricted? ||
!account.restricted?
)
end
def remember_exists_and_not_expired?
return false unless respond_to? :remember_created_at
return false unless respond_to? :remember_expired?