Loads a user with user hash key.

@param string $hash

@return array
164330
public function loadUserByToken($hash)
    {
        $query = $this->handler->createSelectQuery();
        $query->select(
            $this->handler->quoteColumn('contentobject_id', 'ezuser'),
            $this->handler->quoteColumn('login', 'ezuser'),
            $this->handler->quoteColumn('email', 'ezuser'),
            $this->handler->quoteColumn('password_hash', 'ezuser'),
            $this->handler->quoteColumn('password_hash_type', 'ezuser'),
            $this->handler->quoteColumn('is_enabled', 'ezuser_setting'),
            $this->handler->quoteColumn('max_login', 'ezuser_setting')
        )->from(
            $this->handler->quoteTable('ezuser')
        )->leftJoin(
            $this->handler->quoteTable('ezuser_setting'),
            $query->expr->eq(
                $this->handler->quoteColumn('user_id', 'ezuser_setting'),
                $this->handler->quoteColumn('contentobject_id', 'ezuser')
            )
        )->leftJoin(
            $this->handler->quoteTable('ezuser_accountkey'),
            $query->expr->eq(
                $this->handler->quoteColumn('user_id', 'ezuser_accountkey'),
                $this->handler->quoteColumn('contentobject_id', 'ezuser')
            )
        )->where(
            $query->expr->lAnd(
                $query->expr->eq(
                    $this->handler->quoteColumn('hash_key', 'ezuser_accountkey'),
                    $query->bindValue($hash, null, \PDO::PARAM_STR)
                ),
                $query->expr->gte(
                    $this->handler->quoteColumn('time', 'ezuser_accountkey'),
                    $query->bindValue(time(), null, \PDO::PARAM_INT)
                )
            )
        );

        $statement = $query->prepare();
        $statement->execute();

        return $statement->fetchAll(\PDO::FETCH_ASSOC);
    }
100825
public function options($hash) {
		return array(
			'path'          => $this->path($this->decode($hash)),
			'url'           => $this->URL,
			'tmbUrl'        => $this->tmbURL,
			'disabled'      => $this->disabled,
			'separator'     => $this->separator,
			'copyOverwrite' => intval($this->options['copyOverwrite']),
			'uploadMaxSize' => intval($this->uploadMaxSize),
			'archivers'     => array(
				// 'create'  => array_keys($this->archivers['create']),
				// 'extract' => array_keys($this->archivers['extract']),
				'create'  => isset($this->archivers['create']) && is_array($this->archivers['create'])  ? array_keys($this->archivers['create'])  : array(),
				'extract' => isset($this->archivers['extract']) && is_array($this->archivers['extract']) ? array_keys($this->archivers['extract']) : array()
			)
		);
	}
543546
protected function convertBlockFromHash($hash)
    {
        if (isset($hash['items'])) {
            $items = array();

            foreach ($hash['items'] as $item) {
                $items[] = $this->convertItemFromHash($item);
            }

            $hash['items'] = $items;
        }

        return new Block($hash);
    }
421879
public function open($hash) {
		if (($file = $this->file($hash)) == false
		|| $file['mime'] == 'directory') {
			return false;
		}
		
		return $this->fopenCE($this->decode($hash), 'rb');
	}
1263858
public function needsRehash(string $hash): bool
    {
        if (!$this->isLoggedIn()) {
            return false;
        }

        return password_needs_rehash(
            $hash,
            PASSWORD_DEFAULT,
            ['cost' => self::PASSWORD_COST]
        );
    }
503225
public function user($key = null) {
		if ($key === null) {
			return $this->_userData;
		}

		return Hash::get((array)$this->_userData(true), $key);
	}
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'));
    }
424827
public function decode($hash)
    {
        $ret = [];

        if (!is_string($hash) || !($hash = trim($hash))) {
            return $ret;
        }

        $alphabet = $this->alphabet;

        $ret = [];

        $hashBreakdown = str_replace(str_split($this->guards), ' ', $hash);
        $hashArray = explode(' ', $hashBreakdown);

        $i = count($hashArray) == 3 || count($hashArray) == 2 ? 1 : 0;

        $hashBreakdown = $hashArray[$i];

        if (isset($hashBreakdown[0])) {
            $lottery = $hashBreakdown[0];
            $hashBreakdown = substr($hashBreakdown, 1);

            $hashBreakdown = str_replace(str_split($this->seps), ' ', $hashBreakdown);
            $hashArray = explode(' ', $hashBreakdown);

            foreach ($hashArray as $subHash) {
                $alphabet = $this->shuffle($alphabet, substr($lottery . $this->salt . $alphabet, 0, strlen($alphabet)));
                $result = $this->unhash($subHash, $alphabet);
                if (Math::greaterThan($result, PHP_INT_MAX)) {
                    $ret[] = Math::strval($result);
                } else {
                    $ret[] = Math::intval($result);
                }
            }

            if ($this->encode($ret) != $hash) {
                $ret = [];
            }
        }

        return $ret;
    }
1082953
public function newPasswordAction($hash)
    {
        $user = $this->userManager->getByResetPasswordHash($hash);
        $form = $this->formFactory->create(FormFactory::TYPE_USER_RESET_PWD, array(), $user);
        $form->handleRequest($this->request);

        if ($form->isValid()) {
            $data = $form->getData();
            $plainPassword = $data->getPlainPassword();
            $user->setPlainPassword($plainPassword);
            $this->userManager->activateUser($user);
            $this->om->persist($user);
            $this->om->flush();
            $this->request->getSession()
                ->getFlashBag()
                ->add('warning', $this->translator->trans('password_ok', array(), 'platform'));

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

        return array(
            'hash' => $hash,
            'form' => $form->createView()
        );
    }
1177982
public function fromHash( $hash )
    {
        if ( !is_array( $hash ) )
        {
            return new Value( [] );
        }
        $metas = [];
        foreach ( $hash as $hashItem )
        {
            if ( !is_array( $hashItem ) )
            {
                continue;
            }
            $meta = new Meta();
            $meta->setName( $hashItem["meta_name"] );
            $meta->setContent( $hashItem["meta_content"] );
            $metas[] = $meta;
        }

        return new Value( $metas );
    }
450076
public function get(string $sha): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/trees/:sha',
            $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $sha));
    }
262860
protected function findViewFromHash($hash)
    {
        $finder = app('view')->getFinder();

        if (isset($this->reflection['viewfinderViews'])) {
            $property = $this->reflection['viewfinderViews'];
        } else {
            $reflection = new \ReflectionClass($finder);
            $property = $reflection->getProperty('views');
            $property->setAccessible(true);
            $this->reflection['viewfinderViews'] = $property;
        }

        foreach ($property->getValue($finder) as $name => $path){
            if (sha1($path) == $hash || md5($path) == $hash) {
                return $name;
            }
        }
    }
143907
public function activate(string $hash): Response
    {
        $accountKey = $this->accountKeyRepository->getByHash($hash);

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

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

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

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

        $userUpdateStruct = $this->userService->newUserUpdateStruct();
        $userUpdateStruct->enabled = true;

        $preActivateEvent = new UserEvents\PreActivateEvent($user, $userUpdateStruct);
        $this->eventDispatcher->dispatch(SiteEvents::USER_PRE_ACTIVATE, $preActivateEvent);
        $userUpdateStruct = $preActivateEvent->getUserUpdateStruct();

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

        $postActivateEvent = new UserEvents\PostActivateEvent($user);
        $this->eventDispatcher->dispatch(SiteEvents::USER_POST_ACTIVATE, $postActivateEvent);

        return $this->render(
            $this->getConfigResolver()->getParameter('template.user.activate_done', 'ngsite')
        );
    }
404038
private function buildKeysCachingPath($hash)
    {
        $chunks = self::chunkSplitArr($hash, 2, '0');
        $chunksCount = count($chunks);
        if ($this->levels > $chunksCount) {
            $diff = $this->levels - $chunksCount;
            $tempArray = array_fill(0, $diff, '00');
            $chunks = array_merge($chunks, $tempArray);
        }

        return vsprintf($this->levelsString, $chunks);
    }
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);
    }
1181672
public function getDataFromHash($hash)
	{
		$data   = [];
		$fields = $this->fields[$hash];
		foreach ($fields as $source => $ids)
		{
			$result  = [];
			$results = $this->results[$source];
			foreach ($ids as $id)
			{
				$result[$id] = $results[$id];
			}
			$data[$source] = $result;
		}

		return $data;
	}
520517
public function get_hash($key = 0)
	{
		$hashes = $this->get_hashes();
		if (isset($hashes[$key]))
		{
			return $hashes[$key];
		}

		return null;
	}