diff options
Diffstat (limited to 'app/controllers/application.rb')
-rw-r--r-- | app/controllers/application.rb | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/app/controllers/application.rb b/app/controllers/application.rb index c06e69915..a230262cd 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.8 2007-10-03 17:13:50 francis Exp $ +# $Id: application.rb,v 1.9 2007-10-03 20:01:45 louise Exp $ class ApplicationController < ActionController::Base @@ -20,29 +20,29 @@ class ApplicationController < ActionController::Base def signin if not params[:user] # First time page is shown - render :template => 'user_accounts/signin' + render :template => 'user_accounts/signin' and return elsif params[:returning] == "0" # "I am new to FOIFA" session[:email] = params[:user][:email] - redirect_to :action => 'signup' + redirect_to :action => 'signup' and return elsif params[:returning] == "1" # "I am returning to FOIFA and my password is" @user = User.authenticate(params[:user][:email], params[:user][:password]) if @user # Successful login session[:user] = @user.id - redirect_to :action => session[:intended_action], :controller => session[:intended_controller], :post_redirect => 1 + redirect_to :action => session[:intended_action], :controller => session[:intended_controller], :post_redirect => 1 and return else # Failed to authenticate flash[:error] = "Email or password not correct, please try again" end @user = User.new(params[:user]) - render :template => 'user_accounts/signin' + render :template => 'user_accounts/signin' and return else # Form submitted, but didn't specify whether had already used FOIFA or not flash[:error] = "Please say whether you already have a FOIFA account or not" @user = User.new(params[:user]) - render :template => 'user_accounts/signin' + render :template => 'user_accounts/signin' and return end end @@ -64,7 +64,7 @@ class ApplicationController < ActionController::Base # Logout form def signout - sessions[:user] = nil + session[:user] = nil redirect_to frontpage end @@ -85,12 +85,11 @@ class ApplicationController < ActionController::Base # For redirects to POST requests before_filter :post_redirect def post_redirect - #raise session[:intended_params].to_yaml if params[:post_redirect] -# XXX this is the bit where I want to set params for the controller from the session -# CGI::QueryExtension.params = session[:intended_params] + params.update(session[:intended_params]) end end + # For administration interface, return display name of authenticated user def admin_http_auth_user |