mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-09-20 07:35:55 +08:00
Resolve #695
This commit is contained in:
parent
da98c611e1
commit
308be25c24
|
@ -11,9 +11,8 @@ class Login extends \SnappyMail\SASL
|
||||||
{
|
{
|
||||||
// $challenge should be 'VXNlcm5hbWU6', but broken on some systems
|
// $challenge should be 'VXNlcm5hbWU6', but broken on some systems
|
||||||
// See https://github.com/the-djmaze/snappymail/issues/693
|
// See https://github.com/the-djmaze/snappymail/issues/693
|
||||||
if ($challenge && \str_starts_with($this->decode($challenge), 'Username:')) {
|
if ($challenge && !\str_starts_with($this->decode($challenge), 'Username:')) {
|
||||||
// if ($challenge && 'Username:' !== $this->decode($challenge)) {
|
throw new \Exception("Invalid response: {$this->decode($challenge)}");
|
||||||
throw new \Exception("Invalid response: {$challenge}");
|
|
||||||
}
|
}
|
||||||
$this->passphrase = $passphrase;
|
$this->passphrase = $passphrase;
|
||||||
return $this->encode($username);
|
return $this->encode($username);
|
||||||
|
|
25
test/sasl.php
Normal file
25
test/sasl.php
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
//$_ENV['SNAPPYMAIL_INCLUDE_AS_API'] = true;
|
||||||
|
//require '../index.php';
|
||||||
|
|
||||||
|
define('SNAPPYMAIL_LIBRARIES_PATH', dirname(__DIR__) . '/snappymail/v/0.0.0/app/libraries');
|
||||||
|
if (false === set_include_path(SNAPPYMAIL_LIBRARIES_PATH . PATH_SEPARATOR . get_include_path())) {
|
||||||
|
exit('set_include_path() failed. Probably due to Apache config using php_admin_value instead of php_value');
|
||||||
|
}
|
||||||
|
spl_autoload_extensions('.php');
|
||||||
|
/** lowercase autoloader */
|
||||||
|
spl_autoload_register();
|
||||||
|
/** case-sensitive autoloader */
|
||||||
|
spl_autoload_register(function($sClassName){
|
||||||
|
$file = SNAPPYMAIL_LIBRARIES_PATH . strtr($sClassName, '\\', DIRECTORY_SEPARATOR) . '.php';
|
||||||
|
// if ($file = stream_resolve_include_path(strtr($sClassName, '\\', DIRECTORY_SEPARATOR) . '.php')) {
|
||||||
|
if (is_file($file)) {
|
||||||
|
include_once $file;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$LOGIN = new \SnappyMail\SASL\Login;
|
||||||
|
$LOGIN->base64 = true;
|
||||||
|
var_dump($LOGIN->authenticate('john', 'doe', 'VXNlcm5hbWU6'));
|
||||||
|
var_dump($LOGIN->authenticate('john', 'doe', 'VXNlcm5hbWU6CG'));
|
||||||
|
var_dump($LOGIN->authenticate('john', 'doe', 'UGFzc3dvcmQ6'));
|
Loading…
Reference in a new issue