Class: Katapult::Authentication
- Inherits:
-
Element
- Object
- Element
- Katapult::Authentication
show all
- Defined in:
- lib/katapult/elements/authentication.rb
Constant Summary
Constants inherited
from Element
Element::UnknownFormattingError, Element::UnknownOptionError
Instance Attribute Summary collapse
Attributes inherited from Element
#application_model, #name, #options
Instance Method Summary
collapse
Methods inherited from Element
#initialize
Instance Attribute Details
#system_email ⇒ Object
7
8
9
|
# File 'lib/katapult/elements/authentication.rb', line 7
def system_email
@system_email
end
|
Instance Method Details
#ensure_user_model_attributes_present ⇒ Object
9
10
11
12
13
14
|
# File 'lib/katapult/elements/authentication.rb', line 9
def ensure_user_model_attributes_present
user_attrs = user.attrs.map(&:name)
user.attr(:email) unless user_attrs.include?('email')
user.attr(:password, type: :password, skip_db: true) unless user_attrs.include?('password')
end
|
#render(options = {}) ⇒ Object
16
17
18
|
# File 'lib/katapult/elements/authentication.rb', line 16
def render(options = {})
Generators::ClearanceGenerator.new(self, options).invoke_all
end
|
#user ⇒ Object
20
21
22
|
# File 'lib/katapult/elements/authentication.rb', line 20
def user
@user ||= application_model.get_model!(name)
end
|