Added the ability to reset its own RSS access key on "My account".

git-svn-id: http://redmine.rubyforge.org/svn/trunk@677 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2007-08-29 20:07:28 +00:00
parent 317b460d96
commit 39c9874a41
14 changed files with 66 additions and 17 deletions
+12 -4
View File
@@ -52,10 +52,9 @@ class MyController < ApplicationController
@pref = @user.pref
@user.attributes = params[:user]
@user.pref.attributes = params[:pref]
if request.post? and @user.save and @user.pref.save
set_localization
flash.now[:notice] = l(:notice_account_updated)
self.logged_in_user.reload
if request.post? && @user.save && @user.pref.save
flash[:notice] = l(:notice_account_updated)
redirect_to :action => 'account'
end
end
@@ -76,6 +75,15 @@ class MyController < ApplicationController
end
redirect_to :action => 'account'
end
# Create a new feeds key
def reset_rss_key
if request.post? && User.current.rss_token
User.current.rss_token.destroy
flash[:notice] = l(:notice_feeds_access_key_reseted)
end
redirect_to :action => 'account'
end
# User's page layout configuration
def page_layout
+7 -2
View File
@@ -1,7 +1,12 @@
<h2><%=l(:label_my_account)%></h2>
<p><%=l(:field_login)%>: <strong><%= @user.login %></strong><br />
<%=l(:field_created_on)%>: <%= format_time(@user.created_on) %></p>
<p><%=l(:field_login)%>: <strong><%= @user.login %></strong>
<br /><%=l(:field_created_on)%>: <%= format_time(@user.created_on) %>
<% if @user.rss_token %>
<br /><%= l(:label_feeds_access_key_created_on, distance_of_time_in_words(Time.now, @user.rss_token.created_on)) %>
(<%= link_to l(:button_reset), {:action => 'reset_rss_key'}, :method => :post %>)
<% end %>
</p>
<%= error_messages_for 'user' %>