aboutsummaryrefslogtreecommitdiff
path: root/src/components/auth_form/auth_form.js
blob: e9a6e2d5078971cbacd64dd6263660460c2b15a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import LoginForm from '../login_form/login_form.vue'
import MFARecoveryForm from '../mfa_form/recovery_form.vue'
import MFATOTPForm from '../mfa_form/totp_form.vue'
import { mapGetters } from 'vuex'

const AuthForm = {
  name: 'AuthForm',
  render (createElement) {
    return createElement('component', { is: this.authForm })
  },
  computed: {
    authForm () {
      if (this.requiredTOTP) { return 'MFATOTPForm' }
      if (this.requiredRecovery) { return 'MFARecoveryForm' }
      return 'LoginForm'
    },
    ...mapGetters('authFlow', ['requiredTOTP', 'requiredRecovery'])
  },
  components: {
    MFARecoveryForm,
    MFATOTPForm,
    LoginForm
  }
}

export default AuthForm