diff --git a/app/assets/javascripts/sessions/new/components/email_verification.vue b/app/assets/javascripts/sessions/new/components/email_verification.vue index 02f0d3c2f96e3d7d58ac35a0bd100ff0b44bd9df..e958ad723ccb0de02b32724927a49db315a8f37f 100644 --- a/app/assets/javascripts/sessions/new/components/email_verification.vue +++ b/app/assets/javascripts/sessions/new/components/email_verification.vue @@ -11,11 +11,13 @@ import { I18N_EMAIL_INVALID_CODE, I18N_SUBMIT_BUTTON, I18N_RESEND_LINK, + I18N_SKIP_FOR_NOW_BUTTON, I18N_EMAIL_RESEND_SUCCESS, I18N_GENERIC_ERROR, I18N_HELP_TEXT, I18N_SEND_TO_SECONDARY_EMAIL_BUTTON_TEXT, I18N_SEND_TO_SECONDARY_EMAIL_GUIDE, + I18N_DIDNT_GET_CODE, SUPPORT_URL, VERIFICATION_CODE_REGEX, SUCCESS_RESPONSE, @@ -55,6 +57,15 @@ export default { type: String, required: true, }, + skipPath: { + type: String, + required: true, + }, + permittedToSkipEmailOtpInGracePeriod: { + type: Boolean, + required: true, + default: false, + }, }, data() { return { @@ -87,6 +98,9 @@ export default { return this.verifyError; }, + showSkipButton() { + return this.permittedToSkipEmailOtpInGracePeriod; + }, }, watch: { verificationCode() { @@ -124,6 +138,20 @@ export default { this.verifyToken(email); this.resend(email); }, + skip() { + if (!this.skipPath) return; + + axios.post(this.skipPath).then(this.handleSkipResponse).catch(this.handleError); + }, + handleSkipResponse(response) { + if (response.data.status === undefined) { + this.handleError(); + } else if (response.data.status === SUCCESS_RESPONSE) { + visitUrl(response.data.redirect_path); + } else if (response.data.status === FAILURE_RESPONSE) { + createAlert({ message: response.data.message }); + } + }, handleResendResponse(response) { if (response.data.status === undefined) { this.handleError(); @@ -162,7 +190,9 @@ export default { helpText: I18N_HELP_TEXT, sendToSecondaryEmailButtonText: I18N_SEND_TO_SECONDARY_EMAIL_BUTTON_TEXT, sendToSecondaryEmailGuide: I18N_SEND_TO_SECONDARY_EMAIL_GUIDE, + skipForNowButton: I18N_SKIP_FOR_NOW_BUTTON, supportUrl: SUPPORT_URL, + didntGetCode: I18N_DIDNT_GET_CODE, }, forms: { verifyTokenForm: VERIFY_TOKEN_FORM, @@ -194,6 +224,7 @@ export default { label-for="verification-code" :state="inputValidation.state" :invalid-feedback="inputValidation.message" + class="gl-mb-1" > + + +
+ {{ $options.i18n.didntGetCode }} + {{ + $options.i18n.resendLink + }} +
+
{{ $options.i18n.submitButton }} - {{ - $options.i18n.resendLink - }} + + + + {{ $options.i18n.skipForNowButton }} +
+