修正了我的账户下弹出密码错误的bug;修正了普通用户修改资料的跳转路径

This commit is contained in:
nieguanghui 2013-08-13 11:14:25 +08:00
parent 48442e95f5
commit ca08efa7e5
3 changed files with 3 additions and 20 deletions

View File

@ -50,28 +50,12 @@ 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] : [])

View File

@ -40,7 +40,7 @@
<td align="center"> <% unless User.current == @user %>
<%= watcher_link(@user, User.current) %>
<% else %>
<%= link_to(l(:label_user_edit), edit_user_path(@user)) if User.current %><% end %></td>
<%= link_to(l(:label_user_edit), my_account_path(@user)) if User.current %><% end %></td>
</tr>
</table></td>
</tr>

View File

@ -73,5 +73,4 @@
<%= submit_tag l(:button_save) %>
</fieldset>
<% end %>
<%= error_messages_for 'user' %>
<% html_title(l(:label_my_account)) -%>