|
110 | 110 | </v-alert>
|
111 | 111 |
|
112 | 112 | <div v-if="screen === 'verification'">
|
113 |
| - <div class="text-center mb-4"> |
| 113 | + |
| 114 | + <div v-if="verificationMethod === 'totp'" class="text-center mb-4"> |
114 | 115 | Open the two-step verification app on your mobile device to
|
115 | 116 | get your verification code.
|
116 | 117 | </div>
|
117 | 118 |
|
| 119 | + <div v-else-if="verificationMethod === 'email'" class="text-center mb-4"> |
| 120 | + Check your email for the verification code we just sent you. |
| 121 | + </div> |
| 122 | + |
118 | 123 | <v-otp-input
|
119 | 124 | v-model="verificationCode"
|
120 | 125 | length="6"
|
|
126 | 131 | <div class="text-center">
|
127 | 132 | <a @click="signOut()" class="mr-6">{{ $t('Return to login') }}</a>
|
128 | 133 | <a
|
129 |
| - v-if="authMethods.totp && authMethods.totp.allow_recovery" |
| 134 | + v-if="verificationMethod === 'totp' |
| 135 | + && authMethods.totp |
| 136 | + && authMethods.totp.allow_recovery" |
130 | 137 | @click="screen = 'recovery'"
|
131 | 138 | >
|
132 | 139 | {{ $t('Use recovery code') }}
|
133 | 140 | </a>
|
| 141 | + |
| 142 | + <a |
| 143 | + v-if="verificationMethod === 'email'" |
| 144 | + @click="resendEmailVerification()" |
| 145 | + > |
| 146 | + {{ $t('Resend code to email') }} |
| 147 | + </a> |
134 | 148 | </div>
|
135 | 149 | </div>
|
136 | 150 |
|
|
265 | 279 | height: 100vh;
|
266 | 280 | background: #80808024;
|
267 | 281 | }
|
| 282 | +.auth { |
| 283 | + background-image: url("../assets/background.svg"); |
| 284 | + background-color: #005057; |
| 285 | + background-size: cover; |
| 286 | +} |
268 | 287 | </style>
|
269 | 288 | <script>
|
270 | 289 | import axios from 'axios';
|
@@ -316,6 +335,10 @@ export default {
|
316 | 335 | },
|
317 | 336 |
|
318 | 337 | methods: {
|
| 338 | + async resendEmailVerification() { |
| 339 | + // TODO: resend email verification code |
| 340 | + }, |
| 341 | +
|
319 | 342 | async loadLoginData() {
|
320 | 343 | await axios({
|
321 | 344 | method: 'get',
|
@@ -393,6 +416,11 @@ export default {
|
393 | 416 | status: 'unverified',
|
394 | 417 | verificationMethod: 'totp',
|
395 | 418 | };
|
| 419 | + case 'EMAIL_OTP_REQUIRED': |
| 420 | + return { |
| 421 | + status: 'unverified', |
| 422 | + verificationMethod: 'email', |
| 423 | + }; |
396 | 424 | default:
|
397 | 425 | return { status: 'unauthenticated' };
|
398 | 426 | }
|
@@ -422,11 +450,12 @@ export default {
|
422 | 450 | });
|
423 | 451 | document.location = document.baseURI + window.location.search;
|
424 | 452 | } catch (err) {
|
425 |
| - if (err.response.status === 401) { |
426 |
| - this.signInError = this.$t('Incorrect verification code.'); |
427 |
| - } else { |
428 |
| - this.signInError = getErrorMessage(err); |
429 |
| - } |
| 453 | + this.signInError = getErrorMessage(err); |
| 454 | + // if (err.response.status === 401) { |
| 455 | + // this.signInError = this.$t('Incorrect verification code.'); |
| 456 | + // } else { |
| 457 | + // this.signInError = getErrorMessage(err); |
| 458 | + // } |
430 | 459 | } finally {
|
431 | 460 | this.signInProcess = false;
|
432 | 461 | }
|
|
0 commit comments