Class: UserBase
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- UserBase
- Defined in:
- app/models/user_base.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.auth_token_cache=(auth) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'app/models/user_base.rb', line 10 def self.auth_token_cache=(auth) Rails.cache.write(auth.uid, { id_token: auth.credentials.id_token, access_token: auth.credentials.token, refresh_token: auth.credentials.refresh_token, } ) end |
.with_credentials(auth) ⇒ Object
6 7 8 |
# File 'app/models/user_base.rb', line 6 def self.with_credentials(auth) User.find_or_create_by(uid: auth.uid) end |
Instance Method Details
#auth_token_cache ⇒ Object
20 21 22 |
# File 'app/models/user_base.rb', line 20 def auth_token_cache Rails.cache.read(uid) end |
#authenticatable_salt ⇒ Object
24 25 26 27 28 |
# File 'app/models/user_base.rb', line 24 def authenticatable_salt return super unless session_token "#{super}#{session_token}" end |
#invalidate_all_sessions! ⇒ Object
30 31 32 |
# File 'app/models/user_base.rb', line 30 def invalidate_all_sessions! update_column(:session_token, SecureRandom.hex) end |