Class: StandardId::Web::SignupForm
- Inherits:
-
Object
- Object
- StandardId::Web::SignupForm
- Includes:
- ActiveModel::Attributes, ActiveModel::Model, PasswordStrength
- Defined in:
- app/forms/standard_id/web/signup_form.rb
Instance Attribute Summary collapse
-
#account ⇒ Object
readonly
Returns the value of attribute account.
Instance Method Summary collapse
Instance Attribute Details
#account ⇒ Object (readonly)
Returns the value of attribute account.
12 13 14 |
# File 'app/forms/standard_id/web/signup_form.rb', line 12 def account @account end |
Instance Method Details
#submit ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/forms/standard_id/web/signup_form.rb', line 17 def submit return false unless valid? emit_account_creating ActiveRecord::Base.transaction do @account = Account.create!(account_params) password_credential = StandardId::PasswordCredential.create!( password_credential_params.merge( credential_attributes: { identifier_attributes: email_identifier_params.merge(account: @account) } ) ) emit_account_created emit_credential_created(password_credential) end true rescue ActiveRecord::RecordInvalid => e errors.add(:base, e.record.errors..join(", ")) false rescue ActiveRecord::RecordNotUnique errors.add(:base, "Unable to complete registration. If you already have an account, please sign in.") false end |