密码重置

This commit is contained in:
lizanle 2015-08-27 15:15:06 +08:00
parent b7daa643c8
commit 7916ca2ee3
2 changed files with 18 additions and 19 deletions

View File

@ -62,12 +62,12 @@ class AccountController < ApplicationController
if params[:token]
@token = Token.find_token("recovery", params[:token].to_s)
if @token.nil? || @token.expired?
redirect_to home_url
redirect_to signin_path
return
end
@user = @token.user
unless @user && @user.active?
redirect_to home_url
redirect_to signin_path
return
end
if request.post?

View File

@ -1,20 +1,19 @@
<h3><%=l(:label_password_lost)%></h3>
<%= error_messages_for 'user' %>
<div style="margin-top:20px;width:100%; background-color:#eaebed;">
<div style="width:1000px; background-color:#eaebed; margin:0 auto; width:968px; border:1px solid #dddddd; background:#fff; padding:15px; padding-top:10px;margin: 20px auto">
<h2 style="font-size:16px; color:#484848; width:968px;border-bottom:1px solid #e3e3e3; padding-bottom:5px;">重置密码</h2>
<div style="width:310px; margin:80px auto;">
<%= form_tag(lost_password_path) do %>
<%= hidden_field_tag 'token', @token.value %>
<!--<input type="text" class="NomalInput " value="新密码" />-->
<%= password_field_tag 'new_password', nil, :size => 25,:placeholder=>'新密码',:style=>"width:308px; height:38px; border:1px solid #98a1a6; outline:none; color:#888888; font-size:14px; " %>
<p style=" color:#F00 ;margin-bottom:5px;">至少需要 6 个字符</p>
<!--<input type="text" class="NomalInput mb20 " value="确定密码" />-->
<%= password_field_tag 'new_password_confirmation', nil, :size => 25,:placeholder=>'确定密码',:style=>"width:308px; height:38px; border:1px solid #98a1a6; outline:none; color:#888888; font-size:14px;margin-bottom:20px; " %>
<div style="width:315px; height:40px; background-color:#269ac9; font-size:14px; text-align:center; line-height:40px; vertical-align:middle;"><a href="javascript:void(0);" style=" color:#fff;display:block !important;" onclick="$(this).parent().parent().submit();">提交</a></div>
<% end %>
</div>
<%= form_tag(lost_password_path) do %>
<%= hidden_field_tag 'token', @token.value %>
<div class="box tabular">
<p>
<label for="new_password"><%=l(:field_new_password)%> <span class="required">*</span></label>
<%= password_field_tag 'new_password', nil, :size => 25 %>
<em class="info"><%= l(:text_caracters_minimum, :count => Setting.password_min_length) %></em>
</p>
<p>
<label for="new_password_confirmation"><%= l(:field_password_confirmation)%> <span class="required">*</span></label>
<%= password_field_tag 'new_password_confirmation', nil, :size => 25 %>
</p>
</div>
<p><%= submit_tag l(:button_save) %></p>
<% end %>
</div>
</div>