Redirect after signOut

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
bdurfee
Veteran Member
Posts: 32
Joined: 2013-02-07 17:44

Redirect after signOut

Post by bdurfee » 2019-12-07 01:40

Using the global hooks file, we can redirect after signIn just by returning a URL.

Is there a way to redirect after signOut?

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Redirect after signOut

Post by onoehring » 2019-12-11 16:04

Hi bdurfee,

actually, this should be easy.
Look at /index.php and look for the line

Code: Select all

if(isset($_GET['signOut']))
Here you should be able to do your stuff.

My index.php looks like this now ... see the include line. There I handle some logging once the user logges out - so you could simply use a php header to redirect the user to somewhere else.

Code: Select all

<?php
	$currDir = dirname(__FILE__);
	define('HOMEPAGE', true);
	include("{$currDir}/defaultLang.php");
	include("{$currDir}/language.php");
	include("{$currDir}/lib.php");

	$x = new DataList;
	$x->TableTitle = $Translation['homepage'];

	// according to provided GET parameters, either log out, show login form (possibly with a failed login message), or show homepage
	if(isset($_GET['signOut'])) {

include("{$currDir}/hooks/loguserout.php");

		logOutUser();
		redirect("index.php?signIn=1");
	} elseif(isset($_GET['loginFailed']) || isset($_GET['signIn'])) {
		if(isset($_GET['loginFailed'])) @header('HTTP/1.0 403 Forbidden');
		include("{$currDir}/login.php");
	} else {
		include("{$currDir}/home.php");
	}
Olaf

Post Reply