mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 14:53:50 +02:00
Remove saved account on incorrect password
This commit is contained in:
@@ -33,7 +33,7 @@
|
|||||||
style="
|
style="
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
|
grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
|
||||||
gap: 15px;
|
gap: 5px;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
max-height: 600px;
|
max-height: 600px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
currentUser.$homeLocation &&
|
currentUser.$homeLocation &&
|
||||||
currentUser.$homeLocation.worldId === worldDialog.id
|
currentUser.$homeLocation.worldId === worldDialog.id
|
||||||
"
|
"
|
||||||
style="margin-right: 5px" />
|
class="inline-block" />
|
||||||
{{ worldDialog.ref.name }}
|
{{ worldDialog.ref.name }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -447,59 +447,40 @@ export const useAuthStore = defineStore('Auth', () => {
|
|||||||
AppDebug.endpointDomain = AppDebug.endpointDomainVrchat;
|
AppDebug.endpointDomain = AppDebug.endpointDomainVrchat;
|
||||||
AppDebug.websocketDomain = AppDebug.websocketDomainVrchat;
|
AppDebug.websocketDomain = AppDebug.websocketDomainVrchat;
|
||||||
}
|
}
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
loginForm.value.loading = true;
|
loginForm.value.loading = true;
|
||||||
|
try {
|
||||||
|
let password = loginParams.password;
|
||||||
if (advancedSettingsStore.enablePrimaryPassword) {
|
if (advancedSettingsStore.enablePrimaryPassword) {
|
||||||
checkPrimaryPassword(loginParams)
|
try {
|
||||||
.then((pwd) => {
|
password = await checkPrimaryPassword(loginParams);
|
||||||
return authRequest
|
} catch (err) {
|
||||||
.getConfig()
|
toast.error('Incorrect primary password');
|
||||||
.catch((err) => {
|
throw err;
|
||||||
reject(err);
|
}
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
authLogin({
|
|
||||||
username: loginParams.username,
|
|
||||||
password: pwd,
|
|
||||||
cipher: loginParams.password,
|
|
||||||
endpoint: loginParams.endpoint,
|
|
||||||
websocket: loginParams.websocket
|
|
||||||
})
|
|
||||||
.catch((err2) => {
|
|
||||||
reject(err2);
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
resolve();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch((_) => {
|
|
||||||
toast.error('Incorrect primary password');
|
|
||||||
reject(_);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
authRequest
|
|
||||||
.getConfig()
|
|
||||||
.catch((err) => {
|
|
||||||
reject(err);
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
authLogin({
|
|
||||||
username: loginParams.username,
|
|
||||||
password: loginParams.password,
|
|
||||||
endpoint: loginParams.endpoint,
|
|
||||||
websocket: loginParams.websocket
|
|
||||||
})
|
|
||||||
.catch((err2) => {
|
|
||||||
handleLogoutEvent();
|
|
||||||
reject(err2);
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
resolve();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}).finally(() => (loginForm.value.loading = false));
|
|
||||||
|
await authRequest.getConfig();
|
||||||
|
try {
|
||||||
|
await authLogin({
|
||||||
|
username: loginParams.username,
|
||||||
|
password,
|
||||||
|
endpoint: loginParams.endpoint,
|
||||||
|
websocket: loginParams.websocket
|
||||||
|
});
|
||||||
|
} catch (err) {
|
||||||
|
await handleLogoutEvent();
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
if (err.message.includes('Invalid Username/Email or Password')) {
|
||||||
|
toast.error('Saved credentials are no longer valid.');
|
||||||
|
await deleteSavedLogin(user.user.id);
|
||||||
|
}
|
||||||
|
throw err;
|
||||||
|
} finally {
|
||||||
|
loginForm.value.loading = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deleteSavedLogin(userId) {
|
async function deleteSavedLogin(userId) {
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
<template>
|
<template>
|
||||||
<div style="float: left; margin: 5px">
|
|
||||||
<TooltipWrapper v-if="!noUpdater" side="top" :content="t('view.login.updater')">
|
|
||||||
<Button class="rounded-full mr-2 text-xs" size="icon-sm" variant="ghost" @click="showVRCXUpdateDialog"
|
|
||||||
><CircleArrowDown
|
|
||||||
/></Button>
|
|
||||||
</TooltipWrapper>
|
|
||||||
<TooltipWrapper side="top" :content="t('view.login.proxy_settings')">
|
|
||||||
<Button class="rounded-full text-xs" size="icon-sm" variant="ghost" @click="promptProxySettings"
|
|
||||||
><Route
|
|
||||||
/></Button>
|
|
||||||
</TooltipWrapper>
|
|
||||||
</div>
|
|
||||||
<div class="x-login-container">
|
<div class="x-login-container">
|
||||||
|
<div style="position: absolute; top: 0; left: 0; margin: 5px">
|
||||||
|
<TooltipWrapper v-if="!noUpdater" side="top" :content="t('view.login.updater')">
|
||||||
|
<Button class="rounded-full mr-2 text-xs" size="icon-sm" variant="ghost" @click="showVRCXUpdateDialog"
|
||||||
|
><CircleArrowDown
|
||||||
|
/></Button>
|
||||||
|
</TooltipWrapper>
|
||||||
|
<TooltipWrapper side="top" :content="t('view.login.proxy_settings')">
|
||||||
|
<Button class="rounded-full text-xs" size="icon-sm" variant="ghost" @click="promptProxySettings"
|
||||||
|
><Route
|
||||||
|
/></Button>
|
||||||
|
</TooltipWrapper>
|
||||||
|
</div>
|
||||||
<div class="x-login">
|
<div class="x-login">
|
||||||
<div class="x-login-form-container">
|
<div class="x-login-form-container">
|
||||||
<div>
|
<div>
|
||||||
@@ -285,6 +285,15 @@
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => loginForm.value.loading,
|
||||||
|
(loading) => {
|
||||||
|
if (!loading) {
|
||||||
|
updateSavedCredentials();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
updateSavedCredentials();
|
updateSavedCredentials();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user