Work around browsers preventing Vue bindings from working with autofill (Fixes #78)
This commit is contained in:
parent
724275e653
commit
27e2839f4c
1 changed files with 8 additions and 9 deletions
|
@ -9,13 +9,13 @@
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="label" for="username">Username</label>
|
<label class="label" for="username">Username</label>
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<input v-focus type="text" id="username" class="input" name="username" placeholder="e.g. frederick" v-model="credentials.username" required/>
|
<input v-focus type="text" id="username" class="input" name="username" placeholder="e.g. frederick" ref="username" required/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="label" for="password">Password</label>
|
<label class="label" for="password">Password</label>
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<input type="password" class="input" id="password" name="password" placeholder="e.g. ••••••••••••" v-model="credentials.password" required/>
|
<input type="password" class="input" id="password" name="password" placeholder="e.g. ••••••••••••" ref="password" required/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -43,10 +43,6 @@
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
credentials: {
|
|
||||||
username: '',
|
|
||||||
password: ''
|
|
||||||
},
|
|
||||||
errorMsg: '',
|
errorMsg: '',
|
||||||
confirmedEmailSuccess: false,
|
confirmedEmailSuccess: false,
|
||||||
loading: false
|
loading: false
|
||||||
|
@ -79,9 +75,12 @@
|
||||||
submit() {
|
submit() {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
this.errorMsg = ''
|
this.errorMsg = ''
|
||||||
let credentials = {
|
// Some browsers prevent Vue bindings from working with autofilled values.
|
||||||
username: this.credentials.username,
|
// To work around this, we're manually getting the values here instead of relying on vue bindings.
|
||||||
password: this.credentials.password
|
// For more info, see https://kolaente.dev/vikunja/frontend/issues/78
|
||||||
|
const credentials = {
|
||||||
|
username: this.$refs.username.value,
|
||||||
|
password: this.$refs.password.value,
|
||||||
}
|
}
|
||||||
|
|
||||||
auth.login(this, credentials, 'home')
|
auth.login(this, credentials, 'home')
|
||||||
|
|
Loading…
Reference in a new issue