aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/user_controller.rb4
-rw-r--r--app/models/post_redirect.rb7
-rw-r--r--app/views/user/bad_token.rhtml11
3 files changed, 16 insertions, 6 deletions
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index a8aa472c0..4aad19cd4 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.23 2008-01-10 18:20:35 francis Exp $
+# $Id: user_controller.rb,v 1.24 2008-02-12 11:42:09 francis Exp $
class UserController < ApplicationController
# XXX See controllers/application.rb simplify_url_part for reverse of expression in SQL below
@@ -67,7 +67,7 @@ class UserController < ApplicationController
post_redirect = PostRedirect.find_by_email_token(params[:email_token])
if post_redirect.nil?
- render 'user/bad_token'
+ render :template => 'user/bad_token.rhtml'
return
end
diff --git a/app/models/post_redirect.rb b/app/models/post_redirect.rb
index f98591c44..5227c64d0 100644
--- a/app/models/post_redirect.rb
+++ b/app/models/post_redirect.rb
@@ -25,7 +25,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: post_redirect.rb,v 1.15 2008-02-06 09:41:44 francis Exp $
+# $Id: post_redirect.rb,v 1.16 2008-02-12 11:42:09 francis Exp $
require 'openssl' # for random bytes function
@@ -84,6 +84,11 @@ class PostRedirect < ActiveRecord::Base
return post_redirects[0]
end
+ # Called from cron job delete-old-sessions
+ def self.delete_old_post_redirects
+ PostRedirect.delete_all "now() - updated_at > '1 year'"
+ end
+
end
diff --git a/app/views/user/bad_token.rhtml b/app/views/user/bad_token.rhtml
index d47a3c8bd..bfdfc1a55 100644
--- a/app/views/user/bad_token.rhtml
+++ b/app/views/user/bad_token.rhtml
@@ -4,9 +4,14 @@ correctly from your email.
</p>
<p id="bad_token">
-If you can't click on it in the email, you'll have
-to select and copy it from the email. Then paste it into your browser, into
-the place you would type the address of any other webpage.
+If you can't click on it in the email, you'll have to select and copy it from
+the email. Then paste it into your browser, into the place you would type the
+address of any other webpage.
+</p>
+
+<p id="bad_token">
+If you got the email more than a year ago, then this login link won't work any
+more. Please try doing what you were doing from the beginning.
</p>