没激活的帐号界面

This commit is contained in:
yuanke 2016-06-22 14:04:47 +08:00
parent db6962a3a6
commit b68e227531
6 changed files with 270 additions and 4 deletions

View File

@ -239,14 +239,21 @@ class AccountController < ApplicationController
end
def resendmail
status = 1
user = User.find(params[:user]) if params[:user]
token = Token.new(:user => user, :action => "register")
if token.save
Mailer.run.register(token)
else
yield if block_given?
status = 0
end
render :json => status
end
def email_activation
end
private
@ -264,6 +271,7 @@ class AccountController < ApplicationController
if user.nil?
invalid_credentials
elsif user.status == 2
@user = user
invalid_credentials_new
elsif user.new_record?
onthefly_creation_failed(user, {:login => user.login, :auth_source_id => user.auth_source_id })
@ -375,8 +383,9 @@ class AccountController < ApplicationController
def invalid_credentials_new
logger.warn "Failed login for '#{params[:username]}' from #{request.remote_ip} at #{Time.now.utc}"
flash[:error] = l(:notice_account_invalid_creditentials_new)
render signin_path(:login=>true)
# flash[:error] = l(:notice_account_invalid_creditentials_new)
# render signin_path(:login=>true)
render :action => 'email_activation'
end
# Register a user for email activation.

View File

@ -1239,6 +1239,12 @@ class UsersController < ApplicationController
render :layout=>'new_base_user'
end
#给某人留言
def feedBackTo
end
def user_comments
end

View File

@ -337,6 +337,26 @@ class WordsController < ApplicationController
UserExtensions.introduction(user, message)
redirect_to user_url(user.id)
end
#邮箱激活问题留言 留言成功给出提示框
def leave_email_activation_message
status = 1 #成功
me = User.find(params[:user])
if me
@user = User.find(params[:id])
if params[:text].size>0 && @user
# @user.add_jour(me, params[:text])
#私信
message = "<span style='color:red;'>【未收到激活邮件的用户反馈,用户邮箱:"+me.mail+"】</span><br>"+params[:text]
@user.journals_for_messages << JournalsForMessage.new(:user_id => me.id, :notes => message, :reply_id => 0, :status => true, :is_readed => false, :private => 1)
else
status = 0
end
render :json => status
else
render_403
end
end
private

View File

@ -0,0 +1,52 @@
<div class="new_content">
<div class="email_verify">
<p class="email_verify_prompt"><span class="icons_email_prompt"></span>您的账号尚未激活,请先进入您的注册邮箱,激活您的账号。</p>
<button class="email_verify_btn mt30 ml30" onclick = "resendMail('<%= resendmail_path(@user) %>','<%= @user.id %>');">重新发送激活邮件</button>
<%#= link_to l(:label_mail_resend), { :controller => 'account', :action => 'resendmail',:user => @user}, :class=>"email_verify_btn mt30 ml30", :remote => true, :method => 'get' %>
<ul class="email_prompt_txt ml30 mt30">
<p class="email_prompt_p">如果您尚未收到激活邮件,请按照以下步骤操作:</p>
<li>检查邮箱的“订阅邮件”、“垃圾邮件”,可能会发现激活邮件。 </li>
<li>如果激活邮件已无效,请点击重新发送激活邮件按钮。</li>
<li>如果您无法收到激活邮件,请您直接给我们管理员留言:</li>
<div class=" mt10">
<textarea style="resize: none;" class="email_prompt_mes" placeholder="请管理员尽快帮我解决邮箱激活问题"></textarea>
<button class="email_sub_btn fr" onclick="leave_email_activation_message('<%= leave_email_activation_message_path(1)%>','<%= @user.id %>','<%= 1 %>');">确定</button>
<div class="cl"></div>
</div>
</ul>
</div>
</div>
<script type="text/javascript">
function resendMail(url,id)
{
$.get(
url,
{user: id },
function (data) {
console.log("1111111111");
console.log(data);
$(".email_verify_btn").replaceWith("<p class='email_verify_p mt30 ml30'>激活邮件已发送至您的注册邮箱,请及时登录邮箱进行验证。</p>");
}
);
}
function leave_email_activation_message(url,user,id)
{
if ($(".email_prompt_mes").val().length == 0){
//弹框请他输入文字
var htmlvalue = "</br><div style='width:550px;text-align:center'>您的留言不能为空</div></br><div style='width:67px; margin:0 auto; text-align:center'><a href='javascript:void(0);' class='Blue-btn' onclick='hideModal()'>确定</a></div>";
pop_up_box(htmlvalue,580,30,50);
return;
}
$.get(
url,
{user:user,id: 1,text:$(".email_prompt_mes").val() },
function (data) {
console.log("2222222");
console.log(data);
var htmlvalue = "<div class='email_tancon'><h2 class='email_tan_title'>您的留言已发送</h2><p class='email_tan_p'>我们将尽快处理好,并通过邮件通知您。感谢您的反馈!</p></div>"
pop_up_box(htmlvalue,580,30,50);
$(".email_prompt_mes").val("");
}
);
}
</script>

View File

@ -489,10 +489,13 @@ RedmineApp::Application.routes.draw do
match 'account/activate', :via => :get
match 'account/valid_ajax', :via => :get
match 'account/email_valid', :to => 'account#email_valid', :via => :get
match 'account/resendmail', :to => 'account#resendmail', :via=> :get
match 'account/resendmail', :to => 'account#resendmail', :via=> :get, :as => 'resendmail'
match 'projects/:id/wiki', :to => 'wikis#edit', :via => :post
match 'projects/:id/wiki/destroy', :to => 'wikis#destroy', :via => [:get, :post]
#激活邮箱反馈问题
match 'users/:id/leave_email_activation_message', :to => 'words#leave_email_activation_message', :via => :get, :as => "leave_email_activation_message"
# boards
match 'boards/:board_id/topics/new', :to => 'messages#new', :via => [:get, :post], :as => 'new_board_message'
match 'boards/:id/join_to_org_subfields', :to => 'boards#join_to_org_subfields'

View File

@ -117,3 +117,179 @@ a.f_grey:hover {color:#000000 !important;}
#loginInButton {height:54px; padding-left:10px; padding-right:10px; text-align:center; line-height:54px; vertical-align:middle; color:#ffffff; font-size:16px;}
#loginSignButton:hover {background-color:#297fb8;}
#loginInButton:hover {background-color:#297fb8;}
/* 邮箱验证 */
.email_verify body,h1,h2,h3,h4,h5,h6,hr,p,blockquote,dl,dt,dd,ul,ol,li,pre,form,fieldset,legend,button,input,textarea,th,td{ margin:0; padding:0;}
.mt30{ margin-top:30px;}
.ml30{ margin-left:30px;}
.new_content{
width:1000px;
margin:10px auto;
padding:30px 0;
background-color:#fff;
}
.email_verify{
width:720px;
margin:0px auto;
}
.email_verify_prompt{
border:2px solid #dd0000;
background:#ffe3e3 url(../images/icons_prompt.png) 25px 10px no-repeat;;
height:35px;
line-height:35px;
padding-left:45px;
color:#8b0000;
font-size:14px;
}
.email_verify_btn{
border-style:none;
height:35px;
padding:0 15px;
line-height:35px;
color:#fff;
background:#3a95d7;
text-align:center;
-webkit-border-radius:5px;
-moz-border-radius:5px;
-o-border-radius:5px;
border-radius:5px;
font-size:14px;
}
.email_verify_btn:hover{
background:#017bd3;
}
.email_sub_btn{
border-style:none;
height:30px;
padding:0 25px;
line-height:30px;
color:#fff;
background:#3a95d7;
text-align:center;
-webkit-border-radius:5px;
-moz-border-radius:5px;
-o-border-radius:5px;
border-radius:5px;
font-size:14px;
}
.email_sub_btn:hover{
background:#017bd3;
}
.email_prompt_p{
font-size:14px;
color:#000;
margin-bottom:10px;
}
.email_prompt_txt{ width:480px;}
.email_prompt_txt li{
margin-left:15px;
list-style-type: disc;
color:#777;
line-height:1.9;
font-size:14px;
}
.email_prompt_mes{
border:1px solid #ccc;
-webkit-border-radius:5px;
-moz-border-radius:5px;
-o-border-radius:5px;
border-radius:5px;
width:468px;
height:60px;
background:#fff;
padding:5px;
margin-bottom: 5px;
}
.email_tanbox{
border:2px solid #3a95d7;
background:#fff;
width:480px;
}
.email_tancon{
width:420px;
margin:0 auto;
text-align:center;
padding:20px 30px;
background:#fff;
}
.email_tan_title{
font-size:18px;
color:#3a95d7;
font-weight:normal;
margin-bottom:5px;
}
.email_tan_p{
font-size:14px;
color:#4c4c4c;
}
.email_verify_p{
font-size:14px;
color:#3a95d7;
}
/***** Ajax indicator ******/
/*-------resendmail---------*/
#ajax-indicator {
position: absolute; /* fixed not supported by IE */
background-color:#eee;
border: 1px solid #bbb;
top:35%;
left:40%;
width:20%;
font-weight:bold;
text-align:center;
padding:0.6em;
z-index:100000;
opacity: 0.5;
}
html>body #ajax-indicator { position: fixed; }
#ajax-indicator span {
background-position: 0% 40%;
background-repeat: no-repeat;
background-image: url(../images/loading.gif);
padding-left: 26px;
vertical-align: bottom;
}
div.modal {
border-radius: 5px;
background: #fff;
z-index: 50;
padding: 4px;
}
.ui-widget-content {
border: 1px solid #ddd;
color: #333;
}
.ui-widget {
font-family: Verdana, sans-serif;
font-size: 1.1em;
}
.ui-dialog .ui-dialog-content {
position: relative;
border: 0;
padding: .5em 1em;
background: none;
overflow: auto;
zoom: 1;
}
.ui-widget-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.ui-widget-overlay {
background: #666 url(http://forge.trustie.net/stylesheets/jquery/images/xui-bg_diagonals-thick_20_666666_40x40.png.pagespeed.ic.9mfuw_R0z1.png) 50% 50% repeat;
opacity: .5;
filter: Alpha(Opacity=50);
}
.resourceUploadPopup {width:400px; height:auto; border:3px solid #269ac9 !important; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-200px; z-index:1000;}
a.Blue-btn{ display:block; margin-right:15px;width:65px; height:22px; background-color:#ffffff; line-height:24px; vertical-align:middle; text-align:center; border:1px solid #3598db; color:#3598db; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;}
a:hover.Blue-btn{ background:#3598db; color:#fff;}
/***** end Ajax indicator ******/