Merge branch 'fix-mfa' into 'develop'
Fix MFA forms See merge request pleroma/pleroma-fe!2105
This commit is contained in:
commit
1272c3e905
5 changed files with 30 additions and 6 deletions
0
changelog.d/pinia-oauth-mfa.skip
Normal file
0
changelog.d/pinia-oauth-mfa.skip
Normal file
|
@ -1,5 +1,7 @@
|
|||
import mfaApi from '../../services/new_api/mfa.js'
|
||||
import { mapState, mapGetters, mapActions, mapMutations } from 'vuex'
|
||||
import { mapStores } from 'pinia'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
import {
|
||||
faTimes
|
||||
|
@ -18,17 +20,24 @@ export default {
|
|||
...mapGetters({
|
||||
authSettings: 'authFlow/settings'
|
||||
}),
|
||||
...mapStores(useOAuthStore),
|
||||
...mapState({
|
||||
instance: 'instance',
|
||||
oauth: 'oauth'
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
...mapMutations('authFlow', ['requireTOTP', 'abortMFA']),
|
||||
...mapActions({ login: 'authFlow/login' }),
|
||||
clearError () { this.error = false },
|
||||
|
||||
focusOnCodeInput () {
|
||||
const codeInput = this.$refs.codeInput
|
||||
codeInput.focus()
|
||||
codeInput.setSelectionRange(0, codeInput.value.length)
|
||||
},
|
||||
|
||||
submit () {
|
||||
const { clientId, clientSecret } = this.oauth
|
||||
const { clientId, clientSecret } = this.oauthStore
|
||||
|
||||
const data = {
|
||||
clientId,
|
||||
|
@ -42,6 +51,7 @@ export default {
|
|||
if (result.error) {
|
||||
this.error = result.error
|
||||
this.code = null
|
||||
this.focusOnCodeInput()
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div class="login panel panel-default">
|
||||
<div class="login-panel panel panel-default">
|
||||
<!-- Default panel contents -->
|
||||
|
||||
<div class="panel-heading">
|
||||
|
@ -17,6 +17,7 @@
|
|||
<label for="code">{{ $t('login.recovery_code') }}</label>
|
||||
<input
|
||||
id="code"
|
||||
ref="codeInput"
|
||||
v-model="code"
|
||||
class="input form-control"
|
||||
>
|
||||
|
@ -71,4 +72,5 @@
|
|||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script src="./recovery_form.js"></script>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import mfaApi from '../../services/new_api/mfa.js'
|
||||
import { mapState, mapGetters, mapActions, mapMutations } from 'vuex'
|
||||
import { mapStores } from 'pinia'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
import {
|
||||
faTimes
|
||||
|
@ -18,17 +20,24 @@ export default {
|
|||
...mapGetters({
|
||||
authSettings: 'authFlow/settings'
|
||||
}),
|
||||
...mapStores(useOAuthStore),
|
||||
...mapState({
|
||||
instance: 'instance',
|
||||
oauth: 'oauth'
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
...mapMutations('authFlow', ['requireRecovery', 'abortMFA']),
|
||||
...mapActions({ login: 'authFlow/login' }),
|
||||
clearError () { this.error = false },
|
||||
|
||||
focusOnCodeInput () {
|
||||
const codeInput = this.$refs.codeInput
|
||||
codeInput.focus()
|
||||
codeInput.setSelectionRange(0, codeInput.value.length)
|
||||
},
|
||||
|
||||
submit () {
|
||||
const { clientId, clientSecret } = this.oauth
|
||||
const { clientId, clientSecret } = this.oauthStore
|
||||
|
||||
const data = {
|
||||
clientId,
|
||||
|
@ -42,6 +51,7 @@ export default {
|
|||
if (result.error) {
|
||||
this.error = result.error
|
||||
this.code = null
|
||||
this.focusOnCodeInput()
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div class="login panel panel-default">
|
||||
<div class="login-panel panel panel-default">
|
||||
<!-- Default panel contents -->
|
||||
|
||||
<div class="panel-heading">
|
||||
|
@ -19,6 +19,7 @@
|
|||
</label>
|
||||
<input
|
||||
id="code"
|
||||
ref="codeInput"
|
||||
v-model="code"
|
||||
class="input form-control"
|
||||
>
|
||||
|
@ -74,4 +75,5 @@
|
|||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script src="./totp_form.js"></script>
|
||||
|
|
Loading…
Add table
Reference in a new issue