diff options
author | francis <francis> | 2008-03-21 15:02:55 +0000 |
---|---|---|
committer | francis <francis> | 2008-03-21 15:02:55 +0000 |
commit | 910299dc932f9b32dc29cc35631afe62566e9cbb (patch) | |
tree | 7056d0d12f5cfb2adcfd54e04d37f2f1e13327be | |
parent | f84c8015be05b3c48a6f232fc5026f656237560f (diff) |
Rename template to better name.
Link to password change page on your user page if you are logged in as yourself.
-rw-r--r-- | app/controllers/user_controller.rb | 8 | ||||
-rw-r--r-- | app/views/user/show.rhtml | 17 | ||||
-rw-r--r-- | app/views/user/signchange_send_confirm.rhtml (renamed from app/views/user/signchange_email.rhtml) | 0 |
3 files changed, 17 insertions, 8 deletions
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 72651305f..ec9f8b71a 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -4,7 +4,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: user_controller.rb,v 1.42 2008-03-21 14:50:04 francis Exp $ +# $Id: user_controller.rb,v 1.43 2008-03-21 15:02:55 francis Exp $ class UserController < ApplicationController # Show page about a set of users with same url name @@ -19,6 +19,8 @@ class UserController < ApplicationController raise "user not found" end @same_name_users = User.find(:all, :conditions => [ "name = ? and email_confirmed and id <> ?", @display_user.name, @display_user.id ], :order => "created_at") + + @is_you = !@user.nil? && @user.id == @display_user.id end # Login form @@ -117,7 +119,7 @@ class UserController < ApplicationController # They've entered the email, check it is OK and user exists if not MySociety::Validate.is_valid_email(params[:signchange][:email]) flash[:error] = "That doesn't look like a valid email address. Please check you have typed it correctly." - render :action => 'signchange_email' + render :action => 'signchange_send_confirm' return end user_signchange = User.find_user_by_email(params[:signchange][:email]) @@ -146,7 +148,7 @@ class UserController < ApplicationController render :action => 'signchange_confirm' elsif not @user # Not logged in, prompt for email - render :action => 'signchange_email' + render :action => 'signchange_send_confirm' else # Logged in via special email change password link, so can offer form to change password raise "internal error" unless (session[:user_circumstance] == "change_password") diff --git a/app/views/user/show.rhtml b/app/views/user/show.rhtml index d4c4b06f7..6e14fd175 100644 --- a/app/views/user/show.rhtml +++ b/app/views/user/show.rhtml @@ -1,4 +1,4 @@ -<% @title = h(@display_user.name) %> +<% @title = h(@display_user.name) + (@is_you ? " (you)" : "") %> <% if (@same_name_users.size >= 1) %> <p>This is <strong>one person</strong> who uses this site and has this name, you may @@ -12,17 +12,24 @@ <h1><%=@title%></h1> <p class="subtitle">Joined WhatDoTheyKnow on <%= simple_date(@display_user.created_at) %></p> - <p><%= link_to "Send message to " + h(@display_user.name), contact_user_url(:id => @display_user.id) %></p> + <p> + <%= link_to "Send message to " + h(@display_user.name), contact_user_url(:id => @display_user.id) %> + <% if @is_you %> + (just to see how it works) + <br><%= link_to "Change your password", signchange_url + "?pretoken=" + h(params[:token]) %> + <% else %> + <% end %> + </p> <% if @display_user.info_requests.empty? %> - <h2>Freedom of Information requests made by this person</h2> - <p><%= @display_user == @user ? 'You have' : 'This person has' %> + <h2>Freedom of Information requests made by <%= @is_you ? 'you' : 'this person' %></h2> + <p><%= @is_you ? 'You have' : 'This person has' %> made no Freedom of Information requests using this site.</p> <% else %> <h2> <%=pluralize(@display_user.info_requests.size, "Freedom of Information request") %> - made by this person + made by <%= @is_you ? 'you' : 'this person' %> </h2> <%= render :partial => 'request/request_listing', :locals => { :info_requests => @display_user.info_requests.sort { |a,b| b.created_at <=> a.created_at } } %> diff --git a/app/views/user/signchange_email.rhtml b/app/views/user/signchange_send_confirm.rhtml index e1462760c..e1462760c 100644 --- a/app/views/user/signchange_email.rhtml +++ b/app/views/user/signchange_send_confirm.rhtml |