实名认证

This commit is contained in:
huang 2017-06-09 20:35:58 +08:00
parent e3d61feb38
commit b3bac60f3f
9 changed files with 81 additions and 45 deletions

View File

@ -452,6 +452,16 @@ class AccountController < ApplicationController
render :layout => 'base_edu_account'
end
def apply_trail
apply_action = ApplyAction.where(:user_id => User.current.id, :container_type => "TrialAuthorization").first
if apply_action.blank?
ApplyAction.create(:user_id => User.current.id, :status => 0, :container_type => "TrialAuthorization")
end
respond_to do |format|
format.js
end
end
def user_auth
@user = User.current
diskfile1 = disk_auth_filename('UserAuthentication', @user.id, 'ID')

View File

@ -62,16 +62,16 @@ class ApplicationController < ActionController::Base
# 判断用户是否认证
def check_authentication
return true
# uthentication = AuthenticationsUsers.where(:user_id => User.current.id).first
# user_account = User.current.try(:user_extensions).try(:occupation)
# if uthentication.blank? || user_account.blank?
# redirect_to my_account_path
# return
# elsif User.current.authentications == 0
# redirect_to authentication_account_path
# return
# end
# return true
if params[:action] == "on_search" || params[:action] == "apply_trail" # 之所以这样处理是为了避开account页面ajax加载
return true
end
authentication = ApplyAction.where(:user_id => User.current.id).first
user_identity = User.current.try(:user_extensions).try(:identity)
if user_identity.blank? || authentication.blank?
redirect_to my_account_path
return
end
end
def session_expiration

View File

@ -147,21 +147,35 @@ class MyController < ApplicationController
end
@user = User.current
# 基本资料不完善 @force为false 完善 @force为true
@force = false
if params[:tip]
@force = true
# 认证
ue = @user.user_extensions
@trail_authentication = ApplyAction.where(:user_id => User.current.id).first
@authentication = @user.authentication
if ue.identity.nil?
@require_auth = true
else
user = UserExtensions.where(:user_id => User.current.id).first
if user.gender.nil? || user.school_id.nil? || User.current.lastname.nil?
@force = true
elsif user.identity == 3 && user.school_id.nil?
@force = true
if @trail_authentication.blank?
@require_trail_auth = true
end
end
# 用户认证
@auth = @user.authentication ? false : true
# @require_auth = true
#
# # 基本资料不完善 @force为false 完善 @force为true
# @force = false
# # @authentication = @user.authentication
# @trail_authentication = AuthenticationsUsers.where(:user_id => User.current.id).first
# if params[:tip]
# @force = true
# else
# user = UserExtensions.where(:user_id => User.current.id).first
# if user.identity.nil? || user.school_id.nil? || User.current.lastname.nil?
# @force = false
# else
# @force = @trail_authentication.blank? ? false : true
# end
# end
# # 用户认证
# @auth = @user.authentication ? false : true
@s_message = AppliedMessage.where(:status => 3, :user_id => User.current.id, :viewed => 0, :applied_type => 'ApplyAddSchools').first
@d_message = AppliedMessage.where(:status => 3, :user_id => User.current.id, :viewed => 0, :applied_type => 'ApplyAddDepartment').first
@ -217,6 +231,7 @@ class MyController < ApplicationController
@se.brief_introduction = params[:brief_introduction]
if @user.save && @se.save
reward_grade(@user, @user.id, 'Account', 500)
# 修改邮箱的时候同步修改到gitlab
# if changed_mail || changed_login

View File

@ -0,0 +1 @@
notice_box("申请成功,我们将在一个工作日内完成审核")

View File

@ -30,11 +30,7 @@
<div class="newContainer"> <!-- 页面全部内容 -->
<div class="newHeader">
<% if User.current.logged? %>
<% if @force %>
<%= render :partial => 'layouts/logined_force_header' %>
<% else %>
<%= render :partial => 'layouts/logined_header' %>
<% end %>
<%= render :partial => 'layouts/logined_header' %>
<% else%>
<%= render :partial => 'layouts/unlogin_header' %>
<% end%>

View File

@ -0,0 +1 @@
<%= render :partial => "welcome/no_data" %>

View File

@ -1,3 +1,17 @@
<% if @require_auth %>
<%= render :partial => "welcome/guidance_mask" %>
<% else %>
<% if @require_trail_auth %>
<%= render :partial => 'welcome/two_btn_mask_pop',
:locals => {:btn1 => "试用申请", :btn2 => "身份认证",
:tip1 => "更多功能,需要经过管理员的授权审核",
:tip2 => "建议先提交身份认证,再进行试用申请",
:url1 => "#{apply_trail_account_path}",
:url2 => "#{authentication_account_path}"
}
%>
<% end %>
<% end %>
<div class="panel-user-right-con clearfix">
<div id="edit_account_div" class="none">
<div class="alert alert-orange mb15 mt15 <%= (@s_message.nil? && @d_message.nil?) ? 'none' : '' %>" id="account_tip">
@ -249,17 +263,7 @@
<% title = "" %>
<% language = "" %>
<% end %>
<% if false %>
<%= render :partial => "welcome/guidance_mask" %>
<% elsif false %>
<%= render :partial => 'welcome/two_btn_mask_pop',
:locals => {:btn1 => "试用申请", :btn2 => "身份认证",
:tip1 => "更多功能,需要经过管理员的授权审核",
:tip2 => "建议先提交身份认证,再进行试用申请",
:url1 => "javascript:void(0);",
:url2 => "#{authentication_account_path}"}
%>
<% end %>
<script type="text/javascript">
function apply_add_school() {
var htmlvalue = "<%= escape_javascript(render :partial => 'my/apply_add_school')%>";

View File

@ -19,13 +19,21 @@
<p class="task-popup-text-center font-16">
<%= tip1 %>
</p>
<p class="task-popup-text-center font-12 color-grey mb10">
<%= tip2 %>
</p>
<div class="clearfix task-popup-submit" style="width:180px;">
<a href="<%= url1 %>" class="task-btn task-btn-blue fr" id="mask-left-btn"><%= btn1 %></a>
<a href="<%= url2 %>" class="task-btn task-btn-blue fr mr10" id="mask-right-btn"><%= btn2 %></a>
</div>
<% unless @authentication %>
<p class="task-popup-text-center font-12 color-grey mb10">
<%= tip2 %>
</p>
<% end %>
<% if @authentication %>
<div class="clearfix task-popup-submit04">
<a href="<%= url1 %>" class="task-btn task-btn-blue" id="btn_mask" onclick="$('.task-popup-warp').remove();" data-remote="true"><%= btn1 %></a>
</div>
<% else %>
<div class="clearfix task-popup-submit" style="width:180px;">
<a href="<%= url1 %>" class="task-btn task-btn-blue fr" id="mask-left-btn" onclick="$('.task-popup-warp').remove();" data-remote="true"><%= btn1 %></a>
<a href="<%= url2 %>" class="task-btn task-btn-blue fr mr10" id="mask-right-btn" onclick="$('.task-popup-warp').remove();"><%= btn2 %></a>
</div>
<% end %>
</div>
</div>
</div>

View File

@ -643,6 +643,7 @@ RedmineApp::Application.routes.draw do
match 'account/resendmail', :to => 'account#resendmail', :via=> :get, :as => 'resendmail'
match 'account/avatar', :to => 'account#avatar', :via => :get, :as => "avatar_account"
match 'account/authentication', :to => 'account#authentication', :via => :get, :as => "authentication_account"
match 'account/apply_trail', :to => 'account#apply_trail', :via => :get, :as => "apply_trail_account"
match 'account/user_auth', :to => 'account#user_auth', :via => :get, :as => "user_auth_account"
match 'account/security_settings', :to => 'account#security_settings', :via => :get, :as => "security_settings"
match 'account/change_psd', :to => 'account#change_psd', :via => :get, :as => "change_psd"