diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-11-05 07:47:41 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-11-05 07:47:41 +0000 |
| commit | eaff968037c6b4462a6a134b312a162385e95dd5 (patch) | |
| tree | b59903d2df0b7e20521531db60c24826e9695adf /plugins/password/drivers/hmail.php | |
| parent | b81ff702c28592ab86f5abbb3c277e0ee899b4d5 (diff) | |
- hMail driver: add username_domain detection (#1487100)
- hMail driver: HTML tags in logged messages should be stripped off (#1487099)
git-svn-id: https://svn.roundcube.net/trunk@4183 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'plugins/password/drivers/hmail.php')
| -rw-r--r-- | plugins/password/drivers/hmail.php | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/plugins/password/drivers/hmail.php b/plugins/password/drivers/hmail.php index f7bddfd08..39a87ab34 100644 --- a/plugins/password/drivers/hmail.php +++ b/plugins/password/drivers/hmail.php @@ -3,7 +3,7 @@ /** * hMailserver password driver * - * @version 1.2 - 31.10.2010 + * @version 1.3 - 05.11.2010 * @author Roland 'rosali' Liebl <myroundcube@mail4us.net> * */ @@ -12,7 +12,7 @@ function password_save($curpass, $passwd) { $rcmail = rcmail::get_instance(); - if($curpass == '' || $passwd == '') + if ($curpass == '' || $passwd == '') return PASSWORD_ERROR; try { @@ -23,16 +23,27 @@ function password_save($curpass, $passwd) $obApp = new COM("hMailServer.Application"); } catch (Exception $e) { - write_log('errors', "Plugin password (hmail driver):" . $e->getMessage() - . ". This problem is often caused by DCOM permissions not being set."); + write_log('errors', "Plugin password (hmail driver): " . trim(strip_tags($e->getMessage()))); + write_log('errors', "Plugin password (hmail driver): This problem is often caused by DCOM permissions not being set."); return PASSWORD_ERROR; } $username = $rcmail->user->data['username']; - $temparr = explode('@', $username); - $domain = $temparr[1]; - $obApp->Authenticate($username, $curpass); + if (strstr($username,'@')){ + $temparr = explode('@', $username); + $domain = $temparr[1]; + } + else { + $domain = $rcmail->config->get('username_domain',false); + if (!$domain) { + write_log('errors','Plugin password (hmail driver): $rcmail_config[\'username_domain\'] is not defined.'); + write_log('errors','Plugin password (hmail driver): Hint: Use hmail_login plugin (http://myroundcube.googlecode.com'); + return PASSWORD_ERROR; + } + $username = $username . "@" . $domain; + } + $obApp->Authenticate($username, $curpass); try { $obDomain = $obApp->Domains->ItemByName($domain); $obAccount = $obDomain->Accounts->ItemByAddress($username); @@ -40,8 +51,9 @@ function password_save($curpass, $passwd) $obAccount->Save(); return PASSWORD_SUCCESS; } - catch(Exception $e) { - write_log('errors', "Plugin password (hmail driver):" . $e->getMessage()); + catch (Exception $e) { + write_log('errors', "Plugin password (hmail driver): " . trim(strip_tags($e->getMessage()))); + write_log('errors', "Plugin password (hmail driver): This problem is often caused by DCOM permissions not being set."); return PASSWORD_ERROR; } } |
