gdm: Flip canRetry boolean to doneTrying on verification failure

This commit flips a boolean in the verification failed handler
to make things easier to read.

It also moves the retry logic to the bottom where it makes more
logical sense.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1821>
This commit is contained in:
Ray Strode 2021-04-28 10:42:14 -04:00 committed by Marge Bot
parent a97c4b8945
commit 8cfd4c969b

View File

@ -685,29 +685,18 @@ var ShellUserVerifier = class {
(this._reauthOnly || this._failCounter < this.allowedFailures); (this._reauthOnly || this._failCounter < this.allowedFailures);
} }
_verificationFailed(serviceName, retry) { _verificationFailed(serviceName, shouldRetry) {
// For Not Listed / enterprise logins, immediately reset // For Not Listed / enterprise logins, immediately reset
// the dialog // the dialog
// Otherwise, when in login mode we allow ALLOWED_FAILURES attempts. // Otherwise, when in login mode we allow ALLOWED_FAILURES attempts.
// After that, we go back to the welcome screen. // After that, we go back to the welcome screen.
const canRetry = retry && this._canRetry();
this._disconnectSignals(); this._disconnectSignals();
this._filterServiceMessages(serviceName, MessageType.ERROR); this._filterServiceMessages(serviceName, MessageType.ERROR);
if (canRetry) { const doneTrying = !shouldRetry || !this._canRetry();
if (!this.hasPendingMessages) {
this._retry(serviceName); if (doneTrying) {
} else {
const cancellable = this._cancellable;
let signalId = this.connect('no-more-messages', () => {
this.disconnect(signalId);
if (!cancellable.is_cancelled())
this._retry(serviceName);
});
}
} else {
// eslint-disable-next-line no-lonely-if // eslint-disable-next-line no-lonely-if
if (!this.hasPendingMessages) { if (!this.hasPendingMessages) {
this._cancelAndReset(); this._cancelAndReset();
@ -721,7 +710,18 @@ var ShellUserVerifier = class {
} }
} }
this.emit('verification-failed', serviceName, canRetry); this.emit('verification-failed', serviceName, !doneTrying);
if (!this.hasPendingMessages) {
this._retry(serviceName);
} else {
const cancellable = this._cancellable;
let signalId = this.connect('no-more-messages', () => {
this.disconnect(signalId);
if (!cancellable.is_cancelled())
this._retry(serviceName);
});
}
} }
_onServiceUnavailable(_client, serviceName, errorMessage) { _onServiceUnavailable(_client, serviceName, errorMessage) {