Use correct CSS class in MFA forms, focus code input on error
This commit is contained in:
parent
d49a4196c7
commit
dcc2acfe5d
4 changed files with 22 additions and 2 deletions
|
|
@ -29,6 +29,13 @@ export default {
|
||||||
...mapMutations('authFlow', ['requireTOTP', 'abortMFA']),
|
...mapMutations('authFlow', ['requireTOTP', 'abortMFA']),
|
||||||
...mapActions({ login: 'authFlow/login' }),
|
...mapActions({ login: 'authFlow/login' }),
|
||||||
clearError () { this.error = false },
|
clearError () { this.error = false },
|
||||||
|
|
||||||
|
focusOnCodeInput () {
|
||||||
|
const codeInput = this.$refs.codeInput
|
||||||
|
codeInput.focus()
|
||||||
|
codeInput.setSelectionRange(0, codeInput.value.length)
|
||||||
|
},
|
||||||
|
|
||||||
submit () {
|
submit () {
|
||||||
const { clientId, clientSecret } = this.oauthStore
|
const { clientId, clientSecret } = this.oauthStore
|
||||||
|
|
||||||
|
|
@ -44,6 +51,7 @@ export default {
|
||||||
if (result.error) {
|
if (result.error) {
|
||||||
this.error = result.error
|
this.error = result.error
|
||||||
this.code = null
|
this.code = null
|
||||||
|
this.focusOnCodeInput()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="login panel panel-default">
|
<div class="login-panel panel panel-default">
|
||||||
<!-- Default panel contents -->
|
<!-- Default panel contents -->
|
||||||
|
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
<label for="code">{{ $t('login.recovery_code') }}</label>
|
<label for="code">{{ $t('login.recovery_code') }}</label>
|
||||||
<input
|
<input
|
||||||
id="code"
|
id="code"
|
||||||
|
ref="codeInput"
|
||||||
v-model="code"
|
v-model="code"
|
||||||
class="input form-control"
|
class="input form-control"
|
||||||
>
|
>
|
||||||
|
|
@ -71,4 +72,5 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script src="./recovery_form.js"></script>
|
<script src="./recovery_form.js"></script>
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,13 @@ export default {
|
||||||
...mapMutations('authFlow', ['requireRecovery', 'abortMFA']),
|
...mapMutations('authFlow', ['requireRecovery', 'abortMFA']),
|
||||||
...mapActions({ login: 'authFlow/login' }),
|
...mapActions({ login: 'authFlow/login' }),
|
||||||
clearError () { this.error = false },
|
clearError () { this.error = false },
|
||||||
|
|
||||||
|
focusOnCodeInput () {
|
||||||
|
const codeInput = this.$refs.codeInput
|
||||||
|
codeInput.focus()
|
||||||
|
codeInput.setSelectionRange(0, codeInput.value.length)
|
||||||
|
},
|
||||||
|
|
||||||
submit () {
|
submit () {
|
||||||
const { clientId, clientSecret } = this.oauthStore
|
const { clientId, clientSecret } = this.oauthStore
|
||||||
|
|
||||||
|
|
@ -44,6 +51,7 @@ export default {
|
||||||
if (result.error) {
|
if (result.error) {
|
||||||
this.error = result.error
|
this.error = result.error
|
||||||
this.code = null
|
this.code = null
|
||||||
|
this.focusOnCodeInput()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="login panel panel-default">
|
<div class="login-panel panel panel-default">
|
||||||
<!-- Default panel contents -->
|
<!-- Default panel contents -->
|
||||||
|
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
id="code"
|
id="code"
|
||||||
|
ref="codeInput"
|
||||||
v-model="code"
|
v-model="code"
|
||||||
class="input form-control"
|
class="input form-control"
|
||||||
>
|
>
|
||||||
|
|
@ -74,4 +75,5 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script src="./totp_form.js"></script>
|
<script src="./totp_form.js"></script>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue