mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-16 09:45:57 +08:00
修复
This commit is contained in:
@@ -39,17 +39,17 @@ class Api::V1::UsersController < Api::V1::BaseController
|
||||
|
||||
def check_password
|
||||
password = params[:password]
|
||||
return render_error(-5, "8~16位密码,支持字母数字和符号") unless password =~ CustomRegexp::PASSWORD
|
||||
return render_error(-5, "密码错误") unless @observe_user.check_password?(password)
|
||||
return tip_exception(-5, "8~16位密码,支持字母数字和符号") unless password =~ CustomRegexp::PASSWORD
|
||||
return tip_exception(-5, "密码错误") unless @observe_user.check_password?(password)
|
||||
render_ok
|
||||
end
|
||||
|
||||
def check_email
|
||||
mail = strip(params[:email])
|
||||
return render_error(-2, "邮件格式有误") unless mail =~ CustomRegexp::EMAIL
|
||||
return tip_exception(-2, "邮件格式有误") unless mail =~ CustomRegexp::EMAIL
|
||||
|
||||
exist_owner = Owner.find_by(mail: mail)
|
||||
return render_error(-2, '邮箱已被使用') if exist_owner
|
||||
return tip_exception(-2, '邮箱已被使用') if exist_owner
|
||||
render_ok
|
||||
end
|
||||
|
||||
@@ -58,13 +58,13 @@ class Api::V1::UsersController < Api::V1::BaseController
|
||||
mail = strip(params[:email])
|
||||
code_type = params[:code_type]
|
||||
|
||||
return render_error(-2, "邮件格式有误") unless mail =~ CustomRegexp::EMAIL
|
||||
return tip_exception(-2, "邮件格式有误") unless mail =~ CustomRegexp::EMAIL
|
||||
|
||||
verifi_code = VerificationCode.where(email: mail, code: code, code_type: code_type).last
|
||||
return render_ok if code == "123123" && EduSetting.get("code_debug") # 万能验证码,用于测试 # TODO 万能验证码,用于测试
|
||||
|
||||
return render_error(-6, "验证码不正确") if verifi_code&.code != code
|
||||
return render_error(-6, "验证码已失效") if !verifi_code&.effective?
|
||||
return tip_exception(-6, "验证码不正确") if verifi_code&.code != code
|
||||
return tip_exception(-6, "验证码已失效") if !verifi_code&.effective?
|
||||
render_ok
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user