认证问题

dev_course
jingquan huang 6 years ago
parent 0b66b43509
commit 28ae660719

@ -176,19 +176,20 @@ class ApplicationController < ActionController::Base
# 系统全局认证 # 系统全局认证
# #
def check_auth def check_auth
old_edu_host = edu_setting('old_edu_host') # old_edu_host = edu_setting('old_edu_host')
ue = current_user.user_extension # ue = current_user.user_extension
#
if current_user.lastname.blank? || ue.school_id.blank? || ue.identity.blank? || current_user.mail.blank? # if current_user.lastname.blank? || ue.school_id.blank? || ue.identity.blank? || current_user.mail.blank?
info_url = old_edu_host + '/account/user_info' # info_url = old_edu_host + '/account/user_info'
render :json => { status: 402, url: info_url } # render :json => { status: 402, url: info_url }
elsif current_user.certification != 1 # elsif current_user.certification != 1
day_cer = UserDayCertification.where(user_id: current_user.id).last # day_cer = UserDayCertification.where(user_id: current_user.id).last
unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400 # unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400
account_url = old_edu_host + "/my/account" # account_url = old_edu_host + "/my/account"
render :json => { status: 402, url: account_url } # render :json => { status: 402, url: account_url }
end # end
end # end
true
end end
# 身份资料的认证: # 身份资料的认证:

@ -1,5 +1,5 @@
class ShixunsController < ApplicationController class ShixunsController < ApplicationController
# before_action :require_login, except: [:download_file, :index, :menus] before_action :require_login, except: [:download_file, :index, :menus]
before_action :check_auth, except: [:download_file, :index] before_action :check_auth, except: [:download_file, :index]
before_action :find_shixun, except: [:index, :new, :create, :menus, :get_recommend_shixuns, :propaedeutics, before_action :find_shixun, except: [:index, :new, :create, :menus, :get_recommend_shixuns, :propaedeutics,

Loading…
Cancel
Save