2019-01-29 11:02:32 +01:00
|
|
|
<template>
|
2019-12-20 13:04:34 +01:00
|
|
|
<div class="section container">
|
2019-01-29 11:02:32 +01:00
|
|
|
<section class="hero">
|
|
|
|
<div class="hero-body">
|
2020-02-18 08:57:00 +01:00
|
|
|
<h1 class="title">{{ $t("Register an account on Mobilizon!") }}</h1>
|
2020-06-15 11:01:49 +02:00
|
|
|
<i18n tag="p" path="{instanceName} is an instance of the {mobilizon} software.">
|
|
|
|
<b slot="instanceName">{{ config.name }}</b>
|
|
|
|
<a href="https://joinmobilizon.org" target="_blank" slot="mobilizon">{{
|
|
|
|
$t("Mobilizon")
|
|
|
|
}}</a>
|
|
|
|
</i18n>
|
2019-01-29 11:02:32 +01:00
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
<section>
|
2019-10-05 19:07:50 +02:00
|
|
|
<div class="columns">
|
|
|
|
<div class="column">
|
2020-02-18 08:47:41 +01:00
|
|
|
<div>
|
2020-02-18 08:57:00 +01:00
|
|
|
<subtitle>{{ $t("Features") }}</subtitle>
|
2020-02-18 08:47:41 +01:00
|
|
|
<div class="content">
|
|
|
|
<ul>
|
2020-02-18 08:57:00 +01:00
|
|
|
<li>{{ $t("Create and manage several identities from the same account") }}</li>
|
|
|
|
<li>{{ $t("Create, edit or delete events") }}</li>
|
|
|
|
<li>{{ $t("Register for an event by choosing one of your identities") }}</li>
|
2020-02-18 08:47:41 +01:00
|
|
|
</ul>
|
|
|
|
</div>
|
2019-01-29 11:02:32 +01:00
|
|
|
</div>
|
2020-02-18 08:57:00 +01:00
|
|
|
<router-link :to="{ name: RouteName.ABOUT }">{{ $t("Learn more") }}</router-link>
|
|
|
|
<hr />
|
2019-10-05 19:07:50 +02:00
|
|
|
<div class="content">
|
2020-02-18 08:57:00 +01:00
|
|
|
<subtitle>{{ $t("About this instance") }}</subtitle>
|
2020-06-15 11:01:49 +02:00
|
|
|
<div class="content" v-html="config.description"></div>
|
|
|
|
<i18n path="Please read the instance's {fullRules}" tag="p">
|
|
|
|
<router-link slot="fullRules" :to="{ name: RouteName.RULES }">{{
|
|
|
|
$t("full rules")
|
|
|
|
}}</router-link>
|
|
|
|
</i18n>
|
2019-10-05 19:07:50 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="column">
|
2020-02-18 08:57:00 +01:00
|
|
|
<b-message type="is-warning" v-if="config.registrationsWhitelist">
|
|
|
|
{{ $t("Registrations are restricted by whitelisting.") }}
|
|
|
|
</b-message>
|
2019-10-07 13:47:46 +02:00
|
|
|
<form v-on:submit.prevent="submit()">
|
2019-10-05 19:07:50 +02:00
|
|
|
<b-field
|
|
|
|
:label="$t('Email')"
|
|
|
|
:type="errors.email ? 'is-danger' : null"
|
|
|
|
:message="errors.email"
|
2020-02-18 08:57:00 +01:00
|
|
|
label-for="email"
|
2019-10-05 19:07:50 +02:00
|
|
|
>
|
|
|
|
<b-input
|
|
|
|
aria-required="true"
|
|
|
|
required
|
2020-02-18 08:57:00 +01:00
|
|
|
id="email"
|
2019-10-05 19:07:50 +02:00
|
|
|
type="email"
|
|
|
|
v-model="credentials.email"
|
|
|
|
@blur="showGravatar = true"
|
|
|
|
@focus="showGravatar = false"
|
|
|
|
/>
|
|
|
|
</b-field>
|
2019-01-29 11:02:32 +01:00
|
|
|
|
2019-10-05 19:07:50 +02:00
|
|
|
<b-field
|
|
|
|
:label="$t('Password')"
|
|
|
|
:type="errors.password ? 'is-danger' : null"
|
|
|
|
:message="errors.password"
|
2020-02-18 08:57:00 +01:00
|
|
|
label-for="password"
|
2019-10-05 19:07:50 +02:00
|
|
|
>
|
|
|
|
<b-input
|
|
|
|
aria-required="true"
|
|
|
|
required
|
2020-02-18 08:57:00 +01:00
|
|
|
id="password"
|
2019-10-05 19:07:50 +02:00
|
|
|
type="password"
|
|
|
|
password-reveal
|
|
|
|
minlength="6"
|
|
|
|
v-model="credentials.password"
|
|
|
|
/>
|
|
|
|
</b-field>
|
2019-01-29 11:02:32 +01:00
|
|
|
|
2020-06-15 11:01:49 +02:00
|
|
|
<b-checkbox required>
|
|
|
|
<i18n tag="span" path="I agree to the {instanceRules} and {termsOfService}">
|
|
|
|
<router-link slot="instanceRules" :to="{ name: RouteName.RULES }">{{
|
|
|
|
$t("instance rules")
|
|
|
|
}}</router-link>
|
|
|
|
<router-link slot="termsOfService" :to="{ name: RouteName.TERMS }">{{
|
|
|
|
$t("terms of service")
|
|
|
|
}}</router-link>
|
|
|
|
</i18n>
|
|
|
|
</b-checkbox>
|
|
|
|
|
2019-10-10 14:20:09 +02:00
|
|
|
<p class="control has-text-centered">
|
2020-06-15 11:01:49 +02:00
|
|
|
<b-button
|
|
|
|
type="is-primary"
|
|
|
|
size="is-large"
|
|
|
|
:disabled="sendingForm"
|
|
|
|
native-type="submit"
|
|
|
|
>
|
|
|
|
{{ $t("Register") }}
|
|
|
|
</b-button>
|
2019-10-10 14:20:09 +02:00
|
|
|
</p>
|
|
|
|
<p class="control">
|
|
|
|
<router-link
|
|
|
|
class="button is-text"
|
2020-02-18 08:57:00 +01:00
|
|
|
:to="{ name: RouteName.RESEND_CONFIRMATION, params: { email: credentials.email } }"
|
|
|
|
>{{ $t("Didn't receive the instructions ?") }}</router-link
|
2019-10-10 14:20:09 +02:00
|
|
|
>
|
|
|
|
</p>
|
|
|
|
<p class="control">
|
|
|
|
<router-link
|
|
|
|
class="button is-text"
|
2020-02-18 08:57:00 +01:00
|
|
|
:to="{
|
|
|
|
name: RouteName.LOGIN,
|
|
|
|
params: { email: credentials.email, password: credentials.password },
|
|
|
|
}"
|
|
|
|
>{{ $t("Login") }}</router-link
|
2019-10-10 14:20:09 +02:00
|
|
|
>
|
|
|
|
</p>
|
2019-10-05 19:07:50 +02:00
|
|
|
</form>
|
2019-01-29 11:02:32 +01:00
|
|
|
|
2019-10-05 19:07:50 +02:00
|
|
|
<div v-if="errors.length > 0">
|
|
|
|
<b-message type="is-danger" v-for="error in errors" :key="error">{{ error }}</b-message>
|
2019-01-29 11:02:32 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-02-18 08:57:00 +01:00
|
|
|
import { Component, Prop, Vue } from "vue-property-decorator";
|
|
|
|
import { CREATE_USER } from "../../graphql/user";
|
|
|
|
import RouteName from "../../router/name";
|
|
|
|
import { IConfig } from "../../types/config.model";
|
|
|
|
import { CONFIG } from "../../graphql/config";
|
|
|
|
import Subtitle from "../../components/Utils/Subtitle.vue";
|
2019-01-29 11:02:32 +01:00
|
|
|
|
2019-10-10 16:47:38 +02:00
|
|
|
@Component({
|
2020-02-18 08:47:41 +01:00
|
|
|
components: { Subtitle },
|
2019-10-10 16:47:38 +02:00
|
|
|
metaInfo() {
|
|
|
|
return {
|
|
|
|
// if no subcomponents specify a metaInfo.title, this title will be used
|
2020-02-18 08:57:00 +01:00
|
|
|
title: this.$t("Register an account on Mobilizon!") as string,
|
2019-10-10 16:47:38 +02:00
|
|
|
// all titles will be injected into this template
|
2020-02-18 08:57:00 +01:00
|
|
|
titleTemplate: "%s | Mobilizon",
|
2019-10-10 16:47:38 +02:00
|
|
|
};
|
|
|
|
},
|
2019-12-17 12:09:24 +01:00
|
|
|
apollo: {
|
|
|
|
config: CONFIG,
|
|
|
|
},
|
2019-10-10 16:47:38 +02:00
|
|
|
})
|
2019-01-29 11:02:32 +01:00
|
|
|
export default class Register extends Vue {
|
2020-02-18 08:57:00 +01:00
|
|
|
@Prop({ type: String, required: false, default: "" }) email!: string;
|
|
|
|
|
|
|
|
@Prop({ type: String, required: false, default: "" }) password!: string;
|
2019-01-29 11:02:32 +01:00
|
|
|
|
|
|
|
credentials = {
|
|
|
|
email: this.email,
|
2019-03-22 10:57:14 +01:00
|
|
|
password: this.password,
|
2020-02-18 08:57:00 +01:00
|
|
|
locale: "en",
|
2019-03-22 10:57:14 +01:00
|
|
|
};
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2019-01-29 11:02:32 +01:00
|
|
|
errors: object = {};
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2020-06-15 11:01:49 +02:00
|
|
|
sendingForm = false;
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2019-10-03 12:32:20 +02:00
|
|
|
RouteName = RouteName;
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2019-12-17 12:09:24 +01:00
|
|
|
config!: IConfig;
|
2019-01-29 11:02:32 +01:00
|
|
|
|
|
|
|
async submit() {
|
2020-06-15 11:01:49 +02:00
|
|
|
this.sendingForm = true;
|
2019-10-08 18:28:35 +02:00
|
|
|
this.credentials.locale = this.$i18n.locale;
|
2019-01-29 11:02:32 +01:00
|
|
|
try {
|
|
|
|
this.errors = {};
|
2019-02-22 14:55:47 +01:00
|
|
|
|
2019-01-29 11:02:32 +01:00
|
|
|
await this.$apollo.mutate({
|
|
|
|
mutation: CREATE_USER,
|
2019-03-22 10:57:14 +01:00
|
|
|
variables: this.credentials,
|
2019-01-29 11:02:32 +01:00
|
|
|
});
|
2019-02-22 14:55:47 +01:00
|
|
|
|
2020-06-15 11:01:49 +02:00
|
|
|
return this.$router.push({
|
2019-10-03 12:32:20 +02:00
|
|
|
name: RouteName.REGISTER_PROFILE,
|
2019-03-22 10:57:14 +01:00
|
|
|
params: { email: this.credentials.email },
|
2019-01-29 11:02:32 +01:00
|
|
|
});
|
|
|
|
} catch (error) {
|
|
|
|
console.error(error);
|
2020-02-18 08:57:00 +01:00
|
|
|
this.errors = error.graphQLErrors.reduce((acc: { [key: string]: any }, localError: any) => {
|
|
|
|
acc[localError.details] = localError.message;
|
2019-01-29 11:02:32 +01:00
|
|
|
return acc;
|
2020-02-18 08:57:00 +01:00
|
|
|
}, {});
|
2020-06-15 11:01:49 +02:00
|
|
|
this.sendingForm = false;
|
2019-01-29 11:02:32 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2019-10-10 15:42:27 +02:00
|
|
|
<style lang="scss" scoped>
|
2020-02-18 08:57:00 +01:00
|
|
|
@import "../../variables";
|
2019-04-03 17:29:03 +02:00
|
|
|
|
2019-01-29 11:02:32 +01:00
|
|
|
.avatar-enter-active {
|
|
|
|
transition: opacity 1s ease;
|
|
|
|
}
|
|
|
|
|
|
|
|
.avatar-enter,
|
|
|
|
.avatar-leave-to {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.avatar-leave {
|
|
|
|
display: none;
|
|
|
|
}
|
2019-04-03 17:29:03 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
.container .columns {
|
|
|
|
margin: 1rem auto 3rem;
|
|
|
|
}
|
2019-10-10 14:20:09 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
h2.title {
|
|
|
|
color: $primary;
|
|
|
|
font-size: 2.5rem;
|
|
|
|
text-decoration: underline;
|
|
|
|
text-decoration-color: $secondary;
|
|
|
|
display: inline;
|
|
|
|
}
|
2019-01-29 11:02:32 +01:00
|
|
|
</style>
|