Index: shib_auth.module =================================================================== --- shib_auth.module (revision 2013) +++ shib_auth.module (working copy) @@ -178,9 +178,14 @@ } //We want to show the custom mail input form, and then redirect the user to the node, he wanted to go else { - $_SESSION['redirected_to_custom_mail_form'] = TRUE; - $_SESSION['redirected_to_custom_mail_form_url'] = $_GET['q']; - drupal_goto('shib_auth/get_custom_mail'); + if (!isset($_SESSION['redirected_to_custom_mail_form_url'])) { + $_SESSION['redirected_to_custom_mail_form'] = TRUE; + // we can skip shib_login at this point. + $_SESSION['redirected_to_custom_mail_form_url'] = trim(preg_replace('#^[/]*shib_login[/]*#', '', $_GET['q']),'/'); + } + if ($_GET['q'] != 'shib_auth/get_custom_mail') { + drupal_goto('shib_auth/get_custom_mail'); + } } }