Ask for TFA again after logging out (#123)

This commit is contained in:
RainLoop Team 2014-04-17 16:40:37 +04:00
parent fa8d7e5ebe
commit 01a1bbf8f1
7 changed files with 218 additions and 208 deletions

View file

@ -1455,7 +1455,7 @@ class Actions
if ($bAdditionalCodeSignMeSignMe) if ($bAdditionalCodeSignMeSignMe)
{ {
$this->setSkipTimeoutForTwoFactor($oAccount->ParentEmailHelper()); $this->setSkipTimeoutForTwoFactor($oAccount->ParentEmailHelper(), \time());
} }
if (!$bGood && !$this->TwoFactorAuthProvider()->VerifyCode($aData['Secret'], $sAdditionalCode)) if (!$bGood && !$this->TwoFactorAuthProvider()->VerifyCode($aData['Secret'], $sAdditionalCode))
@ -1907,6 +1907,15 @@ class Actions
'SignMe/UserToken/'.$oAccount->SignMeToken()); 'SignMe/UserToken/'.$oAccount->SignMeToken());
} }
if ($oAccount && $this->TwoFactorAuthProvider()->IsActive())
{
$aData = $this->getTwoFactorInfo($oAccount->ParentEmailHelper());
if (\is_array($aData) && isset($aData['IsSet'], $aData['Enable']))
{
$this->setSkipTimeoutForTwoFactor($oAccount->ParentEmailHelper(), 0);
}
}
return $this->TrueResponse(__FUNCTION__); return $this->TrueResponse(__FUNCTION__);
} }
@ -4741,10 +4750,11 @@ class Actions
/** /**
* @param string $sEmail * @param string $sEmail
* @param int $iTime = 0
* *
* @return bool * @return bool
*/ */
private function setSkipTimeoutForTwoFactor($sEmail) private function setSkipTimeoutForTwoFactor($sEmail, $iTime = 0)
{ {
if (empty($sEmail)) if (empty($sEmail))
{ {
@ -4761,7 +4771,7 @@ class Actions
$mData = \RainLoop\Utils::DecodeKeyValues($sData); $mData = \RainLoop\Utils::DecodeKeyValues($sData);
if (\is_array($mData)) if (\is_array($mData))
{ {
$mData['Timeout'] = \time(); $mData['Timeout'] = 0 < $iTime ? $iTime : 0;
return $this->StorageProvider()->Put(null, return $this->StorageProvider()->Put(null,
\RainLoop\Providers\Storage\Enumerations\StorageType::NOBODY, \RainLoop\Providers\Storage\Enumerations\StorageType::NOBODY,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long