Module: TranslationCms::Authenticatable::ClassMethods

Defined in:
lib/translation_cms/authenticatable.rb

Instance Method Summary collapse

Instance Method Details

#authentication_keysObject



18
19
20
# File 'lib/translation_cms/authenticatable.rb', line 18

def authentication_keys
  [:email, :password]
end

#find_for_authentication(tainted_conditions) ⇒ Object



34
35
36
# File 'lib/translation_cms/authenticatable.rb', line 34

def find_for_authentication(tainted_conditions)
  authenticate!(tainted_conditions)
end

#find_for_database_authentication(conditions) ⇒ Object



38
39
40
# File 'lib/translation_cms/authenticatable.rb', line 38

def find_for_database_authentication(conditions)
  find_for_authentication(conditions)
end

#http_authenticatable?(_strategy) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/translation_cms/authenticatable.rb', line 26

def http_authenticatable?(_strategy)
  false
end

#params_authenticatable?(_strategy) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/translation_cms/authenticatable.rb', line 22

def params_authenticatable?(_strategy)
  true
end

#request_keysObject



30
31
32
# File 'lib/translation_cms/authenticatable.rb', line 30

def request_keys
  []
end

#serialize_from_session(key, salt) ⇒ Object



12
13
14
15
16
# File 'lib/translation_cms/authenticatable.rb', line 12

def serialize_from_session(key, salt)
  record = new(session: TranslationCms::Api::Session.new(access_token: key)) if key
  # RequestStore.store[:access_token] = key
  record if record&.profile && record.authenticatable_salt == salt
end

#serialize_into_session(record) ⇒ Object



8
9
10
# File 'lib/translation_cms/authenticatable.rb', line 8

def serialize_into_session(record)
  [record.token, record.authenticatable_salt]
end

#skip_session_storageObject



42
43
44
# File 'lib/translation_cms/authenticatable.rb', line 42

def skip_session_storage
  [:token]
end