当前位置: 首页>>代码示例>>PHP>>正文


PHP COM::Authenticate方法代码示例

本文整理汇总了PHP中COM::Authenticate方法的典型用法代码示例。如果您正苦于以下问题:PHP COM::Authenticate方法的具体用法?PHP COM::Authenticate怎么用?PHP COM::Authenticate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在COM的用法示例。


在下文中一共展示了COM::Authenticate方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ChangePassword

 /**
  * @param \RainLoop\Model\Account $oHmailAccount
  * @param string $sPrevPassword
  * @param string $sNewPassword
  *
  * @return bool
  */
 public function ChangePassword(\RainLoop\Account $oHmailAccount, $sPrevPassword, $sNewPassword)
 {
     if ($this->oLogger) {
         $this->oLogger->Write('Try to change password for ' . $oHmailAccount->Email());
     }
     $bResult = false;
     try {
         $oHmailApp = new COM("hMailServer.Application");
         $oHmailApp->Connect();
         if ($oHmailApp->Authenticate($this->sLogin, $this->sPassword)) {
             $sEmail = $oHmailAccount->Email();
             $sDomain = \MailSo\Base\Utils::GetDomainFromEmail($sEmail);
             $oHmailDomain = $oHmailApp->Domains->ItemByName($sDomain);
             if ($oHmailDomain) {
                 $oHmailAccount = $oHmailDomain->Accounts->ItemByAddress($sEmail);
                 if ($oHmailAccount) {
                     $oHmailAccount->Password = $sNewPassword;
                     $oHmailAccount->Save();
                     $bResult = true;
                 } else {
                     $this->oLogger->Write('HMAILSERVER: Unknown account (' . $sEmail . ')', \MailSo\Log\Enumerations\Type::ERROR);
                 }
             } else {
                 $this->oLogger->Write('HMAILSERVER: Unknown domain (' . $sDomain . ')', \MailSo\Log\Enumerations\Type::ERROR);
             }
         } else {
             $this->oLogger->Write('HMAILSERVER: Auth error', \MailSo\Log\Enumerations\Type::ERROR);
         }
     } catch (\Exception $oException) {
         if ($this->oLogger) {
             $this->oLogger->WriteException($oException);
         }
     }
     return $bResult;
 }
开发者ID:helsaba,项目名称:rainloop-webmail,代码行数:42,代码来源:HmailserverChangePasswordDriver.php

示例2: save

 public function save($curpass, $passwd)
 {
     $rcmail = rcmail::get_instance();
     if ($curpass == '' || $passwd == '') {
         return PASSWORD_ERROR;
     }
     try {
         $remote = $rcmail->config->get('hmailserver_remote_dcom', false);
         if ($remote) {
             $obApp = new COM("hMailServer.Application", $rcmail->config->get('hmailserver_server'));
         } else {
             $obApp = new COM("hMailServer.Application");
         }
     } 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;
     }
     $username = $rcmail->user->data['username'];
     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);
         $obAccount->Password = $passwd;
         $obAccount->Save();
         return PASSWORD_SUCCESS;
     } 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;
     }
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:44,代码来源:hmail.php

示例3: password_save

/**
 * hMailserver password driver
 *
 * @version 1.0
 * @author Roland 'rosali' Liebl <myroundcube@mail4us.net>
 *
 */
function password_save($curpass, $passwd)
{
    $rcmail = rcmail::get_instance();
    try {
        $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.');
        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;
}
开发者ID:DavidGarciaCat,项目名称:eyeos,代码行数:26,代码来源:hmail.php

示例4: getHmsComServer

 function getHmsComServer($user)
 {
     $conf = $this->rc->config->get('hmailserver_server_for_hmsrc');
     $obBaseApp = new COM("hMailServer.Application", NULL, CP_UTF8);
     $obBaseApp->Connect();
     $obBaseApp->Authenticate($conf['Username'], $conf['Password']);
     $obDomain = $obBaseApp->Domains->ItemByName(substr($user, strpos($user, "@") + 1));
     return $obDomain->Accounts->ItemByAddress($user);
 }
开发者ID:hazarkarabay,项目名称:hmsfromrc,代码行数:9,代码来源:hmsfromrc.php

示例5: user_delete_backend

function user_delete_backend($props, $authenticate)
{
    if (class_exists('COM')) {
        $username = strtolower(trim($props['username']));
        $domain = explode('@', $username);
        $domain = strtolower($domain[1]);
        $p = user_get_backend(array('arg' => $username), $authenticate);
        if (!$p['abort']) {
            try {
                $obApp = new COM('hMailServer.Application');
                $obApp->Authenticate($authenticate['admin'], $authenticate['password']);
                $obDomain = $obApp->Domains->ItemByName($domain);
                $obAccount = $obDomain->Accounts->ItemByAddress($username);
                $obDomain->Accounts->DeleteByDBID($obAccount->ID);
                $p = user_get_backend(array('arg' => $username), $authenticate);
                if ($p['abort']) {
                    $props = array('abort' => false);
                } else {
                    $props = array('abort' => true, 'message' => array('type' => 'error', 'label' => 'errorsaving'));
                }
            } catch (Exception $e) {
                $props = array('abort' => true, 'message' => array('type' => 'error', 'label' => 'errorsaving'));
            }
        } else {
            $props = array('abort' => true, 'message' => array('type' => 'error', 'label' => 'companyaddressbook.usernotfound'));
        }
    } else {
        $props = array('abort' => true, 'message' => array('type' => 'error', 'label' => 'companyaddressbook.COMerror'));
    }
    return $props;
}
开发者ID:MetallianFR68,项目名称:myroundcube,代码行数:31,代码来源:driver.php

示例6: GetSystemOption

 #Get the hmail domain id for the users mailbox
 $hmaildatabase = GetSystemOption('hmailserver_db');
 $sql = "SELECT accountdomainid FROM hm_accounts WHERE accountid='" . $faaccountid . "'";
 $listaccountdomainid = DataExchange("r", $hmaildatabase, $sql);
 $rowaccountdomainid = mysql_fetch_assoc($listaccountdomainid);
 $faadomainid = $rowaccountdomainid['accountdomainid'];
 #we try to connect to the hmailserver
 $obBaseApp = new COM("hMailServer.Application");
 if (!$obBaseApp) {
     header("location: " . GetNormalModuleURL($returnurl) . "&r=hmcomerror");
     exit;
 }
 #connection established, now we authenticate
 $obBaseApp->Connect();
 // Authenticate the user
 $obBaseApp->Authenticate($Usermailbox, $ExMessageAuth);
 if (!$obBaseApp->Authenticate($Usermailbox, $ExMessageAuth)) {
     header("location: " . GetNormalModuleURL($returnurl) . "&r=hmautherror&mb=" . $Usermailbox . "");
     exit;
 }
 #we have authenticated, and all our variables set up so lets move on...
 $domainid = $faadomainid;
 $accountid = $faaccountid;
 $obDomain = $obBaseApp->Domains->ItemByDBID($domainid);
 $obAccount = $obDomain->Accounts->ItemByDBID($accountid);
 $obFetchAccounts = $obAccount->FetchAccounts();
 $obFA = $obFetchAccounts->Add();
 $obFA->Enabled = '1';
 $obFA->Name = $ExMessageAccount;
 $obFA->MinutesBetweenFetch = $ExMessagecheck;
 $obFA->Port = $ExMessagePort;
开发者ID:shishenkov,项目名称:zpanel,代码行数:31,代码来源:obj_mail.php

示例7: rawurldecode

require_once 'config.php';
//initialize php variables used in the form
$username = "";
$password = "";
$password_confirm = "";
$error = "";
//check to see that the form has been submitted
if (isset($_POST)) {
    //retrieve the $_POST variables
    $username = rawurldecode($_POST['username']);
    $password = rawurldecode($_POST['password']);
    $password_confirm = rawurldecode($_POST['password_confirm']);
    if (!$CONF['dev_env']) {
        $obBaseApp = new COM("hMailServer.Application");
        $obBaseApp->Connect();
        $obBaseApp->Authenticate($CONF['mail_admin_user'], $CONF['mail_admin_pass']);
        $domain = $obBaseApp->Domains->ItemByName($CONF['host']);
    }
    //initialize variables for form validation
    $success = true;
    if ($success && safe_register($username) != $username) {
        $error = "Invalid Characters in username.";
        $success = false;
    }
    $username = safe_register($username);
    if ($success && !$username) {
        $error = "You must input a Username.";
        $success = false;
    }
    //validate that the form was filled out correctly
    //check to see if user name already exists
开发者ID:KingNoosh,项目名称:Teknik,代码行数:31,代码来源:process_registration.php

示例8: COM

require_once "include/functions.php";
require_once "include_versioncheck.php";
session_start();
// Connect to hMailServer
try {
    $obBaseApp = new COM("hMailServer.Application");
} catch (Exception $e) {
    echo $e->getMessage();
    echo "<br>";
    echo "This problem is often caused by DCOM permissions not being set.";
    die;
}
if ($obBaseApp->Version != REQUIRED_VERSION) {
    echo "<br>";
    echo "The hMailServer version does not match the WebAdmin version.<br>";
    echo "hMailServer version: " . $obBaseApp->Version . "<br>";
    echo "WebAdmin version: " . REQUIRED_VERSION . "<br>";
    echo "Please make sure you are using the PHPWebAdmin version which came with your hMailServer installation.<br>";
    die;
}
try {
    $obBaseApp->Connect();
    if (isset($_SESSION['session_username']) && isset($_SESSION['session_password'])) {
        // Authenticate the user
        $obBaseApp->Authenticate($_SESSION['session_username'], $_SESSION['session_password']);
    }
} catch (Exception $e) {
    echo $e->getMessage();
    die;
}
$obLanguage = $obBaseApp->GlobalObjects->Languages->ItemByName($hmail_config['defaultlanguage']);
开发者ID:nberardi,项目名称:hMailServer,代码行数:31,代码来源:initialize.php


注:本文中的COM::Authenticate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。