Stop autologin on logout

This commit is contained in:
Natsumi
2020-12-27 20:12:08 +13:00
parent d72ad2fb6f
commit f8a3aa1bf0

View File

@@ -386,8 +386,11 @@ import gameLogService from './service/gamelog.js'
} }
return data; return data;
} }
if ((status === 401) && (data.error.message === '"Missing Credentials"') && (this.pendingGetRequests.size <= 1)) { if ((status === 401) && (data.error.message === '"Missing Credentials"') && ($app.isAutoLogin)) {
this.$emit('AUTOLOGIN'); if (endpoint.substring(0, 10) == 'auth/user?') {
this.$emit('AUTOLOGIN');
}
throw new Error('401: Missing Credentials');
} }
if (data.error === Object(data.error)) { if (data.error === Object(data.error)) {
this.$throw( this.$throw(
@@ -3680,19 +3683,17 @@ import gameLogService from './service/gamelog.js'
}; };
API.$on('AUTOLOGIN', function () { API.$on('AUTOLOGIN', function () {
if ($app.isAutoLogin) { var user = $app.loginForm.savedCredentials[$app.loginForm.lastUserLoggedIn]
var user = $app.loginForm.savedCredentials[$app.loginForm.lastUserLoggedIn] if (user !== undefined) {
if (user !== undefined) { $app.relogin({
$app.relogin({
username: user.loginParmas.username, username: user.loginParmas.username,
password: user.loginParmas.password password: user.loginParmas.password
}).then((args) => { }).then((args) => {
new Noty({ new Noty({
type: 'success', type: 'success',
text: 'Automatically logged in.' text: 'Automatically logged in.'
}).show(); }).show();
}); });
}
} }
}); });