用户注册激活、token值过期添加提示
This commit is contained in:
parent
ab77cbff12
commit
b9eb320d17
|
@ -23,6 +23,12 @@ class AccountController < ApplicationController
|
|||
skip_before_filter :check_if_login_required
|
||||
# Login request and validation
|
||||
def login
|
||||
if params[:type] == "activated"
|
||||
@message = l(:notice_account_activated)
|
||||
elsif params[:type] == "expired"
|
||||
@message = l(:notice_account_expired)
|
||||
end
|
||||
|
||||
if request.get?
|
||||
@login = params[:login] || true
|
||||
if User.current.logged?
|
||||
|
@ -201,7 +207,8 @@ class AccountController < ApplicationController
|
|||
def activate
|
||||
(redirect_to(signin_path); return) unless Setting.self_registration? && params[:token].present?
|
||||
token = Token.find_token('register', params[:token].to_s)
|
||||
(redirect_to(signin_path); return) unless token and !token.expired?
|
||||
type = l(:notice_account_expired) if (token && token.expired?)
|
||||
(redirect_to(signin_path(:type => "expired")); return) unless token and !token.expired?
|
||||
user = token.user
|
||||
(redirect_to(signin_path); return) unless user.registered?
|
||||
user.activate
|
||||
|
@ -209,7 +216,7 @@ class AccountController < ApplicationController
|
|||
token.destroy
|
||||
flash[:notice] = l(:notice_account_activated)
|
||||
end
|
||||
redirect_to signin_url
|
||||
redirect_to signin_url(:message => "activated")
|
||||
end
|
||||
|
||||
def api_register login,password,email
|
||||
|
|
|
@ -136,6 +136,9 @@
|
|||
<p>在这里,您的创新意识和创新潜力将得到充分发挥!目前已有超过200所高校和科研机构在平台中开展在线协同开发、协同学习和协同研究。</p>
|
||||
</div>
|
||||
<div class="new_login_box fr mr45 mt100">
|
||||
<% if @message %>
|
||||
<p class="f14 mb5" style=" color:#fff;"><i class="icon-ok mr5"></i><%= h @message %></p>
|
||||
<% end %>
|
||||
<h2 class="new_login_h2">登录
|
||||
<a href="<%= register_url_without_domain %>" class="fr mt5">立即注册</a><div class="cl"></div>
|
||||
</h2>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'css/common', 'css/structure', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'css/common', 'css/structure', 'css/font-awesome', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= javascript_include_tag "bootstrap","avatars","new_user"%>
|
||||
|
|
|
@ -89,4 +89,4 @@ zh:
|
|||
label_check_email: 立即查收邮件
|
||||
label_mail_resend: 重新发送激活邮件
|
||||
notice_account_activated: 您的帐号已被激活。
|
||||
|
||||
notice_account_expired: 账号激活信息已过期。
|
||||
|
|
Loading…
Reference in New Issue