[horde] Allow only login without OR WITH @domain

A. Schulze sca at andreasschulze.de
Thu Jul 17 20:04:28 UTC 2014


Andre Luiz Paiz:

> The problem is that users alternate from time to time, so that creates 2
> profile settings for all users. Ex: me at domain and me.
> How can I prevent that?

I implemented a hook in the other direction. (OK, I have only one domain)
Users could now login using "username" or "email at example.org"
"username" is always rewritten to "email at example.org"

Reason for me: dovecot shares work better if users login using mailadresses.

horde/config/hooks.local.php
<?php
class Horde_Hooks
{
     public function preauthenticate($userId, $credentials) {
         if ($userId && (false === strpos($userId, '@'))) {

             // do the convertion of a plain userID into a email-address here
             $var_with_new_login_id = your_voddoo($userId)

             // log the change
             Horde::logMessage('converted "' . $userId . '" into "' .  
$var_with_new_login_id . '"', 'INFO');

             return array(
                 'userId' => $var_with_new_login_id,
                 'credentials' => $credentials
             );
         }
         // Authentication will continue with no alteration of the  
user ID/credentials.
         return true;
     }
}

@Horde-Developers:

I would like to tell the user about the conversion. Therefore I added
$GLOBALS['notification']->push(...) next to Horde::logMessage.
But that does not work. Is there an other option to push a message to  
the user?

Andreas




More information about the horde mailing list