|
|
|
@ -23,6 +23,8 @@ class User < ApplicationRecord
|
|
|
|
|
# 身份证
|
|
|
|
|
VALID_NUMBER_REGEX = /(^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^([A-Z]\d{6,10}(\(\w{1}\))?)$)/
|
|
|
|
|
|
|
|
|
|
VALID_PASSWORD_REGEX = /\A[a-z_A-Z0-9-\.!@#\$%\\\^&\*\)\(\+=\{\}\[\]\/",'<>~\·`\?:;|]{8,16}\z/
|
|
|
|
|
|
|
|
|
|
LOGIN_LENGTH_LIMIT = 30
|
|
|
|
|
MAIL_LENGTH_LMIT = 60
|
|
|
|
|
|
|
|
|
@ -181,6 +183,7 @@ class User < ApplicationRecord
|
|
|
|
|
#validates_format_of :ID_number, with: VALID_NUMBER_REGEX, multiline: true, message: "身份证号格式不对"
|
|
|
|
|
# validates :nickname, presence: true, length: { maximum: 10 }
|
|
|
|
|
# validates :lastname, presence: true
|
|
|
|
|
validates :password, with: VALID_PASSWORD_REGEX, message: "8~16位密码,支持字母数字和符号"
|
|
|
|
|
|
|
|
|
|
# 删除自动登录的token,一旦退出下次会提示需要登录
|
|
|
|
|
def delete_autologin_token(value)
|
|
|
|
|