Module: Slots::JWT::GenericMethods::ClassMethods

Defined in:
lib/slots/jwt/generic_methods.rb

Instance Method Summary collapse

Instance Method Details

#_failed_login(user) ⇒ Object



57
58
59
# File 'lib/slots/jwt/generic_methods.rb', line 57

def (user)
  ( ||= []).any? { |b| user.instance_eval(&b) }
end

#_reject_new_token?(user) ⇒ Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/slots/jwt/generic_methods.rb', line 50

def _reject_new_token?(user)
  (@_reject_new_token ||= []).any? { |b| user.instance_eval(&b) }
end

#_successful_login(user) ⇒ Object



64
65
66
# File 'lib/slots/jwt/generic_methods.rb', line 64

def (user)
  ( ||= []).any? { |b| user.instance_eval(&b) }
end

#_token_created_callback(user) ⇒ Object



71
72
73
# File 'lib/slots/jwt/generic_methods.rb', line 71

def _token_created_callback(user)
  (@_token_created_callback ||= []).each { |b| user.instance_eval(&b) }
end

#failed_login(&block) ⇒ Object



54
55
56
# File 'lib/slots/jwt/generic_methods.rb', line 54

def (&block)
  ( ||= []).push(block)
end

#find_for_authentication(login) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/slots/jwt/generic_methods.rb', line 39

def find_for_authentication()
  Slots::JWT.configuration.logins.each do |k, v|
    next unless &.match(v)
    return find_by(arel_table[k].lower.eq(.downcase)) || new
  end
  new
end

#reject_new_token(&block) ⇒ Object



47
48
49
# File 'lib/slots/jwt/generic_methods.rb', line 47

def reject_new_token(&block)
  (@_reject_new_token ||= []).push(block)
end

#successful_login(&block) ⇒ Object



61
62
63
# File 'lib/slots/jwt/generic_methods.rb', line 61

def (&block)
  ( ||= []).push(block)
end

#token_created_callback(&block) ⇒ Object



68
69
70
# File 'lib/slots/jwt/generic_methods.rb', line 68

def token_created_callback(&block)
  (@_token_created_callback ||= []).push(block)
end