diff options
author | francis <francis> | 2009-08-19 23:20:39 +0000 |
---|---|---|
committer | francis <francis> | 2009-08-19 23:20:39 +0000 |
commit | 9bd4eff10b74ebd0a8f40e67c1b74e36654fa454 (patch) | |
tree | cc3a013f38d7ce1f6615222afe0f3112f4e6b776 /app | |
parent | 9242f214beca2f4f3adaec869d2ecf2471747a60 (diff) |
Set cookie if it isn't set by sign in page.
Improve text when cookies not working.
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/user_controller.rb | 13 | ||||
-rw-r--r-- | app/views/user/no_cookies.rhtml | 19 |
2 files changed, 25 insertions, 7 deletions
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index cf1eb1d2c..1c0bef5b9 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.67 2009-08-05 16:31:10 francis Exp $ +# $Id: user_controller.rb,v 1.68 2009-08-19 23:20:39 francis Exp $ class UserController < ApplicationController # Show page about a user @@ -58,12 +58,23 @@ class UserController < ApplicationController def signin work_out_post_redirect + # make sure we have cookies if session.instance_variable_get(:@dbman) if not session.instance_variable_get(:@dbman).instance_variable_get(:@original) + # try and set them if we don't + if !params[:again] + redirect_to signin_url(:r => params[:r], :again => 1) + return + end render :action => 'no_cookies' return end end + # remove "cookie setting attempt has happened" parameter if there is one and cookies worked + if params[:again] + redirect_to signin_url(:r => params[:r], :again => nil) + return + end if not params[:user_signin] # First time page is shown diff --git a/app/views/user/no_cookies.rhtml b/app/views/user/no_cookies.rhtml index 65dd43f6d..4681547d3 100644 --- a/app/views/user/no_cookies.rhtml +++ b/app/views/user/no_cookies.rhtml @@ -2,11 +2,18 @@ <h1>Please enable "cookies" to carry on</h1> -<p>To carry on, you need to sign in or make an account. Unfortunately, -this can't be done because of a problem with your browser settings.</p> +<p>To carry on, you need to sign in or make an account. Unfortunately, there +was a technical problem trying to do this.</p> -<p>Either your browser does not support a thing called "cookies", or you have -disabled them. Please enable cookies, or try a different browser, and try again -(press refresh twice after enabling them).</p> +<p>It may be that your browser is not set to accept a thing called "cookies", +or cannot do so. If you can, please enable cookies, or try using a different +browser. Then press refresh to have another go.</p> + +<p>If your browser is set to accept cookies and you are seeing this message, +then there is probably a fault with our server. Please <a href="/help/contact">get in touch</a> +with us so we can fix it. Let us know what you were doing when this message +appeared and your browser and operating system type and version.</p> + +<p>If you are still having trouble, please <a href="/help/contact">contact us</a>. +</p> -<p>If you are still having trouble then <a href="/help/contact">contact us</a>.</p> |