Sha256: fe382e78d5ae027939b772318b2394fbd25e70861e5a881f4b2ec92dea52b96e

Contents?: true

Size: 506 Bytes

Versions: 10

Compression:

Stored size: 506 Bytes

Contents

class Auth::NewPasswordForm < ApplicationForm
  attr_accessor :token, :password, :password_confirmation

  validates :token, presence: true
  validates :password, presence: true, confirmation: true, length: { minimum: 8 }

  def reset?
    return false if invalid?

    user = User.find_by_token_for(:password_reset, @token)

    if user.nil?
      errors.add(:password, message: 'This password reset token is invalid.')
      return false
    end

    user.update(password: @password)

    true
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
kaze-0.17.0 stubs/default/app/forms/auth/new_password_form.rb
kaze-0.16.0 stubs/default/app/forms/auth/new_password_form.rb
kaze-0.15.0 stubs/default/app/forms/auth/new_password_form.rb
kaze-0.14.0 stubs/default/app/forms/auth/new_password_form.rb
kaze-0.13.0 stubs/default/app/forms/auth/new_password_form.rb
kaze-0.12.0 stubs/default/app/forms/auth/new_password_form.rb
kaze-0.11.0 stubs/default/app/forms/auth/new_password_form.rb
kaze-0.10.0 stubs/default/app/forms/auth/new_password_form.rb
kaze-0.9.0 stubs/default/app/forms/auth/new_password_form.rb
kaze-0.8.0 stubs/default/app/forms/auth/new_password_form.rb