Sha256: c1179f3ff33205920f6852996cb54dd999a7f151af98db7574da0b999c1ad329

Contents?: true

Size: 886 Bytes

Versions: 1

Compression:

Stored size: 886 Bytes

Contents

# frozen_string_literal: true

module Auth
  class PasswordUpdateForm < ApplicationForm
    attribute :password, String
    attribute :password_confirmation, String
    attribute :reset_password_token, String
    attribute :access_token, String
    attribute :device_uid, String, default: 'browser'

    validates :password, presence: true, length: { minimum: 6, maximum: 128 }, confirmation: true
    validates :reset_password_token, presence: true

    def submit
      return false unless valid?

      params = attributes
      params[:id] ||= params.try(:delete, :reset_password_token) if params[:reset_password_token].present?
      merge_responce! TranslationCms::Api::Password.requestor.update(
        TranslationCms::Api::Password.new(params)
      )
      # api_answer = TranslationCms::Api::Customer.reset_password_by_token(attributes)
      errors.empty?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
translation_cms-0.1.5 app/forms/auth/password_update_form.rb