Sha256: 3dddea3f9e913c8cc854f62b400cf70cd8372a98fa02cab93d1a0ac570d6bf4a

Contents?: true

Size: 408 Bytes

Versions: 4

Compression:

Stored size: 408 Bytes

Contents

class Auth::LoginForm < ApplicationForm
  attr_accessor :email, :password

  validates :email, presence: true, email: true
  validates :password, presence: true

  def authenticate
    return nil if invalid?

    user = User.authenticate_by(email: email, password: password)

    return user if user.present?

    errors.add(:email, message: "These credentials do not match our records.")

    nil
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kaze-0.4.0 stubs/default/app/forms/auth/login_form.rb
kaze-0.3.0 stubs/default/app/forms/auth/login_form.rb
kaze-0.2.0 stubs/default/app/forms/auth/login_form.rb
kaze-0.1.0 stubs/default/app/forms/auth/login_form.rb