|
69 | 69 | await createChallenge(AuthenticationFactor.Phone);
|
70 | 70 | } else if (factors.email) {
|
71 | 71 | await createChallenge(AuthenticationFactor.Email);
|
| 72 | + } else if (factors.totp) { |
| 73 | + challengeType = AuthenticationFactor.Totp; |
72 | 74 | }
|
73 | 75 | }
|
74 | 76 | });
|
|
98 | 100 | {#if enabledFactors.length > 1}
|
99 | 101 | <span class="with-separators eyebrow-heading-3">or</span>
|
100 | 102 | <div class="u-flex-vertical u-gap-8">
|
101 |
| - {#if factors.totp && challengeType !== null && challengeType !== AuthenticationFactor.Totp} |
102 |
| - <Button |
103 |
| - secondary |
104 |
| - fullWidth |
105 |
| - {disabled} |
106 |
| - on:click={() => createChallenge(AuthenticationFactor.Totp)}> |
107 |
| - <Icon icon={IconDeviceMobile} slot="start" size="s" /> |
108 |
| - Authenticator app |
109 |
| - </Button> |
110 |
| - {/if} |
111 |
| - {#if factors.email && challengeType !== AuthenticationFactor.Email} |
112 |
| - <Button |
113 |
| - secondary |
114 |
| - fullWidth |
115 |
| - {disabled} |
116 |
| - on:click={() => createChallenge(AuthenticationFactor.Email)}> |
117 |
| - <Icon icon={IconMail} slot="start" size="s" /> |
118 |
| - Email verification |
119 |
| - </Button> |
120 |
| - {/if} |
121 |
| - {#if factors.phone && challengeType !== AuthenticationFactor.Phone} |
122 |
| - <Button |
123 |
| - secondary |
124 |
| - fullWidth |
125 |
| - {disabled} |
126 |
| - on:click={() => createChallenge(AuthenticationFactor.Phone)}> |
127 |
| - <Icon icon={IconChatAlt} slot="start" size="s" /> |
128 |
| - Phone verification |
129 |
| - </Button> |
| 103 | + {#if factors.totp} |
| 104 | + {#if (challengeType === null || challengeType === AuthenticationFactor.Totp || challengeType === AuthenticationFactor.Recoverycode) && factors.email} |
| 105 | + <Button |
| 106 | + secondary |
| 107 | + fullWidth |
| 108 | + {disabled} |
| 109 | + on:click={() => createChallenge(AuthenticationFactor.Email)}> |
| 110 | + <Icon icon={IconMail} slot="start" size="s" /> |
| 111 | + Email verification |
| 112 | + </Button> |
| 113 | + {:else if (challengeType === AuthenticationFactor.Recoverycode && !factors.email) || challengeType === AuthenticationFactor.Email} |
| 114 | + <Button |
| 115 | + secondary |
| 116 | + fullWidth |
| 117 | + {disabled} |
| 118 | + on:click={() => createChallenge(AuthenticationFactor.Totp)}> |
| 119 | + <Icon icon={IconDeviceMobile} slot="start" size="s" /> |
| 120 | + Authenticator app |
| 121 | + </Button> |
| 122 | + {/if} |
| 123 | + {:else} |
| 124 | + {#if factors.email && challengeType !== AuthenticationFactor.Email} |
| 125 | + <Button |
| 126 | + secondary |
| 127 | + fullWidth |
| 128 | + {disabled} |
| 129 | + on:click={() => createChallenge(AuthenticationFactor.Email)}> |
| 130 | + <Icon icon={IconMail} slot="start" size="s" /> |
| 131 | + Email verification |
| 132 | + </Button> |
| 133 | + {/if} |
| 134 | + {#if factors.phone && challengeType !== AuthenticationFactor.Phone} |
| 135 | + <Button |
| 136 | + secondary |
| 137 | + fullWidth |
| 138 | + {disabled} |
| 139 | + on:click={() => createChallenge(AuthenticationFactor.Phone)}> |
| 140 | + <Icon icon={IconChatAlt} slot="start" size="s" /> |
| 141 | + Phone verification |
| 142 | + </Button> |
| 143 | + {/if} |
130 | 144 | {/if}
|
131 | 145 | {#if factors.recoveryCode && challengeType !== AuthenticationFactor.Recoverycode}
|
132 | 146 | <Button
|
|
0 commit comments