From 39c9874a41028c7ec5f67207d698947c751d9484 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Wed, 29 Aug 2007 20:07:28 +0000 Subject: 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 --- app/controllers/my_controller.rb | 16 ++++++++++++---- app/views/my/account.rhtml | 9 +++++++-- 2 files changed, 19 insertions(+), 6 deletions(-) (limited to 'app') diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index 1c5a039ea..11aa7f1d0 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -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 diff --git a/app/views/my/account.rhtml b/app/views/my/account.rhtml index 24f0ef551..c884de841 100644 --- a/app/views/my/account.rhtml +++ b/app/views/my/account.rhtml @@ -1,7 +1,12 @@

<%=l(:label_my_account)%>

-

<%=l(:field_login)%>: <%= @user.login %>
-<%=l(:field_created_on)%>: <%= format_time(@user.created_on) %>

+

<%=l(:field_login)%>: <%= @user.login %> +
<%=l(:field_created_on)%>: <%= format_time(@user.created_on) %> +<% if @user.rss_token %> +
<%= 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 %> +

<%= error_messages_for 'user' %> -- cgit v1.2.3