mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Merge branch 'the-djmaze:master' into master
This commit is contained in:
commit
1f5613b504
3 changed files with 17 additions and 16 deletions
|
|
@ -37,7 +37,7 @@ abstract class DateTimeHelper
|
||||||
{
|
{
|
||||||
$sDateTime = \trim($sDateTime);
|
$sDateTime = \trim($sDateTime);
|
||||||
if (empty($sDateTime)) {
|
if (empty($sDateTime)) {
|
||||||
\SnappyMail\Log::info("No RFC 2822 date to parse");
|
\SnappyMail\Log::info('', "No RFC 2822 date to parse");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -45,7 +45,7 @@ abstract class DateTimeHelper
|
||||||
$oDateTime = \DateTime::createFromFormat(\DateTime::RFC2822, $sDateTime, static::GetUtcTimeZoneObject());
|
$oDateTime = \DateTime::createFromFormat(\DateTime::RFC2822, $sDateTime, static::GetUtcTimeZoneObject());
|
||||||
// 398045302 is 1982-08-13 00:08:22 the date RFC 822 was created
|
// 398045302 is 1982-08-13 00:08:22 the date RFC 822 was created
|
||||||
if (!$oDateTime || 398045302 > $oDateTime->getTimestamp()) {
|
if (!$oDateTime || 398045302 > $oDateTime->getTimestamp()) {
|
||||||
\SnappyMail\Log::notice("Failed to parse RFC 2822 date '{$sDateTime}'");
|
\SnappyMail\Log::notice('', "Failed to parse RFC 2822 date '{$sDateTime}'");
|
||||||
}
|
}
|
||||||
return $oDateTime ? $oDateTime->getTimestamp() : 0;
|
return $oDateTime ? $oDateTime->getTimestamp() : 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -206,17 +206,15 @@ class Logger extends \SplFixedArray
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function signalHandler($signo)
|
public function signalHandler($signo, /*?array*/$siginfo = null)
|
||||||
{
|
{
|
||||||
if (\SIGTERM == $signo) {
|
if (\SIGTERM == $signo) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
if ($this->bUsed) {
|
foreach (static::$SIGNALS as $SIGNAL) {
|
||||||
foreach (static::$SIGNALS as $SIGNAL) {
|
if (\defined($SIGNAL) && \constant($SIGNAL) == $signo) {
|
||||||
if (\defined($SIGNAL) && \constant($SIGNAL) == $signo) {
|
$this->Write("Caught {$SIGNAL} ".($siginfo ? \json_encode($siginfo) : ''), \LOG_CRIT, 'PHP');
|
||||||
$this->Write("Caught {$SIGNAL}");
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -341,11 +341,14 @@ trait UserAuth
|
||||||
\SnappyMail\Log::notice(self::AUTH_SIGN_ME_TOKEN_KEY, 'decrypt');
|
\SnappyMail\Log::notice(self::AUTH_SIGN_ME_TOKEN_KEY, 'decrypt');
|
||||||
$aResult = \SnappyMail\Crypt::DecryptUrlSafe($sSignMeToken, 'signme');
|
$aResult = \SnappyMail\Crypt::DecryptUrlSafe($sSignMeToken, 'signme');
|
||||||
if (isset($aResult['e'], $aResult['u']) && \SnappyMail\UUID::isValid($aResult['u'])) {
|
if (isset($aResult['e'], $aResult['u']) && \SnappyMail\UUID::isValid($aResult['u'])) {
|
||||||
|
if (!isset($aResult['c'])) {
|
||||||
|
$aTokenData['c'] = \array_key_last($aTokenData);
|
||||||
|
$aTokenData['d'] = \end($aTokenData);
|
||||||
|
}
|
||||||
return $aResult;
|
return $aResult;
|
||||||
}
|
}
|
||||||
\SnappyMail\Log::notice(self::AUTH_SIGN_ME_TOKEN_KEY, 'invalid');
|
\SnappyMail\Log::notice(self::AUTH_SIGN_ME_TOKEN_KEY, 'invalid');
|
||||||
// Don't clear due to login checkbox
|
Cookies::clear(self::AUTH_SIGN_ME_TOKEN_KEY);
|
||||||
// Cookies::clear(self::AUTH_SIGN_ME_TOKEN_KEY);
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -360,7 +363,8 @@ trait UserAuth
|
||||||
\SnappyMail\Crypt::EncryptUrlSafe([
|
\SnappyMail\Crypt::EncryptUrlSafe([
|
||||||
'e' => $oAccount->Email(),
|
'e' => $oAccount->Email(),
|
||||||
'u' => $uuid,
|
'u' => $uuid,
|
||||||
$data[0] => \base64_encode($data[1])
|
'c' => $data[0],
|
||||||
|
'd' => \base64_encode($data[1])
|
||||||
], 'signme'),
|
], 'signme'),
|
||||||
\time() + 3600 * 24 * 30 // 30 days
|
\time() + 3600 * 24 * 30 // 30 days
|
||||||
);
|
);
|
||||||
|
|
@ -382,8 +386,8 @@ trait UserAuth
|
||||||
throw new \RuntimeException("server token not found for {$aTokenData['e']}/.sign_me/{$aTokenData['u']}");
|
throw new \RuntimeException("server token not found for {$aTokenData['e']}/.sign_me/{$aTokenData['u']}");
|
||||||
}
|
}
|
||||||
$aAccountHash = \SnappyMail\Crypt::Decrypt([
|
$aAccountHash = \SnappyMail\Crypt::Decrypt([
|
||||||
\array_key_last($aTokenData),
|
$aTokenData['c'],
|
||||||
\base64_decode(\end($aTokenData)),
|
\base64_decode($aTokenData['d']),
|
||||||
$sAuthToken
|
$sAuthToken
|
||||||
], 'signme');
|
], 'signme');
|
||||||
if (!\is_array($aAccountHash)) {
|
if (!\is_array($aAccountHash)) {
|
||||||
|
|
@ -401,8 +405,7 @@ trait UserAuth
|
||||||
catch (\Throwable $oException)
|
catch (\Throwable $oException)
|
||||||
{
|
{
|
||||||
\SnappyMail\Log::warning(self::AUTH_SIGN_ME_TOKEN_KEY, $oException->getMessage());
|
\SnappyMail\Log::warning(self::AUTH_SIGN_ME_TOKEN_KEY, $oException->getMessage());
|
||||||
// Don't clear due to smctoken cookie missing at initialization and login checkbox
|
$this->ClearSignMeData();
|
||||||
// $this->ClearSignMeData();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue