1
0
Fork 0

Add consts User::*_PASSWORD_LENGTH

This commit is contained in:
Alex Kotov 2019-10-18 09:31:05 +05:00
parent 45cc24817c
commit 57d6d4f545
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
3 changed files with 5 additions and 2 deletions

View File

@ -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

View File

@ -1,6 +1,9 @@
# frozen_string_literal: true
class User < ApplicationRecord
MIN_PASSWORD_LENGTH = 8
MAX_PASSWORD_LENGTH = 128
devise(
:confirmable,
:database_authenticatable,

View File

@ -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