diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-04-27 12:27:59 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-04-27 12:27:59 +0000 |
| commit | 5cc93795e62ac3d89a80c18d997b73c455b501f0 (patch) | |
| tree | 74346a9c3ddc3a352483e44c2a039b4ed84aa731 /plugins/password/drivers/hmail.php | |
| parent | b4d58291cda5630d5b3e3ddf11d21ee4b300bdd4 (diff) | |
- cleanup + some improvements in hmail driver
git-svn-id: https://svn.roundcube.net/trunk@3568 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'plugins/password/drivers/hmail.php')
| -rw-r--r-- | plugins/password/drivers/hmail.php | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/plugins/password/drivers/hmail.php b/plugins/password/drivers/hmail.php index 11f8440e2..764b744fe 100644 --- a/plugins/password/drivers/hmail.php +++ b/plugins/password/drivers/hmail.php @@ -3,7 +3,7 @@ /** * hMailserver password driver * - * @version 1.0 + * @version 1.1 * @author Roland 'rosali' Liebl <myroundcube@mail4us.net> * */ @@ -12,26 +12,33 @@ function password_save($curpass, $passwd) { $rcmail = rcmail::get_instance(); + if($curpass == '' || $passwd == '') + return PASSWORD_ERROR; + try { - $obApp = new COM("hMailServer.Application"); + $obApp = new COM('hMailServer.Application'); } catch (Exception $e) { - write_log('errors', 'Plugin password:' . $e->getMessage() . '. This problem is often caused by DCOM permissions not being set.'); + write_log('errors', "Plugin password (hmail driver):" . $e->getMessage() . ". 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); - $obDomain = $obApp->Domains->ItemByName($domain); - $obAccount = $obDomain->Accounts->ItemByAddress($username); - $obAccount->Password = $passwd; - $obAccount->Save(); - - return PASSWORD_SUCCESS; + try { + $obDomain = $obApp->Domains->ItemByName($domain); + $obAccount = $obDomain->Accounts->ItemByAddress($username); + $obAccount->Password = $passwd; + $obAccount->Save(); + return PASSWORD_SUCCESS; + } + catch(Exception $e) { + write_log('errors', "Plugin password (hmail driver):" . $e->getMessage()); + return PASSWORD_ERROR; + } } ?> |
