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