gdm/util: Simplify code
This avoids iterating and checking if a service is foreground multiple times. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3291>
This commit is contained in:
parent
1c6d76907c
commit
5877de6c3b
@ -892,10 +892,10 @@ export class ShellUserVerifier extends Signals.EventEmitter {
|
|||||||
// If the login failed with the preauthenticated oVirt credentials
|
// If the login failed with the preauthenticated oVirt credentials
|
||||||
// then discard the credentials and revert to default authentication
|
// then discard the credentials and revert to default authentication
|
||||||
// mechanism.
|
// mechanism.
|
||||||
let foregroundService = Object.keys(this._credentialManagers).find(service =>
|
const isCredentialManager = !!this._credentialManagers[serviceName];
|
||||||
this.serviceIsForeground(service));
|
const isForeground = this.serviceIsForeground(serviceName);
|
||||||
if (foregroundService) {
|
if (isCredentialManager && isForeground) {
|
||||||
this._credentialManagers[foregroundService].token = null;
|
this._credentialManagers[serviceName].token = null;
|
||||||
this._preemptingService = null;
|
this._preemptingService = null;
|
||||||
this._verificationFailed(serviceName, false);
|
this._verificationFailed(serviceName, false);
|
||||||
return;
|
return;
|
||||||
@ -909,7 +909,7 @@ export class ShellUserVerifier extends Signals.EventEmitter {
|
|||||||
// if the password service fails, then cancel everything.
|
// if the password service fails, then cancel everything.
|
||||||
// But if, e.g., fingerprint fails, still give
|
// But if, e.g., fingerprint fails, still give
|
||||||
// password authentication a chance to succeed
|
// password authentication a chance to succeed
|
||||||
if (this.serviceIsForeground(serviceName))
|
if (isForeground)
|
||||||
this._failCounter++;
|
this._failCounter++;
|
||||||
|
|
||||||
this._verificationFailed(serviceName, true);
|
this._verificationFailed(serviceName, true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user