From af59295d6ca58b6b7d09a6734b47347578879337 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Sat, 13 Jul 2019 14:41:41 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E8=AE=A4=E8=AF=81=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 55 ++++++----------------- 1 file changed, 14 insertions(+), 41 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e6c0116fc..c9c2d90e8 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -147,20 +147,7 @@ class ApplicationController < ActionController::Base # 前端会捕捉401,弹登录弹框 # 未授权的捕捉407,弹试用申请弹框 def require_login - #6.13 -hs - 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 - + tip_exception(401, "..") unless User.current.logged? end # 异常提醒 @@ -190,33 +177,19 @@ class ApplicationController < ActionController::Base # 系统全局认证 # def check_auth - # old_edu_host = edu_setting('old_edu_host') - # ue = current_user.user_extension - # - # if current_user.lastname.blank? || ue.school_id.blank? || ue.identity.blank? || current_user.mail.blank? - # info_url = old_edu_host + '/account/user_info' - # render :json => { status: 402, url: info_url } - # elsif current_user.certification != 1 - # day_cer = UserDayCertification.where(user_id: current_user.id).last - # unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400 - # account_url = old_edu_host + "/my/account" - # render :json => { status: 402, url: account_url } - # 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 + if User.current.logged? + if !current_user.profile_completed? + info_url = '/account/user_info' + tip_exception(402, info_url) + elsif current_user.certification != 1 + day_cer = UserDayCertification.where(user_id: current_user.id).last + unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400 + tip_exception(407, "系统未授权") + end + end + else + tip_exception(401, "..") + end end def start_user_session(user)