Sha256: 1340926d0b21aae0f243653bbf2a1b842fbdf940f10ab43c2e5056b26f240e78

Contents?: true

Size: 454 Bytes

Versions: 12

Compression:

Stored size: 454 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

    user.send_password_reset_notification(user.generate_token_for(:password_reset))

    true
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

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