2019-01-21 15:08:22 +01:00
|
|
|
<template>
|
|
|
|
<section class="columns">
|
|
|
|
<div class="column card">
|
|
|
|
<h1 class="title">
|
|
|
|
<translate>Resend confirmation email</translate>
|
|
|
|
</h1>
|
|
|
|
<form v-if="!validationSent" @submit="resendConfirmationAction">
|
|
|
|
<b-field label="Email">
|
|
|
|
<b-input aria-required="true" required type="email" v-model="credentials.email"/>
|
|
|
|
</b-field>
|
|
|
|
<button class="button is-primary">
|
|
|
|
<translate>Send confirmation email again</translate>
|
|
|
|
</button>
|
|
|
|
</form>
|
|
|
|
<div v-else>
|
|
|
|
<b-message type="is-success" :closable="false" title="Success">
|
|
|
|
<translate
|
|
|
|
:translate-params="{email: credentials.email}"
|
|
|
|
>If an account with this email exists, we just sent another confirmation email to %{email}</translate>
|
|
|
|
</b-message>
|
|
|
|
<b-message type="is-info">
|
|
|
|
<translate>Please check you spam folder if you didn't receive the email.</translate>
|
|
|
|
</b-message>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2019-03-22 10:57:14 +01:00
|
|
|
import { Component, Prop, Vue } from 'vue-property-decorator';
|
|
|
|
import { validateEmailField, validateRequiredField } from '@/utils/validators';
|
|
|
|
import { RESEND_CONFIRMATION_EMAIL } from '@/graphql/auth';
|
2019-01-21 15:08:22 +01:00
|
|
|
|
|
|
|
@Component
|
|
|
|
export default class ResendConfirmation extends Vue {
|
2019-03-22 10:57:14 +01:00
|
|
|
@Prop({ type: String, required: false, default: '' }) email!: string;
|
2019-01-21 15:08:22 +01:00
|
|
|
|
|
|
|
credentials = {
|
2019-03-22 10:57:14 +01:00
|
|
|
email: '',
|
2019-01-21 15:08:22 +01:00
|
|
|
};
|
|
|
|
validationSent = false;
|
|
|
|
error = false;
|
|
|
|
state = {
|
|
|
|
email: {
|
|
|
|
status: null,
|
2019-03-22 10:57:14 +01:00
|
|
|
msg: '',
|
|
|
|
},
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
async resendConfirmationAction(e) {
|
|
|
|
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>
|