用户认证问题

dev_forum
jingquan huang 5 years ago
parent daff54613d
commit af59295d6c

@ -147,20 +147,7 @@ class ApplicationController < ActionController::Base
# 前端会捕捉401,弹登录弹框 # 前端会捕捉401,弹登录弹框
# 未授权的捕捉407弹试用申请弹框 # 未授权的捕捉407弹试用申请弹框
def require_login def require_login
#6.13 -hs tip_exception(401, "..") unless User.current.logged?
if User.current.logged?
if !current_user.profile_completed?
info_url = "#{edu_setting('old_edu_host')}/account/user_info"
tip_exception(402, info_url)
# render :json => { status: 402, url: info_url }
elsif current_user.certification != 1
day_cer = UserDayCertification.where(user_id: current_user.id).last
tip_exception(407, "系统未授权") unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400
end
else
tip_exception(401, "..")
end
end end
# 异常提醒 # 异常提醒
@ -190,33 +177,19 @@ class ApplicationController < ActionController::Base
# 系统全局认证 # 系统全局认证
# #
def check_auth def check_auth
# old_edu_host = edu_setting('old_edu_host') if User.current.logged?
# ue = current_user.user_extension if !current_user.profile_completed?
# info_url = '/account/user_info'
# if current_user.lastname.blank? || ue.school_id.blank? || ue.identity.blank? || current_user.mail.blank? tip_exception(402, info_url)
# info_url = old_edu_host + '/account/user_info' elsif current_user.certification != 1
# render :json => { status: 402, url: info_url } day_cer = UserDayCertification.where(user_id: current_user.id).last
# elsif current_user.certification != 1 unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400
# day_cer = UserDayCertification.where(user_id: current_user.id).last tip_exception(407, "系统未授权")
# unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400 end
# account_url = old_edu_host + "/my/account" end
# render :json => { status: 402, url: account_url } else
# end tip_exception(401, "..")
# end end
true
end
# 身份资料的认证:
# 如果试用过期则弹框提示认证,先跳入个人资料页面完善资料,资料完成后,弹框提醒用户试用申请
def check_account
# # todo user_extension
# if User.current.logged?
# ue = current_user.user_extension
# if current_user.lastname.blank? || ue.school_id.blank? || ue.identity.blank? || current_user.mail.blank?
# info_url = "#{edu_setting('old_edu_host')}/account/user_info"
# render :json => { status: 402, url: info_url }
# end
# end
end end
def start_user_session(user) def start_user_session(user)

Loading…
Cancel
Save