]> git.donarmstrong.com Git - roundcube.git/blobdiff - plugins/new_user_identity/new_user_identity.php
Imported Upstream version 0.5.2+dfsg
[roundcube.git] / plugins / new_user_identity / new_user_identity.php
index 78c99522d9700f4b4d184e2e64b780864af9a063..45750facd46d9ddf5d0a14efbc0df700c6cfa323 100644 (file)
  */
 class new_user_identity extends rcube_plugin
 {
+    public $task = 'login';
+
     function init()
     {
-        $this->add_hook('create_user', array($this, 'lookup_user_name'));
+        $this->add_hook('user_create', array($this, 'lookup_user_name'));
     }
 
     function lookup_user_name($args)
@@ -37,6 +39,9 @@ class new_user_identity extends rcube_plugin
             $results = $ldap->search($match, $args['user'], TRUE);
             if (count($results->records) == 1) {
                 $args['user_name'] = $results->records[0]['name'];
+                if (!$args['user_email'] && strpos($results->records[0]['email'], '@')) {
+                    $args['user_email'] = rcube_idn_to_ascii($results->records[0]['email']);
+                }
             }
         }
         return $args;