Class: StandardId::Web::ResetPasswordConfirmForm
- Inherits:
-
Object
- Object
- StandardId::Web::ResetPasswordConfirmForm
- Includes:
- ActiveModel::Attributes, ActiveModel::Model, PasswordStrength
- Defined in:
- app/forms/standard_id/web/reset_password_confirm_form.rb
Instance Attribute Summary collapse
-
#password_credential ⇒ Object
readonly
Returns the value of attribute password_credential.
Instance Method Summary collapse
-
#initialize(password_credential, params = {}) ⇒ ResetPasswordConfirmForm
constructor
A new instance of ResetPasswordConfirmForm.
- #submit ⇒ Object
Constructor Details
#initialize(password_credential, params = {}) ⇒ ResetPasswordConfirmForm
Returns a new instance of ResetPasswordConfirmForm.
17 18 19 20 |
# File 'app/forms/standard_id/web/reset_password_confirm_form.rb', line 17 def initialize(password_credential, params = {}) @password_credential = password_credential super(params) end |
Instance Attribute Details
#password_credential ⇒ Object (readonly)
Returns the value of attribute password_credential.
11 12 13 |
# File 'app/forms/standard_id/web/reset_password_confirm_form.rb', line 11 def password_credential @password_credential end |
Instance Method Details
#submit ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/forms/standard_id/web/reset_password_confirm_form.rb', line 22 def submit return false unless valid? ActiveRecord::Base.transaction do @password_credential.update!(password: password, password_confirmation: password_confirmation) @password_credential.account.sessions.destroy_all end true rescue ActiveRecord::RecordInvalid => e errors.add(:base, e.record.errors..join(", ")) false end |