diff options
Diffstat (limited to 'app/controllers/user_controller.rb')
-rw-r--r-- | app/controllers/user_controller.rb | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index d3c42c7f1..7b99be393 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -72,6 +72,10 @@ class UserController < ApplicationController def signin work_out_post_redirect + # when logging in through a modal iframe, don't display chrome around the content + @is_modal_dialog = (params[:modal].to_i != 0) + layout = @is_modal_dialog ? 'no_chrome' : 'default' + # make sure we have cookies if session.instance_variable_get(:@dbman) if not session.instance_variable_get(:@dbman).instance_variable_get(:@original) @@ -80,7 +84,7 @@ class UserController < ApplicationController redirect_to signin_url(:r => params[:r], :again => 1) return end - render :action => 'no_cookies' + render :action => 'no_cookies', :layout => layout return end end @@ -92,13 +96,13 @@ class UserController < ApplicationController if not params[:user_signin] # First time page is shown - render :action => 'sign' + render :action => 'sign', :layout => layout return else @user_signin = User.authenticate_from_form(params[:user_signin], @post_redirect.reason_params[:user_name] ? true : false) if @user_signin.errors.size > 0 # Failed to authenticate - render :action => 'sign' + render :action => 'sign', :layout => layout return else # Successful login @@ -106,7 +110,12 @@ class UserController < ApplicationController session[:user_id] = @user_signin.id session[:user_circumstance] = nil session[:remember_me] = params[:remember_me] ? true : false - do_post_redirect @post_redirect + + if @is_modal_dialog + render :action => 'signin_successful', :layout => layout + else + do_post_redirect @post_redirect + end else send_confirmation_mail @user_signin end @@ -119,11 +128,15 @@ class UserController < ApplicationController def signup work_out_post_redirect + # when logging in through a modal iframe, don't display chrome around the content + @is_modal_dialog = (params[:modal].to_i != 0) + layout = @is_modal_dialog ? 'no_chrome' : 'default' + # Make the user and try to save it @user_signup = User.new(params[:user_signup]) if !@user_signup.valid? # Show the form - render :action => 'sign' + render :action => 'sign', :layout => layout else user_alreadyexists = User.find_user_by_email(params[:user_signup][:email]) if user_alreadyexists |