[horde] Need help with _username_hook_frombackend
Demi
gruessle at gmail.com
Sun May 7 12:18:33 PDT 2006
Hi
What I am trying to do is let people login with their username without
@example.com. Then I like to get the rest of the info from HTTP_HOST.
Following is what I did but what it does this:
It appends the $vdomain after login. So if someone logs in as username
it fails, if someone logs in as username at example.com he/she gets in
with
userID=username at example.com@example.com
// MY VERSION :
if (!function_exists('_username_hook_frombackend')) {
function _username_hook_frombackend($userID)
{
$vdomain = preg_split('/\./', getenv('HTTP_HOST'), -1);
$vdomain = array_reverse($vdomain);
$vdomain = $vdomain[1] . "." . $vdomain[0];
return $userID . '@' . $vdomain;
}
}
if (!function_exists('_username_hook_tobackend')) {
function _username_hook_tobackend($userID)
{
$vdomain = preg_split('/\./', getenv('HTTP_HOST'), -1);
$vdomain = array_reverse($vdomain);
$vdomain = $vdomain[1] . "." . $vdomain[0];
if (substr($userID, -strlen($vdomain)) == $vdomain) {
$userID = substr($userID, 0, -strlen($vdomain));
}
return $userID;
}
}
Demi
More information about the horde
mailing list