新增: 邮箱验证码重新发送后之前的验证码需设置为无效
This commit is contained in:
parent
e15809c186
commit
9664ca001e
|
@ -29,6 +29,8 @@ class Api::V1::UsersController < Api::V1::BaseController
|
|||
tip_exception(-2,"邮件发送失败,请稍后重试")
|
||||
end
|
||||
ver_params = {code_type: code_type, code: verification_code, email: mail}
|
||||
last_code = VerificationCode.where(code_type: code_type, email: mail).last
|
||||
last_code.update_attributes!({created_at: Time.current - 10.minute}) if last_code.present?
|
||||
data = VerificationCode.new(ver_params)
|
||||
if data.save!
|
||||
render_ok
|
||||
|
|
Loading…
Reference in New Issue