authenticate in custom page
Robert Marchand
robert.marchand@UMontreal.CA
Thu, 15 Nov 2001 14:42:59 -0500
Hi,
I'm porting our IMP 2.2.7 installation to IMP 3.0RC1 and I need to
open a new window
from a menu link while the user is logged to IMP. In 2.2.x this page
verify that a session
exists (based on the compose.php3 code) and show user information accordingly.
I try to do it in the same manner with version 3.0, and when I try to open
the page, it
always give me a 'Retrying login authentication after authenticate login
failed, and after that the main Window (mailbox) revert to the login page
if I click on anything.
Here is the menu link in imp/config/menu.php:
$_menu[] = array(
'url' => '/quota.php',
'text' => 'Quota-Boîte aux lettres',
'icon' => 'personal.gif',
'icon_path' => '/graphics',
'target' => '_blank',
'onclick' => ''
);
and the beginning of quota.php:
<?php
define('IMP_BASE', dirname(__FILE__));
require_once IMP_BASE . '/lib/base.php';
/* Initialize $actionID to a resonable value if it hasn't already been set. */
$actionID = Horde::getFormData('actionID', NO_ACTION);
if (!(IMP::setupSession() &&
IMP::authenticate())) {
$msg = $non_connecte;
require './quota.html';
exit;
}
Now if I add a level of redirection it works:
$_menu[] = array(
'url' => '/quotaredir.php',
'text' => 'Quota-Boîte aux lettres',
'icon' => 'personal.gif',
'icon_path' => '/graphics',
'target' => '_blank',
'onclick' => ''
);
Here is quotaredir.php:
<?php
define('IMP_BASE', dirname(__FILE__));
require_once IMP_BASE . '/lib/base.php';
if (isset($HTTP_SESSION_VARS['imp']) && is_array($HTTP_SESSION_VARS['imp'])) {
/* If there is an existing session, redirect the user to the
mailbox. */
header('Location: ' . Horde::applicationUrl('quota.php', true));
exit;
}
?>
My question: is there a simpler way (without redirection)?
Also, I'd like the window to be like the compose Window without Netscape menus.
----
On another issue, I've created an alternate login page and I wanted to have
the various
messages that show in login.php. So I've made a change to login.php (just
add '?reason=... to the url):
/* Redirect the user if an alternate login page has been specified. */
if ((in_array($reason, array('login', 'failed', 'timeout', 'logout'))) &&
$conf['user']['alternate_login']) {
header('Location: ' . $conf['user']['alternate_login'] . '?reason=' .
$reason);
exit;
}
Would it be possible to add this in the mainstream version?
Thanks.
-------
Robert Marchand tél: 343-6111 poste 5210
DGTIC-SIT e-mail: robert.marchand@umontreal.ca
Université de Montréal Montréal, Canada