public function login($username, $password)
    {
        $stmt = $this->conn->prepare(
            sprintf("SELECT user_id, user_name, user_pass
			FROM %s WHERE user_name = :name LIMIT 1", $this->table));
        $stmt->execute(['name' => $username]);

        $result = $stmt->fetch(\PDO::FETCH_ASSOC);

        if ($result['user_name'] !== $username) {
            return false;
        }

        if ($this->hasher->CheckPassword($password, $result['user_pass'])) {
            // Clear previous session
            $this->session->regenerate();
            // Write new data to session
            $data = [
                'id' => $result['user_id'],
                'logged_' . $this->table => true
            ];
            $this->session->set('user', $data);
            return true;
        }
        return false;
    }