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