2019-01-21 15:08:22 +01:00
|
|
|
<template>
|
2019-12-20 13:04:34 +01:00
|
|
|
<section class="section container">
|
2019-10-10 14:20:09 +02:00
|
|
|
<div class="columns is-mobile is-centered">
|
|
|
|
<div class="column is-half-desktop">
|
|
|
|
<h1 class="title">
|
2020-02-18 08:57:00 +01:00
|
|
|
{{ $t("Resend confirmation email") }}
|
2019-10-10 14:20:09 +02:00
|
|
|
</h1>
|
|
|
|
<form v-if="!validationSent" @submit="resendConfirmationAction">
|
2020-06-18 16:01:14 +02:00
|
|
|
<b-field :label="$t('Email address')">
|
2020-02-18 08:57:00 +01:00
|
|
|
<b-input aria-required="true" required type="email" v-model="credentials.email" />
|
2019-10-10 14:20:09 +02:00
|
|
|
</b-field>
|
2020-06-18 16:01:14 +02:00
|
|
|
<p class="control">
|
2019-10-13 17:03:48 +02:00
|
|
|
<b-button type="is-primary" native-type="submit">
|
2020-06-18 16:01:14 +02:00
|
|
|
{{ $t("Send the confirmation email again") }}
|
2019-10-10 14:20:09 +02:00
|
|
|
</b-button>
|
2020-06-18 16:01:14 +02:00
|
|
|
<router-link :to="{ name: RouteName.LOGIN }" class="button is-text">{{
|
|
|
|
$t("Cancel")
|
|
|
|
}}</router-link>
|
2019-10-10 14:20:09 +02:00
|
|
|
</p>
|
|
|
|
</form>
|
|
|
|
<div v-else>
|
|
|
|
<b-message type="is-success" :closable="false" title="Success">
|
2020-02-18 08:57:00 +01:00
|
|
|
{{
|
|
|
|
$t(
|
|
|
|
"If an account with this email exists, we just sent another confirmation email to {email}",
|
|
|
|
{ email: credentials.email }
|
|
|
|
)
|
|
|
|
}}
|
2019-10-10 14:20:09 +02:00
|
|
|
</b-message>
|
|
|
|
<b-message type="is-info">
|
|
|
|
{{ $t("Please check your spam folder if you didn't receive the email.") }}
|
|
|
|
</b-message>
|
|
|
|
</div>
|
2019-01-21 15:08:22 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-02-18 08:57:00 +01:00
|
|
|
import { Component, Prop, Vue } from "vue-property-decorator";
|
|
|
|
import { validateEmailField, validateRequiredField } from "../../utils/validators";
|
|
|
|
import { RESEND_CONFIRMATION_EMAIL } from "../../graphql/auth";
|
2020-06-18 16:01:14 +02:00
|
|
|
import RouteName from "../../router/name";
|
2019-01-21 15:08:22 +01:00
|
|
|
|
|
|
|
@Component
|
|
|
|
export default class ResendConfirmation extends Vue {
|
2020-02-18 08:57:00 +01:00
|
|
|
@Prop({ type: String, required: false, default: "" }) email!: string;
|
2019-01-21 15:08:22 +01:00
|
|
|
|
|
|
|
credentials = {
|
2020-02-18 08:57:00 +01:00
|
|
|
email: "",
|
2019-01-21 15:08:22 +01:00
|
|
|
};
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2019-01-21 15:08:22 +01:00
|
|
|
validationSent = false;
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2019-01-21 15:08:22 +01:00
|
|
|
error = false;
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2020-06-18 16:01:14 +02:00
|
|
|
RouteName = RouteName;
|
|
|
|
|
2019-01-21 15:08:22 +01:00
|
|
|
state = {
|
|
|
|
email: {
|
|
|
|
status: null,
|
2020-02-18 08:57:00 +01:00
|
|
|
msg: "",
|
2019-03-22 10:57:14 +01:00
|
|
|
},
|
2019-01-21 15:08:22 +01:00
|
|
|
};
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2019-01-21 15:08:22 +01:00
|
|
|
rules = {
|
|
|
|
required: validateRequiredField,
|
2019-03-22 10:57:14 +01:00
|
|
|
email: validateEmailField,
|
2019-01-21 15:08:22 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
mounted() {
|
|
|
|
this.credentials.email = this.email;
|
|
|
|
}
|
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
async resendConfirmationAction(e: Event) {
|
2019-01-21 15:08:22 +01:00
|
|
|
e.preventDefault();
|
|
|
|
this.error = false;
|
|
|
|
|
|
|
|
try {
|
|
|
|
await this.$apollo.mutate({
|
|
|
|
mutation: RESEND_CONFIRMATION_EMAIL,
|
|
|
|
variables: {
|
2019-03-22 10:57:14 +01:00
|
|
|
email: this.credentials.email,
|
|
|
|
},
|
2019-01-21 15:08:22 +01:00
|
|
|
});
|
|
|
|
} catch (err) {
|
|
|
|
console.error(err);
|
|
|
|
this.error = true;
|
|
|
|
} finally {
|
|
|
|
this.validationSent = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
2019-10-10 14:20:09 +02:00
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2020-02-18 08:57:00 +01:00
|
|
|
.container .columns {
|
|
|
|
margin: 1rem auto 3rem;
|
|
|
|
}
|
|
|
|
</style>
|