From 2baa16ae6d8355e0dfb38e400fd4115057b0680d Mon Sep 17 00:00:00 2001 From: thomascube Date: Wed, 29 Sep 2010 10:00:48 +0000 Subject: Copy plugins into 0.4.1 release branch --- plugins/password/drivers/hmail.php | 44 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 plugins/password/drivers/hmail.php (limited to 'plugins/password/drivers/hmail.php') diff --git a/plugins/password/drivers/hmail.php b/plugins/password/drivers/hmail.php new file mode 100644 index 000000000..764b744fe --- /dev/null +++ b/plugins/password/drivers/hmail.php @@ -0,0 +1,44 @@ + + * + */ + +function password_save($curpass, $passwd) +{ + $rcmail = rcmail::get_instance(); + + if($curpass == '' || $passwd == '') + return PASSWORD_ERROR; + + try { + $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."); + return PASSWORD_ERROR; + } + + $username = $rcmail->user->data['username']; + $temparr = explode('@', $username); + $domain = $temparr[1]; + $obApp->Authenticate($username, $curpass); + + 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; + } +} + +?> -- cgit v1.2.3