Fix password is always saved issue #130
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
{{ $t('welcome.greeting') }}
|
{{ $t('welcome.greeting') }}
|
||||||
</h1>
|
</h1>
|
||||||
</header>
|
</header>
|
||||||
<form @submit.prevent="save" class="mt-4">
|
<form @submit.prevent="login" class="mt-4">
|
||||||
<div class="mb-2">
|
<div class="mb-2">
|
||||||
<label for="usernameInput" class="form-label">{{ $t('_common.username') }}</label>
|
<label for="usernameInput" class="form-label">{{ $t('_common.username') }}</label>
|
||||||
<input type="text" class="form-control" id="usernameInput" autocomplete="username"
|
<input type="text" class="form-control" id="usernameInput" autocomplete="username"
|
||||||
@@ -82,9 +82,12 @@
|
|||||||
return data
|
return data
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
save() {
|
login() {
|
||||||
this.error = null;
|
this.error = null;
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
if (!this.savePassword) {
|
||||||
|
localStorage.removeItem('login')
|
||||||
|
}
|
||||||
fetch("./api/login", {
|
fetch("./api/login", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify(this.passwordData),
|
body: JSON.stringify(this.passwordData),
|
||||||
@@ -92,7 +95,9 @@
|
|||||||
this.loading = false;
|
this.loading = false;
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
this.success = true;
|
this.success = true;
|
||||||
|
if (this.savePassword) {
|
||||||
localStorage.setItem('login', JSON.stringify(this.passwordData));
|
localStorage.setItem('login', JSON.stringify(this.passwordData));
|
||||||
|
}
|
||||||
const url = new URL(window.location);
|
const url = new URL(window.location);
|
||||||
const redirectUrl = url.searchParams.get('redir');
|
const redirectUrl = url.searchParams.get('redir');
|
||||||
const hash = url.hash;
|
const hash = url.hash;
|
||||||
|
|||||||
Reference in New Issue
Block a user