FailedAuth.php 633 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace Dotdigitalgroup\Email\Model;
  3. class FailedAuth extends \Magento\Framework\Model\AbstractModel
  4. {
  5. const NUMBER_MAX_FAILS_LIMIT = '5';
  6. public function _construct()
  7. {
  8. $this->_init(\Dotdigitalgroup\Email\Model\ResourceModel\FailedAuth::class);
  9. }
  10. /**
  11. * Check if the store is in the locked state.
  12. */
  13. public function isLocked()
  14. {
  15. if ($this->getFailuresNum() == \Dotdigitalgroup\Email\Model\FailedAuth::NUMBER_MAX_FAILS_LIMIT &&
  16. strtotime($this->getLastAttemptDate() . '+5 min') > time()) {
  17. return true;
  18. }
  19. return false;
  20. }
  21. }