mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Don't unnecessarily throw from verifyLogin and remove its _catch wrapper.
--HG-- extra : rebase_source : ca74b47b96f4d1fbc1b8454d5b505a57b558e729
This commit is contained in:
parent
bdec449e3f
commit
14764a5484
@ -1,7 +1,7 @@
|
||||
error.login.reason.network = Failed to connect to the server
|
||||
error.login.reason.passphrase = Wrong secret phrase
|
||||
error.login.reason.password = Incorrect username or password
|
||||
error.login.reason.unknown = Unknown error
|
||||
error.login.reason.passphrase = Invalid passphrase
|
||||
error.login.reason.network = Network error
|
||||
error.login.reason.server = Server incorrectly configured
|
||||
|
||||
invalid-captcha = Incorrect words, try again
|
||||
weak-password = Use a stronger password
|
||||
|
@ -88,6 +88,7 @@ ENGINE_SUCCEEDED: "success.engine",
|
||||
LOGIN_FAILED_NO_USERNAME: "error.login.reason.no_username",
|
||||
LOGIN_FAILED_NO_PASSWORD: "error.login.reason.no_password",
|
||||
LOGIN_FAILED_NETWORK_ERROR: "error.login.reason.network",
|
||||
LOGIN_FAILED_SERVER_ERROR: "error.login.reason.server",
|
||||
LOGIN_FAILED_INVALID_PASSPHRASE: "error.login.reason.passphrase",
|
||||
LOGIN_FAILED_LOGIN_REJECTED: "error.login.reason.password",
|
||||
|
||||
|
@ -540,22 +540,25 @@ WeaveSvc.prototype = {
|
||||
},
|
||||
|
||||
_verifyLogin: function _verifyLogin()
|
||||
this._catch(this._notify("verify-login", "", function() {
|
||||
this._notify("verify-login", "", function() {
|
||||
// Make sure we have a cluster to verify against
|
||||
if (this.clusterURL == "")
|
||||
this._setCluster();
|
||||
|
||||
let res = new Resource(this.infoURL);
|
||||
try {
|
||||
let test = res.get();
|
||||
let test = new Resource(this.infoURL).get();
|
||||
switch (test.status) {
|
||||
case 200:
|
||||
// The user is authenticated, so check the passphrase now
|
||||
if (!this._verifyPassphrase()) {
|
||||
this.status.setLoginStatus(LOGIN_FAILED_INVALID_PASSPHRASE);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Username/password and passphrase all verified
|
||||
this.status.setLoginStatus(LOGIN_SUCCEEDED);
|
||||
return true;
|
||||
|
||||
case 401:
|
||||
case 404:
|
||||
// Check that we're verifying with the correct cluster
|
||||
@ -564,19 +567,22 @@ WeaveSvc.prototype = {
|
||||
|
||||
// We must have the right cluster, but the server doesn't expect us
|
||||
this.status.setLoginStatus(LOGIN_FAILED_LOGIN_REJECTED);
|
||||
this._log.debug("verifyLogin failed: login failed")
|
||||
return false;
|
||||
|
||||
default:
|
||||
this._checkServerError(test.status);
|
||||
throw "unexpected HTTP response: " + test.status;
|
||||
// Server didn't respond with something that we expected
|
||||
this._checkServerError(test);
|
||||
this.status.setLoginStatus(LOGIN_FAILED_SERVER_ERROR);
|
||||
return false;
|
||||
}
|
||||
} catch (e) {
|
||||
// if we get here, we have either a busted channel or a network error
|
||||
this._log.debug("verifyLogin failed: " + e)
|
||||
this.status.setLoginStatus(LOGIN_FAILED_NETWORK_ERROR);
|
||||
throw e;
|
||||
}
|
||||
}))(),
|
||||
catch (ex) {
|
||||
// Must have failed on some network issue
|
||||
this._log.debug("verifyLogin failed: " + Utils.exceptionStr(ex));
|
||||
this.status.setLoginStatus(LOGIN_FAILED_NETWORK_ERROR);
|
||||
return false;
|
||||
}
|
||||
})(),
|
||||
|
||||
_verifyPassphrase: function _verifyPassphrase()
|
||||
this._catch(this._notify("verify-passphrase", "", function() {
|
||||
|
Loading…
Reference in New Issue
Block a user