public function login(string $userName, string $password, string $storedUserName = '', string $storedPassword = '', int $storedId): bool
    {
        if ($userName === $storedUserName && $this->password->verify($password, $storedPassword)) {
            //write valid login on session
            $this->session->loginTime = \time();
            $this->session->login = [
                'login'     => true,
                'user_id'   => $storedId,
                'user_name' => $storedUserName,
            ];

            //update login data
            $this->data = $this->session->login;

            //regenerate session id
            $this->session->regenerate();
            $this->logged = true;

            return true;
        }

        return false;
    }