Piwik\Plugins\Login\Controller::authenticateAndRedirect PHP Method

authenticateAndRedirect() protected method

Authenticate user and password. Redirect if successful.
protected authenticateAndRedirect ( string $login, string $password, boolean $rememberMe, string $urlToRedirect = false, boolean $passwordHashed = false ) : string
$login string user name
$password string plain-text or hashed password
$rememberMe boolean Remember me?
$urlToRedirect string URL to redirect to, if successfully authenticated
$passwordHashed boolean indicates if $password is hashed
return string failure message if unable to authenticate
    protected function authenticateAndRedirect($login, $password, $rememberMe, $urlToRedirect = false, $passwordHashed = false)
    {
        Nonce::discardNonce('Login.login');
        $this->auth->setLogin($login);
        if ($passwordHashed === false) {
            $this->auth->setPassword($password);
        } else {
            $this->auth->setPasswordHash($password);
        }
        $this->sessionInitializer->initSession($this->auth, $rememberMe);
        // remove password reset entry if it exists
        $this->passwordResetter->removePasswordResetInfo($login);
        if (empty($urlToRedirect)) {
            $urlToRedirect = Url::getCurrentUrlWithoutQueryString();
        }
        Url::redirectToUrl($urlToRedirect);
    }