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
- #authenticate_or_abort(email, pword) ⇒ Object
- #consider_recaptcha? ⇒ Boolean
- #i18n_signin(key) ⇒ Object
- #ok_to_read ⇒ Object
- #send_reset_password_email_or_fail(email) ⇒ Object
- #signin_error_message(account) ⇒ Object
Methods included from I18nScope
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
Class Method Details
.source_location ⇒ Object
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, i18n_signin(:email_missing) unless email abort :failure, i18n_signin(:password_missing) unless pword if (account = Auth.authenticate(email, pword)) Auth.signin account.left_id else account = Auth.find_account_by_email email errors.add :signin, (account) abort :failure end end |
#consider_recaptcha? ⇒ 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 i18n_signin key I18n.t key, scope: "mod.account.set.self.signin" end |
#ok_to_read ⇒ Object
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, i18n_signin(:error_blank) if email.blank? if (account = Auth.find_account_by_email(email))&.active? account.send_reset_password_token elsif account errors.add :account, i18n_signin(:error_not_active) else errors.add :email, i18n_signin(: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 account case when account.nil? then i18n_signin(:error_unknown_email) when !account.active? then i18n_signin(:error_not_active) else i18n_signin(:error_wrong_password) end end |