|
|
|
@ -685,7 +685,7 @@ class AccountController < ApplicationController
|
|
|
|
|
else
|
|
|
|
|
code = VerificationCode.where(:email => params[:phone], :code => params[:code], :code_type => params[:type].to_i).last
|
|
|
|
|
end
|
|
|
|
|
req[:valid] = !code.nil? && (Time.now.to_i - code.created_at.to_i) <= 10*60
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
render :json => req
|
|
|
|
|
end
|
|
|
|
@ -1183,10 +1183,14 @@ class AccountController < ApplicationController
|
|
|
|
|
def reset_psd
|
|
|
|
|
if params[:lost_psd_phone] && params[:lost_psd_phone].strip != ""
|
|
|
|
|
@user = User.where("phone = '#{params[:lost_psd_phone].to_s}'").first
|
|
|
|
|
code = VerificationCode.where(:phone => params[:lost_psd_phone], :code => params[:code], :code_type => 2).last
|
|
|
|
|
|
|
|
|
|
elsif params[:lost_psd_email] && params[:lost_psd_email].strip != ""
|
|
|
|
|
@user = User.where("mail = '#{params[:lost_psd_email].to_s}'").first
|
|
|
|
|
code = VerificationCode.where(:email => params[:lost_psd_email], :code => params[:code], :code_type => 3).last
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if !code.nil? && (Time.now.to_i - code.created_at.to_i) <= 10*60
|
|
|
|
|
if @user.present?
|
|
|
|
|
@user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
|
|
|
|
|
if @user.save
|
|
|
|
@ -1202,6 +1206,9 @@ class AccountController < ApplicationController
|
|
|
|
|
redirect_to signin_path
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
@status = 0
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def email_valid
|
|
|
|
|