Sha256: 65c45a2ed53d1e68cb0a3ef346f396317d869831d4551eeecf4624f69bdb99ff
Contents?: true
Size: 928 Bytes
Versions: 4
Compression:
Stored size: 928 Bytes
Contents
# frozen_string_literal # Model concern to provide shared behaviour for authenticating records. # # Automatically generated by the orthodox gem (https://github.com/katanacode/orthodox) # (c) Copyright 2019 Katana Code Ltd. All Rights Reserved. module Authenticateable extend ActiveSupport::Concern MINIMUM_PASSWORD_LENGTH = 6 MAXIMUM_PASSWORD_LENGTH = 128 included do has_secure_password validates :email, email_format: { allow_blank: true }, presence: true validates :password, presence: { if: :validate_presence_of_password? }, length: { minimum: MINIMUM_PASSWORD_LENGTH, maximum: MAXIMUM_PASSWORD_LENGTH, allow_blank: true } end private def validate_presence_of_password? new_record? || changes.include?("password") end module ClassMethods end end
Version data entries
4 entries across 4 versions & 1 rubygems