aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/application.rb5
-rw-r--r--app/models/post_redirect.rb12
2 files changed, 14 insertions, 3 deletions
diff --git a/app/controllers/application.rb b/app/controllers/application.rb
index c997a356d..2149c7b09 100644
--- a/app/controllers/application.rb
+++ b/app/controllers/application.rb
@@ -6,7 +6,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: application.rb,v 1.24 2007-11-19 12:36:57 francis Exp $
+# $Id: application.rb,v 1.25 2008-01-09 17:47:31 francis Exp $
class ApplicationController < ActionController::Base
@@ -40,7 +40,8 @@ class ApplicationController < ActionController::Base
else
# They are already logged in, but as the wrong user
@reason_params = reason_params
- render 'user/wrong_user'
+ render :template => 'user/wrong_user'
+ return
end
end
# They are not logged in at all
diff --git a/app/models/post_redirect.rb b/app/models/post_redirect.rb
index e7494c483..ba9d0946f 100644
--- a/app/models/post_redirect.rb
+++ b/app/models/post_redirect.rb
@@ -21,7 +21,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.9 2008-01-04 11:19:18 francis Exp $
+# $Id: post_redirect.rb,v 1.10 2008-01-09 17:47:31 francis Exp $
require 'openssl' # for random bytes function
@@ -70,6 +70,16 @@ class PostRedirect < ActiveRecord::Base
end
end
+ # Used by test code
+ def self.get_last_post_redirect
+ # XXX yeuch - no other easy way of getting the token so we can check
+ # the redirect URL, as it is by definition opaque to the controller
+ # apart from in the place that it redirects to.
+ post_redirects = PostRedirect.find_by_sql("select * from post_redirects order by id desc limit 1")
+ post_redirects.size.should == 1
+ return post_redirects[0]
+ end
+
end