|
|
|
@ -46,7 +46,8 @@ class ApplicationController < ActionController::Base
|
|
|
|
|
# 判断用户的邮箱或者手机是否可用
|
|
|
|
|
# params[:type] 1: 注册;2:忘记密码
|
|
|
|
|
def check_mail_and_phone_valid login, type
|
|
|
|
|
unless login =~ /^[a-zA-Z0-9]+([._\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/ || login =~ /^1\d{10}$/
|
|
|
|
|
unless login =~ /^[a-zA-Z0-9]+([._\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/ || login =~ /^1\d{10}$/ ||
|
|
|
|
|
login =~ /^[a-zA-Z0-9]+([._\\]*[a-zA-Z0-9])$/
|
|
|
|
|
tip_exception(-2, "请输入正确的手机号或邮箱")
|
|
|
|
|
end
|
|
|
|
|
# 考虑到安全参数问题,多一次查询,去掉Union
|
|
|
|
@ -186,7 +187,7 @@ class ApplicationController < ActionController::Base
|
|
|
|
|
# 系统全局认证
|
|
|
|
|
def check_auth
|
|
|
|
|
if current_user.certification != 1 && current_user.apply_actions.exists?(container_type: 'TrialAuthorization', status: 0)
|
|
|
|
|
tip_exception(-1, "您的试用申请正在审核中,请耐心等待")
|
|
|
|
|
tip_exception(408, "您的试用申请正在审核中,请耐心等待")
|
|
|
|
|
elsif current_user.certification != 1
|
|
|
|
|
day_cer = UserDayCertification.find_by(user_id: current_user.id)
|
|
|
|
|
tip_exception(407, "系统未授权") unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400
|
|
|
|
|