Fix secure in password

parent 02f91bdf
......@@ -17,7 +17,8 @@ class User < ApplicationRecord
validates :email, presence: true, format: { with: VALID_EMAIL_REGEX },
uniqueness: { case_sensitive: false }
validates :password, allow_nil: true, length: { minimum: 6, too_short: "is blank or too short" }
PASSWORD_FORMAT = /\A(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z])/x
validates :password, allow_nil: true, format: { with: PASSWORD_FORMAT, message: "is too short or not strength" }
def self.new_remember_token
SecureRandom.urlsafe_base64
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment