Sha256: 9c9df55becbefb2ae42a331cf4db6fb76a3150ac50260e92da0043ab63a20b4c

Contents?: true

Size: 408 Bytes

Versions: 1

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

1 entries across 1 versions & 1 rubygems

Version Path
kaze-0.5.0 stubs/default/app/forms/auth/login_form.rb