本文整理汇总了PHP中Swift::reset方法的典型用法代码示例。如果您正苦于以下问题:PHP Swift::reset方法的具体用法?PHP Swift::reset怎么用?PHP Swift::reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Swift
的用法示例。
在下文中一共展示了Swift::reset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isAuthenticated
/**
* Try to authenticate using the username and password
* Returns false on failure
* @param string The username
* @param string The password
* @param Swift The instance of Swift this authenticator is used in
* @return boolean
*/
public function isAuthenticated($user, $pass, Swift $swift)
{
try {
//The authorization string uses ascii null as a separator (See RFC 2554)
$credentials = base64_encode($user . chr(0) . $user . chr(0) . $pass);
$swift->command("AUTH PLAIN " . $credentials, 235);
} catch (Swift_ConnectionException $e) {
$swift->reset();
return false;
}
return true;
}
示例2: isAuthenticated
/**
* Try to authenticate using the username and password
* Returns false on failure
* @param string The username
* @param string The password
* @param Swift The instance of Swift this authenticator is used in
* @return boolean
*/
public function isAuthenticated($user, $pass, Swift $swift)
{
try {
$swift->command("AUTH LOGIN", 334);
$swift->command(base64_encode($user), 334);
$swift->command(base64_encode($pass), 235);
} catch (Swift_ConnectionException $e) {
$swift->reset();
return false;
}
return true;
}
示例3: isAuthenticated
/**
* Try to authenticate using the username and password
* Returns false on failure
* @param string The username
* @param string The password
* @param Swift The instance of Swift this authenticator is used in
* @return boolean
*/
public function isAuthenticated($user, $pass, Swift $swift)
{
try {
$encoded_challenge = substr($swift->command("AUTH CRAM-MD5", 334)->getString(), 4);
$challenge = base64_decode($encoded_challenge);
$response = base64_encode($user . " " . self::generateCRAMMD5Hash($pass, $challenge));
$swift->command($response, 235);
} catch (Swift_ConnectionException $e) {
$swift->reset();
return false;
}
return true;
}