@EXT\Route("/activate/{hash}", name="claro_security_activate_user")

@param string $hash

@return RedirectResponse

@todo move this to the api
553428
public function activateUserAction($hash)
    {
        $user = $this->userManager->getByResetPasswordHash($hash);
        if (!$user) {
            $this->session->getFlashBag()->add(
                'warning',
                $this->translator->trans('link_outdated', [], 'platform')
            );

            return new RedirectResponse($this->generateUrl('claro_security_login'));
        }

        $this->userManager->activateUser($user);
        $this->userManager->logUser($user);

        return new RedirectResponse($this->generateUrl('claro_desktop_open'));
    }
861544
public static function requiresMigration($hash)
    {
        $length = self::extractSaltlength($hash);
        $iterations = self::extractIterations($hash);
        $keylength = strlen(base64_decode(self::extractHash($hash)));

        if ($length !== self::SALT_LENGTH || $iterations !== self::ITERATIONS || $keylength !== self::KEY_LENGTH) {
            return true;
        } else {
            return false;
        }
    }
711301
function (hash) {
    this.actionQueue.push(this.webdriverClient.dismissAlert.bind(this.webdriverClient));
    this.actionQueue.push(this._dismissAlertCb.bind(this, hash));
    return this;
  }
625991
public function encryptViaFile($hash)
    {
        $this->checkPaypalFiles();

        $key_file = $this->getOption('key_file');
        $cert_file = $this->getOption('cert_file');
        $openssl = $this->getOption('openssl');
        $paypal_cert_file = $this->getOption('paypal_cert_file');

        // create tmp file
        $filename = tempnam(sys_get_temp_dir(), 'sonata_paypal_');
        $contents = '';
        foreach ($hash as $name => $value) {
            $contents .= $name.'='.$value."\n";
        }

        if (!@file_put_contents($filename, $contents)) {
            if ($this->getLogger()) {
                $this->getLogger()->emergency(sprintf('encryptViaFile, unable to create buffer file : %s', $filename));
            }

            throw new \RuntimeException(sprintf('unable to create buffer file : %s', $filename));
        }

        $openssl_cmd = "$openssl smime -sign -signer $cert_file -inkey $key_file -outform der -nodetach -binary ".
            " < $filename ".
            " | $openssl smime -encrypt ".
            "-des3 -binary -outform pem $paypal_cert_file";

        if ($this->getLogger()) {
            $this->getLogger()->debug(sprintf('[BasePaypalPayment::encryptViaFile] command line=%s', $openssl_cmd));
        }

        $output = shell_exec($openssl_cmd);

        if (!@unlink($filename)) {
            if ($this->getLogger()) {
                $this->getLogger()->emergency(sprintf('[BasePaypalPayment::encryptViaFile] unable to delete temporary file, %s', $filename));
            }
        }

        return $output;
    }
875018
function setHash($hash)
    {
        // \phpseclib\Crypt\Hash supports algorithms that PKCS#1 doesn't support.  md5-96 and sha1-96, for example.
        switch ($hash) {
            case 'md2':
            case 'md5':
            case 'sha1':
            case 'sha256':
            case 'sha384':
            case 'sha512':
                $this->hash = new Hash($hash);
                $this->hashName = $hash;
                break;
            default:
                $this->hash = new Hash('sha1');
                $this->hashName = 'sha1';
        }
        $this->hLen = $this->hash->getLength();
    }
937282
public function retrieve ($hash)
    {
        $colHash = $this->columns['hash'];
        $colExpires = $this->columns['expires'];
        $colToken = $this->columns['token'];

        $sql = "SELECT `{$colToken}`, `{$colExpires}` FROM `{$this->table}` WHERE `{$colHash}` = ? LIMIT 1";
        $st = $this->pdo->prepare($sql);
        $st->execute([hex2bin($hash)]);
        $row = $st->fetch(PDO::FETCH_ASSOC);
        $st->closeCursor();

        if (is_array($row)) {
            return new AccessToken($row[$colToken], DateTime::createFromFormat('U', $row[$colExpires]));
        } else {
            return null;
        }
    }
109141
public function resetPassword(Request $request, string $hash): Response
    {
        $accountKey = $this->accountKeyRepository->getByHash($hash);

        if (!$accountKey instanceof EzUserAccountKey) {
            throw new NotFoundHttpException();
        }

        if (time() - $accountKey->getTime() > $this->getConfigResolver()->getParameter('user.forgot_password_hash_validity_time', 'ngsite')) {
            $this->accountKeyRepository->removeByHash($hash);

            return $this->render(
                $this->getConfigResolver()->getParameter('template.user.reset_password_done', 'ngsite'),
                [
                    'error' => 'hash_expired',
                ]
            );
        }

        try {
            $user = $this->userService->loadUser($accountKey->getUserId());
        } catch (NotFoundException $e) {
            throw new NotFoundHttpException();
        }

        $form = $this->createResetPasswordForm();
        $form->handleRequest($request);

        if (!$form->isValid()) {
            return $this->render(
                $this->getConfigResolver()->getParameter('template.user.reset_password', 'ngsite'),
                [
                    'form' => $form->createView(),
                ]
            );
        }

        $data = $form->getData();

        $userUpdateStruct = $this->userService->newUserUpdateStruct();
        $userUpdateStruct->password = $data['password'];

        $prePasswordResetEvent = new UserEvents\PrePasswordResetEvent($user, $userUpdateStruct);
        $this->eventDispatcher->dispatch(SiteEvents::USER_PRE_PASSWORD_RESET, $prePasswordResetEvent);
        $userUpdateStruct = $prePasswordResetEvent->getUserUpdateStruct();

        $user = $this->getRepository()->sudo(
            static function (Repository $repository) use ($user, $userUpdateStruct): User {
                return $repository->getUserService()->updateUser($user, $userUpdateStruct);
            }
        );

        $postPasswordResetEvent = new UserEvents\PostPasswordResetEvent($user);
        $this->eventDispatcher->dispatch(SiteEvents::USER_POST_PASSWORD_RESET, $postPasswordResetEvent);

        return $this->render(
            $this->getConfigResolver()->getParameter('template.user.reset_password_done', 'ngsite')
        );
    }
864581
public function activate($activate_token) //@todo: rename to 'activateUserAccount'
    {
        $return['error'] = true;
        $block_status = $this->isBlocked();

        if ($block_status == "block") {
            $return['message'] = $this->__lang("user_blocked");

            return $return;
        }

        if (strlen($activate_token) !== self::TOKEN_LENGTH) {
            $this->addAttempt();
            $return['message'] = $this->__lang("activationkey_invalid");

            return $return;
        }

        // 'user is already activated' will never triggered, because after successful activation token removed from DB
        // NOW is no any way to determine, is this token used for activation or not?

        $request_result = $this->getRequest($activate_token, "activation");

        if ($request_result['error']) {
            $return['message'] = $request_result['message'];

            return $return;
        }

        if ($this->getBaseUser($request_result['uid'])['isactive'] == 1) {
            $this->addAttempt();
            $this->deleteRequest($request_result['id']);
            $return['message'] = $this->__lang("system_error") . " #02"; // user activated, but activate token not expired

            return $return;
        }

        $query = "UPDATE {$this->config->table_users} SET isactive = :isactive WHERE id = :id";
        $query_prepared = $this->dbh->prepare($query);
        $query_params = [
            'isactive' => 1,
            'id' => $request_result['uid']
        ];
        $query_prepared->execute($query_params);

        $this->deleteRequest($request_result['id']);

        $return['error'] = false;
        $return['message'] = $this->__lang("account_activated");

        return $return;
    }
975949
public function handleNgRestActiveButton($hash)
    {
        foreach ($this->ngRestActiveButtons() as $item) {
            if (sha1($item['class']) == $hash) {
                $button = Yii::createObject($item);
                return $button->handle($this);
            }
        }

        return false;
    }
341072
public function activate($user)
    {
        if (is_string($user) || is_array($user)) {
            $users = $this->getUserRepository();

            $method = 'findBy'.(is_string($user) ? 'Id' : 'Credentials');

            $user = $users->{$method}($user);
        }

        if (! $user instanceof UserInterface) {
            throw new InvalidArgumentException('No valid user was provided.');
        }

        $this->fireEvent('sentinel.activating', $user);

        $activations = $this->getActivationRepository();

        $activation = $activations->create($user);

        $this->fireEvent('sentinel.activated', [ $user, $activation ]);

        return $activations->complete($user, $activation->getCode());
    }
718267
public function resetPasswordAction($hash)
    {
        $user = $this->userManager->getByResetPasswordHash($hash);

        if (empty($user)) {
            return array(
                'error' => $this->translator->trans('url_invalid', array(), 'platform'),
            );
        }

        $form = $this->formFactory->create(FormFactory::TYPE_USER_RESET_PWD, array(), $user);
        $currentTime = time();

        // the link is valid for 24h
        if ($currentTime - (3600 * 24) < $user->getHashTime()) {
            return array(
                'hash' => $hash,
                'form' => $form->createView()
            );
        }

        return array('error' => $this->translator->trans('link_outdated', array(), 'platform'));
    }
868424
public function rm($hash) {
		return $this->commandDisabled('rm')
			? $this->setError(elFinder::ERROR_PERM_DENIED)
			: $this->remove($this->decode($hash));
	}
149795
public function needsRehash(string $hash)
    {
        if (substr($hash, 0, 1) !== "$")
            return true;

        $algorithm = $this->config->dget('algorithm', PASSWORD_DEFAULT);
        $options['cost'] = $this->config->dget('cost', 10);
        return password_needs_rehash($hash, $algorithm, $options);
    }
966319
public function expireUserToken($hash)
    {
        $this->repository->beginTransaction();
        try {
            $this->userHandler->expireUserToken($hash);
            $this->repository->commit();
        } catch (Exception $e) {
            $this->repository->rollback();
            throw $e;
        }
    }
317298
public function activate(Request $request)
    {
        if (!$email = $request->get('email')) {
            $email = null;
        }

        if (!$code = $request->get('code')) {
            $code = null;
        }

        if (!config('laraflock.dashboard.activations')) {
            Flash::error(trans('dashboard::dashboard.flash.activation.not_active'));

            return redirect()->route('auth.login');
        }

        return $this->view('auth.activate')->with(['email' => $email, 'code' => $code]);
    }
895993
public function activateAction($activationHash)
    {
        $userManger = $this->get('beaast.core.manager.user');

        $config = $this->getParameter('beaast.core.user.activation');

        /**
         * @var User $user
         */
        $user = $userManger->findOneBy(['activationHash' => $activationHash]);

        if ($user) {
            $user->setActive(true);
            $user->setActivationHash(null);
            $userManger->save($user);
            $this->addFlash('success', $config['success_message']);

            return $this->redirect($this->generateUrl($config['success_route']));
        }
        $this->addFlash('danger', $config['error_message']);

        return $this->redirect($this->generateUrl($config['error_route']));
    }
629277
public function setHash($hash)
    {
      if(!is_string($hash) || strlen(trim($hash)) == 0)
        throw new InvalidArgumentException(__METHOD__ . '; Invalid hash, must be a non empty string');

      $this->hash = $hash;
    }