FIX code bug when user register

This commit is contained in:
Jasder 2020-11-18 10:35:56 +08:00
parent f1e3e935af
commit a54613752e
1 changed files with 3 additions and 3 deletions

View File

@ -114,7 +114,7 @@ class AccountsController < ApplicationController
begin begin
# 查询验证码是否正确;type只可能是1或者8 # 查询验证码是否正确;type只可能是1或者8
type = phone_mail_type(params[:login].strip) type = phone_mail_type(params[:login].strip)
code = params[:code].strip # code = params[:code].strip
if type == 1 if type == 1
uid_logger("start register by phone: type is #{type}") uid_logger("start register by phone: type is #{type}")
@ -129,9 +129,9 @@ class AccountsController < ApplicationController
pre = 'm' pre = 'm'
email = params[:login] email = params[:login]
phone = nil phone = nil
verifi_code = VerificationCode.where(email: email, code: code, code_type: 8).last # verifi_code = VerificationCode.where(email: email, code: code, code_type: 8).last
end end
uid_logger("start register: verifi_code is #{verifi_code}, code is #{code}, time is #{Time.now.to_i - verifi_code.try(:created_at).to_i}") # uid_logger("start register: verifi_code is #{verifi_code}, code is #{code}, time is #{Time.now.to_i - verifi_code.try(:created_at).to_i}")
# check_code = (verifi_code.try(:code) == code.strip && (Time.now.to_i - verifi_code.created_at.to_i) <= 10*60) # check_code = (verifi_code.try(:code) == code.strip && (Time.now.to_i - verifi_code.created_at.to_i) <= 10*60)
# todo 上线前请删除万能验证码"513231" # todo 上线前请删除万能验证码"513231"
return normal_status(-1, "该邮箱已注册") if User.exists?(mail: params[:login]) return normal_status(-1, "该邮箱已注册") if User.exists?(mail: params[:login])