Add consts User::*_PASSWORD_LENGTH
This commit is contained in:
parent
45cc24817c
commit
57d6d4f545
|
@ -28,7 +28,7 @@ private
|
|||
email: context.email,
|
||||
).lock(true).first_or_initialize do |new_user|
|
||||
new_user.account = Account.new contact_list: ContactList.new
|
||||
new_user.password = Devise.friendly_token 128
|
||||
new_user.password = Devise.friendly_token User::MAX_PASSWORD_LENGTH
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class User < ApplicationRecord
|
||||
MIN_PASSWORD_LENGTH = 8
|
||||
MAX_PASSWORD_LENGTH = 128
|
||||
|
||||
devise(
|
||||
:confirmable,
|
||||
:database_authenticatable,
|
||||
|
|
|
@ -176,7 +176,7 @@ Devise.setup do |config|
|
|||
|
||||
# ==> Configuration for :validatable
|
||||
# Range for password length.
|
||||
config.password_length = 8..128
|
||||
config.password_length = User::MIN_PASSWORD_LENGTH..User::MAX_PASSWORD_LENGTH
|
||||
|
||||
# Email regex used to validate email formats. It simply asserts that
|
||||
# one (and only one) @ exists in the given string. This is mainly
|
||||
|
|
Reference in New Issue