summaryrefslogtreecommitdiff
path: root/plugins/password/drivers/hmail.php
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/password/drivers/hmail.php')
-rw-r--r--plugins/password/drivers/hmail.php30
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;
}
}