diff options
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/application_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/request_controller.rb | 18 | ||||
-rw-r--r-- | app/controllers/user_controller.rb | 9 |
3 files changed, 18 insertions, 13 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 5f18be2e5..4e6ad5efb 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -192,7 +192,9 @@ class ApplicationController < ActionController::Base post_redirect = PostRedirect.new(:uri => request.request_uri, :post_params => params, :reason_params => reason_params) post_redirect.save! - redirect_to signin_url(:token => post_redirect.token) + # 'modal' controls whether the sign-in form will be displayed in the typical full-blown + # page or on its own, useful for pop-ups + redirect_to signin_url(:token => post_redirect.token, :modal => params[:modal]) return false end return true diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index d39b78f36..88fb9be6c 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -276,6 +276,15 @@ class RequestController < ApplicationController return end + if !authenticated?( + :web => _("To send your FOI request"), + :email => _("Then your FOI request to {{public_body_name}} will be sent.",:public_body_name=>@info_request.public_body.name), + :email_subject => _("Confirm your FOI request to ") + @info_request.public_body.name + ) + # do nothing - as "authenticated?" has done the redirect to signin page for us + return + end + # Show preview page, if it is a preview if params[:preview].to_i == 1 message = "" @@ -298,15 +307,6 @@ class RequestController < ApplicationController return end - if !authenticated?( - :web => _("To send your FOI request"), - :email => _("Then your FOI request to {{public_body_name}} will be sent.",:public_body_name=>@info_request.public_body.name), - :email_subject => _("Confirm your FOI request to ") + @info_request.public_body.name - ) - # do nothing - as "authenticated?" has done the redirect to signin page for us - return - end - @info_request.user = authenticated_user # This automatically saves dependent objects, such as @outgoing_message, in the same transaction @info_request.save! diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 3dcdf973b..3e3913fae 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -109,7 +109,7 @@ class UserController < ApplicationController session[:user_circumstance] = nil session[:remember_me] = params[:remember_me] ? true : false - if @is_modal_dialog + if is_modal_dialog render :action => 'signin_successful' else do_post_redirect @post_redirect @@ -507,10 +507,13 @@ class UserController < ApplicationController private + def is_modal_dialog + (params[:modal].to_i != 0) + end + # when logging in through a modal iframe, don't display chrome around the content def select_layout - @is_modal_dialog = (params[:modal].to_i != 0) - @is_modal_dialog ? 'no_chrome' : 'default' + is_modal_dialog ? 'no_chrome' : 'default' end # Decide where we are going to redirect back to after signin/signup, and record that |