修正了“我的账户”下修改密码的显示问题

exceptionHandle
zhangyang 12 years ago
parent be4dc216a9
commit 3d5b95cb7a

@ -50,10 +50,28 @@ class MyController < ApplicationController
def account
@user = User.current
@pref = @user.pref
#Modified by young
unless @user.change_password_allowed?
flash[:error] = l(:notice_can_t_change_password)
redirect_to my_account_path
return
end
#Ended by young
if request.post?
@user.safe_attributes = params[:user]
@user.pref.attributes = params[:pref]
@user.pref[:no_self_notified] = (params[:no_self_notified] == '1')
#Added by young
if @user.check_password?(params[:password])
@user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
if @user.save
flash[:notice] = l(:notice_account_password_updated)
# redirect_to my_account_path
end
else
flash[:error] = l(:notice_account_wrong_password)
end
#Ended by young
if @user.save
@user.pref.save
@user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : [])

@ -1,5 +1,4 @@
<div class="contextual" style="padding-right: 10px;">
<%= link_to(l(:button_change_password), {:action => 'password'}, :class => 'icon icon-passwd') if @user.change_password_allowed? %>
<%= call_hook(:view_my_account_contextual, :user => @user)%>
</div>
@ -52,8 +51,20 @@
<% end %>
<%= call_hook(:view_my_account, :user => @user, :form => f) %>
</fieldset>
<!--Added by young-->
<fieldset class="collapsible collapsed" style="width:800px;margin-left: 10px;">
<legend><%=l(:label_authentication)%></legend>
<p style="width:400px;padding-left: 26px;"><label for="password"><%=l(:field_password)%> <span class="required">*</span></label>
<%= password_field_tag 'password', nil, :size => 25 %></p>
<p style="width:400px;padding-left: 13px;"><label for="new_password"><%=l(:field_new_password)%> <span class="required">*</span></label>
<%= password_field_tag 'new_password', nil, :size => 25 %>
<em class="info" style="width:400px;padding-left: 52px;"><%= l(:text_caracters_minimum, :count => Setting.password_min_length) %></em></p>
<p style="width:400px;padding-left: 26px;"><label for="new_password_confirmation"><%=l(:field_password_confirmation)%> <span class="required">*</span></label>
<%= password_field_tag 'new_password_confirmation', nil, :size => 25 %></p>
</fieldset>
<!--Ended by young-->
<fieldset class="collapsible collapsed" style="width:800px;margin-left: 10px;">
<legend onclick="toggleFieldset(this);">
<%= l(:field_mail_notification)%>

Loading…
Cancel
Save