Sha256: 2e993e0c055635306a684afc9da0338591e81fd8646b37bc4189cfa0d449725f

Contents?: true

Size: 526 Bytes

Versions: 2

Compression:

Stored size: 526 Bytes

Contents

class Admin::User < Admin::ApplicationRecord
  has_secure_password

  generates_token_for :password_reset, expires_in: 20.minutes do
    password_salt.last(10)
  end

  validates :email, presence: true, uniqueness: true, format: { with: URI::MailTo::EMAIL_REGEXP }
  validates :password, allow_nil: true, length: { minimum: 12 }, format: { with: /(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])/ }

  normalizes :email, with: -> { _1.strip.downcase }

  def self.ransackable_attributes(auth_object = nil)
    %w[email created_at]
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
administration-zero-1.0.6 lib/generators/admin/install/templates/models/admin/user.rb
administration-zero-1.0.5 lib/generators/admin/install/templates/models/admin/user.rb