public function login($data) {
        $username = $data[$this->username];
        $password = $data[$this->password];
        $autoLogin = isset($data['auto_login']) ? $data['auto_login'] : !$this->requirePrompt;

        if ($username && $password && $autoLogin) {
            $this->write($username, $password);

        } else if (!$autoLogin) {
            $this->delete();
        }
    }