protected function checkAccountStatus()
{
$time = time();
// Check whether the account is locked
if ($this->locked + \Config::get('lockPeriod') > $time) {
\Message::addError(sprintf($GLOBALS['TL_LANG']['ERR']['accountLocked'], ceil(($this->locked + \Config::get('lockPeriod') - $time) / 60)));
return false;
} elseif ($this->disable) {
\Message::addError($GLOBALS['TL_LANG']['ERR']['invalidLogin']);
$this->log('The account has been disabled', __METHOD__, TL_ACCESS);
return false;
} elseif ($this instanceof FrontendUser && !$this->login) {
\Message::addError($GLOBALS['TL_LANG']['ERR']['invalidLogin']);
$this->log('User "' . $this->username . '" is not allowed to log in', __METHOD__, TL_ACCESS);
return false;
} elseif ($this->start != '' || $this->stop != '') {
$time = \Date::floorToMinute($time);
if ($this->start != '' && $this->start > $time) {
\Message::addError($GLOBALS['TL_LANG']['ERR']['invalidLogin']);
$this->log('The account was not active yet (activation date: ' . \Date::parse(\Config::get('dateFormat'), $this->start) . ')', __METHOD__, TL_ACCESS);
return false;
}
if ($this->stop != '' && $this->stop <= $time + 60) {
\Message::addError($GLOBALS['TL_LANG']['ERR']['invalidLogin']);
$this->log('The account was not active anymore (deactivation date: ' . \Date::parse(\Config::get('dateFormat'), $this->stop) . ')', __METHOD__, TL_ACCESS);
return false;
}
}
return true;
}