Sha256: 47a28ce62340eac73d0dc4d590d6a6d9bed23684cd97d4451f0ae098190ac01b

Contents?: true

Size: 472 Bytes

Versions: 7

Compression:

Stored size: 472 Bytes

Contents

class Auth::SendPasswordResetLinkForm < ApplicationForm
  attr_accessor :email

  validates :email, presence: true, email: true

  def send_reset_link?
    return false if invalid?

    user = User.find_by(email: email)

    if user.nil?
      errors.add(:email, message: "We can't find a user with that email address.")
      return false
    end

    token = user.generate_token_for(:password_reset)

    user.send_password_reset_notification(token)

    true
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
kaze-0.7.0 stubs/default/app/forms/auth/send_password_reset_link_form.rb
kaze-0.6.0 stubs/default/app/forms/auth/send_password_reset_link_form.rb
kaze-0.5.0 stubs/default/app/forms/auth/send_password_reset_link_form.rb
kaze-0.4.0 stubs/default/app/forms/auth/send_password_reset_link_form.rb
kaze-0.3.0 stubs/default/app/forms/auth/send_password_reset_link_form.rb
kaze-0.2.0 stubs/default/app/forms/auth/send_password_reset_link_form.rb
kaze-0.1.0 stubs/default/app/forms/auth/send_password_reset_link_form.rb