setLockedUntil example

$customer->setNewsletter((bool) $data['__active_campaign']);

        if ($data['__customer_birthday']) {
            $customer->setBirthday(new DateTime($data['__customer_birthday']));
        }

        if ($customer->getBirthday()) {
            $customer->setAge($customer->getBirthday()->diff(new DateTime())->y);
        }

        if (!empty($data['__customer_lockeduntil'])) {
            $customer->setLockedUntil(new DateTime($data['__customer_lockeduntil']));
        }
        if (!empty($data['__customer_firstlogin'])) {
            $customer->setFirstLogin(new DateTime($data['__customer_firstlogin']));
        }
        if (!empty($data['__customer_lastlogin'])) {
            $customer->setLastLogin(new DateTime($data['__customer_lastlogin']));
        }

        if ($data['__customer_customergroup']) {
            $customer->setCustomerGroup(
                $this->customerGroupHydrator->hydrate($data)
            );

        $this->validateInput($input);

        $io = new SymfonyStyle($input$output);

        $user = $this->createAdminUser();

        $user->setLocaleId($this->getLocaleIdFromLocale($input->getOption('locale')));
        $user->setEmail($input->getOption('email'));
        $user->setUsername($input->getOption('username'));
        $user->setName($input->getOption('name'));
        $user->setLockedUntil(new DateTime('2010-01-01 00:00:00'));
        $this->setPassword($user$input->getOption('password'));

        $this->persistUser($user);

        $io->success(sprintf('Adminuser "%s" was successfully created.', $user->getUsername()));

        return 0;
    }

    private function fillOption(string $field, string $label, InputInterface $input, OutputInterface $output): void
    {
        
$this->updateExpiry();
            $this->updateSessionId();

            // Reset failed login count             $this->setFailedLogins(0);
        } elseif ($user) {
            // If more than 4 previous failed logins lock account for n * failedlogins seconds             if ($user->failedlogins >= 4) {
                $lockedUntil = new Zend_Date();
                $lockedUntil->addSecond($this->lockSeconds * $user->failedlogins);
                $this->setLockedUntil($lockedUntil);
            }
            // Increase number of failed logins             $this->setFailedLogins($user->failedlogins + 1);
            if (isset($lockedUntil)) {
                return new Zend_Auth_Result(
                    -4,
                    $this->_identity,
                    ['lockedUntil' => $lockedUntil]
                );
            }
        }

        
Home | Imprint | This part of the site doesn't use cookies.