Module: Card::Set::Self::Signin

Extended by:
Card::Set
Defined in:
tmpsets/set/mod025-account/self/signin.rb

Overview

The Sign In card manages logging in and out of the site.

Defined Under Namespace

Modules: HtmlFormat

Class Method Summary collapse

Instance Method Summary collapse

Methods included from I18nScope

#mod_name, #scope

Methods included from Loader

#clean_empty_module_from_hash, #clean_empty_modules, #extended, #process_base_modules, #register_set

Methods included from Helpers

#abstract_set?, #all_set?, #num_set_parts, #shortname, #underscore

Methods included from AdvancedApi

#attachment, #ensure_set, #stage_method

Methods included from Format

#before, #format, layout_method_name, #view, view_method_name, view_setting_method_name, wrapper_method_name

Methods included from Inheritance

#include_set, #include_set_formats

Methods included from Basket

#abstract_basket, #add_to_basket, #basket, #unshift_basket

Methods included from Trait

#card_accessor, #card_reader, #card_writer, #require_field

Methods included from Event::Api

#event

Class Method Details

.source_locationObject



9
# File 'tmpsets/set/mod025-account/self/signin.rb', line 9

def self.source_location; "/Users/ethan/dev/decko/gem/card/mod/account/set/self/signin.rb"; end

Instance Method Details

#authenticate_or_abort(email, pword) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
# File 'tmpsets/set/mod025-account/self/signin.rb', line 55

def authenticate_or_abort email, pword
  abort :failure, (:email_missing) unless email
  abort :failure, (:password_missing) unless pword
  if ( = Auth.authenticate(email, pword))
    Auth. .left_id
  else
     = Auth. email
    errors.add :signin, ()
    abort :failure
  end
end

#consider_recaptcha?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'tmpsets/set/mod025-account/self/signin.rb', line 47

def consider_recaptcha?
  false
end

#i18n_signin(key) ⇒ Object



51
52
53
# File 'tmpsets/set/mod025-account/self/signin.rb', line 51

def  key
  I18n.t key, scope: "mod.account.set.self.signin"
end

#ok_to_readObject



43
44
45
# File 'tmpsets/set/mod025-account/self/signin.rb', line 43

def ok_to_read
  true
end

#send_reset_password_email_or_fail(email) ⇒ Object



75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'tmpsets/set/mod025-account/self/signin.rb', line 75

def send_reset_password_email_or_fail email
  aborting do
    break errors.add :email, (:error_blank) if email.blank?

    if ( = Auth.(email))&.active?
      .send_reset_password_token
    elsif 
      errors.add :account, (:error_not_active)
    else
      errors.add :email, (:error_not_recognized)
    end
  end
end

#signin_error_message(account) ⇒ Object



67
68
69
70
71
72
73
# File 'tmpsets/set/mod025-account/self/signin.rb', line 67

def  
  case
  when .nil?     then (:error_unknown_email)
  when !.active? then (:error_not_active)
  else                       (:error_wrong_password)
  end
end