X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=plugins%2Fnew_user_identity%2Fnew_user_identity.php;h=45750facd46d9ddf5d0a14efbc0df700c6cfa323;hb=07e1de2dcd3f3ff8910a3680493f035b3c693cf0;hp=78c99522d9700f4b4d184e2e64b780864af9a063;hpb=e8a0682b96f5b7f297e58d101735ba20a0cc3a89;p=roundcube.git diff --git a/plugins/new_user_identity/new_user_identity.php b/plugins/new_user_identity/new_user_identity.php index 78c9952..45750fa 100644 --- a/plugins/new_user_identity/new_user_identity.php +++ b/plugins/new_user_identity/new_user_identity.php @@ -22,9 +22,11 @@ */ 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;