Improve registration page and add a rules option

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2020-06-15 11:01:49 +02:00
parent 33e9b80b95
commit 97197e3811
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
28 changed files with 1329 additions and 1205 deletions

View File

@ -111,6 +111,7 @@ export const ADMIN_SETTINGS_FRAGMENT = gql`
instanceTerms instanceTerms
instanceTermsType instanceTermsType
instanceTermsUrl instanceTermsUrl
instanceRules
registrationsOpen registrationsOpen
} }
`; `;
@ -131,6 +132,7 @@ export const SAVE_ADMIN_SETTINGS = gql`
$instanceTerms: String $instanceTerms: String
$instanceTermsType: InstanceTermsType $instanceTermsType: InstanceTermsType
$instanceTermsUrl: String $instanceTermsUrl: String
$instanceRules: String
$registrationsOpen: Boolean $registrationsOpen: Boolean
) { ) {
saveAdminSettings( saveAdminSettings(
@ -139,6 +141,7 @@ export const SAVE_ADMIN_SETTINGS = gql`
instanceTerms: $instanceTerms instanceTerms: $instanceTerms
instanceTermsType: $instanceTermsType instanceTermsType: $instanceTermsType
instanceTermsUrl: $instanceTermsUrl instanceTermsUrl: $instanceTermsUrl
instanceRules: $instanceRules
registrationsOpen: $registrationsOpen registrationsOpen: $registrationsOpen
) { ) {
...adminSettingsFragment ...adminSettingsFragment

View File

@ -78,6 +78,14 @@ export const TERMS = gql`
} }
`; `;
export const RULES = gql`
query Rules {
config {
rules
}
}
`;
export const TIMEZONES = gql` export const TIMEZONES = gql`
query { query {
config { config {

View File

@ -27,7 +27,7 @@
"Are you sure you want to cancel your participation at event \"{title}\"?": "Вы сапраўды хочаце адмовіцца ад удзелу ў падзеі «{title}»?", "Are you sure you want to cancel your participation at event \"{title}\"?": "Вы сапраўды хочаце адмовіцца ад удзелу ў падзеі «{title}»?",
"Are you sure you want to delete this event? This action cannot be reverted.": "Вы сапраўды хочаце выдаліць гэту падзею? Гэта дзеянне нельга адмяніць.", "Are you sure you want to delete this event? This action cannot be reverted.": "Вы сапраўды хочаце выдаліць гэту падзею? Гэта дзеянне нельга адмяніць.",
"Avatar": "Аватар", "Avatar": "Аватар",
"Before you can login, you need to click on the link inside it to validate your account": "Каб увайсці з уліковым запісам, патрэбна спачатку перайсці па спасылцы, якая прыйшла вам у лісце", "Before you can login, you need to click on the link inside it to validate your account.": "Каб увайсці з уліковым запісам, патрэбна спачатку перайсці па спасылцы, якая прыйшла вам у лісце.",
"By @{username}": "Ад @{username}", "By @{username}": "Ад @{username}",
"Cancel": "Адмяніць", "Cancel": "Адмяніць",
"Cancel creation": "Адмяніць стварэнне", "Cancel creation": "Адмяніць стварэнне",

View File

@ -37,7 +37,7 @@
"Are you sure you want to delete this event? This action cannot be reverted.": "Segur que vols esborrar aquesta activitat? Aquesta acció és irreversible.", "Are you sure you want to delete this event? This action cannot be reverted.": "Segur que vols esborrar aquesta activitat? Aquesta acció és irreversible.",
"Avatar": "Avatar", "Avatar": "Avatar",
"Back to previous page": "Tornar a la pàgina anterior", "Back to previous page": "Tornar a la pàgina anterior",
"Before you can login, you need to click on the link inside it to validate your account": "Per a validar el compte i poder entrar, has de clicar l'enllaç que t'hem enviat en el mail", "Before you can login, you need to click on the link inside it to validate your account.": "Per a validar el compte i poder entrar, has de clicar l'enllaç que t'hem enviat en el mail.",
"By @{username}": "De @{username}", "By @{username}": "De @{username}",
"Cancel": "Canceŀla", "Cancel": "Canceŀla",
"Cancel anonymous participation": "Cancelar la participació anònima", "Cancel anonymous participation": "Cancelar la participació anònima",

View File

@ -34,7 +34,7 @@
"Are you sure you want to delete this event? This action cannot be reverted.": "Bist Du dir sicher, dass Du diese Veranstaltung löschen möchtest? Dies kann nicht rückgängig gemacht werden.", "Are you sure you want to delete this event? This action cannot be reverted.": "Bist Du dir sicher, dass Du diese Veranstaltung löschen möchtest? Dies kann nicht rückgängig gemacht werden.",
"Avatar": "Profilbild", "Avatar": "Profilbild",
"Back to previous page": "Zurück zur vorherigen Seite", "Back to previous page": "Zurück zur vorherigen Seite",
"Before you can login, you need to click on the link inside it to validate your account": "Bevor Du dich einloggen kannst, musst Du den Link anklicken, um deinen Account zu überprüfen.", "Before you can login, you need to click on the link inside it to validate your account.": "Bevor Du dich einloggen kannst, musst Du den Link anklicken, um deinen Account zu überprüfen.",
"By @{username}": "Nach @{username}", "By @{username}": "Nach @{username}",
"Cancel": "Abbrechen", "Cancel": "Abbrechen",
"Cancel creation": "Erstellung abbrechen", "Cancel creation": "Erstellung abbrechen",
@ -415,4 +415,4 @@
"{license} guarantees {respect} of the people who will use it. Since {source}, anyone can audit it, which guarantees its transparency.": "{license} garantiert den {respect} der Leute die es Nutzen. Da {sources}, kann jeder ihn einsehen und analysieren, was Tranzparenz verspricht.", "{license} guarantees {respect} of the people who will use it. Since {source}, anyone can audit it, which guarantees its transparency.": "{license} garantiert den {respect} der Leute die es Nutzen. Da {sources}, kann jeder ihn einsehen und analysieren, was Tranzparenz verspricht.",
"© The Mobilizon Contributors {date} - Made with Elixir, Phoenix, VueJS & with some love and some weeks": "© Das Mobilizon Team {date} - Entwickelt mit Elixir, Phoenix, VueJS & viel liebe und viel Zeit", "© The Mobilizon Contributors {date} - Made with Elixir, Phoenix, VueJS & with some love and some weeks": "© Das Mobilizon Team {date} - Entwickelt mit Elixir, Phoenix, VueJS & viel liebe und viel Zeit",
"© The OpenStreetMap Contributors": "© OpenStreetMap-Mitwirkende" "© The OpenStreetMap Contributors": "© OpenStreetMap-Mitwirkende"
} }

View File

@ -36,7 +36,7 @@
"Are you sure you want to delete this event? This action cannot be reverted.": "Are you sure you want to delete this event? This action cannot be reverted.", "Are you sure you want to delete this event? This action cannot be reverted.": "Are you sure you want to delete this event? This action cannot be reverted.",
"Avatar": "Avatar", "Avatar": "Avatar",
"Back to previous page": "Back to previous page", "Back to previous page": "Back to previous page",
"Before you can login, you need to click on the link inside it to validate your account": "Before you can login, you need to click on the link inside it to validate your account", "Before you can login, you need to click on the link inside it to validate your account.": "Before you can login, you need to click on the link inside it to validate your account.",
"By @{username}": "By @{username}", "By @{username}": "By @{username}",
"By {username} and {group}": "By {username} and {group}", "By {username} and {group}": "By {username} and {group}",
"Cancel anonymous participation": "Cancel anonymous participation", "Cancel anonymous participation": "Cancel anonymous participation",
@ -119,7 +119,6 @@
"Either the participation has already been validated, either the validation token is incorrect.": "Either the participation has already been validated, either the validation token is incorrect.", "Either the participation has already been validated, either the validation token is incorrect.": "Either the participation has already been validated, either the validation token is incorrect.",
"Email": "Email", "Email": "Email",
"Ends on…": "Ends on…", "Ends on…": "Ends on…",
"Enjoy discovering Mobilizon!": "Enjoy discovering Mobilizon!",
"Enter the link URL": "Enter the link URL", "Enter the link URL": "Enter the link URL",
"Enter your own terms. HTML tags allowed. Mobilizon.org's terms are provided as template.": "Enter your own terms. HTML tags allowed. Mobilizon.org's terms are provided as template.", "Enter your own terms. HTML tags allowed. Mobilizon.org's terms are provided as template.": "Enter your own terms. HTML tags allowed. Mobilizon.org's terms are provided as template.",
"Error while changing email": "Error while changing email", "Error while changing email": "Error while changing email",
@ -289,7 +288,6 @@
"Please contact this instance's Mobilizon admin if you think this is a mistake.": "Please contact this instance's Mobilizon admin if you think this is a mistake.", "Please contact this instance's Mobilizon admin if you think this is a mistake.": "Please contact this instance's Mobilizon admin if you think this is a mistake.",
"Please enter your password to confirm this action.": "Please enter your password to confirm this action.", "Please enter your password to confirm this action.": "Please enter your password to confirm this action.",
"Please make sure the address is correct and that the page hasn't been moved.": "Please make sure the address is correct and that the page hasn't been moved.", "Please make sure the address is correct and that the page hasn't been moved.": "Please make sure the address is correct and that the page hasn't been moved.",
"Please read the full rules": "Please read the full rules",
"Please refresh the page and retry.": "Please refresh the page and retry.", "Please refresh the page and retry.": "Please refresh the page and retry.",
"Post a comment": "Post a comment", "Post a comment": "Post a comment",
"Post a reply": "Post a reply", "Post a reply": "Post a reply",
@ -461,7 +459,6 @@
"Your email is not whitelisted, you can't register.": "Your email is not whitelisted, you can't register.", "Your email is not whitelisted, you can't register.": "Your email is not whitelisted, you can't register.",
"Your email will only be used to confirm that you're a real person and send you eventual updates for this event. It will NOT be transmitted to other instances or to the event organizer.": "Your email will only be used to confirm that you're a real person and send you eventual updates for this event. It will NOT be transmitted to other instances or to the event organizer.", "Your email will only be used to confirm that you're a real person and send you eventual updates for this event. It will NOT be transmitted to other instances or to the event organizer.": "Your email will only be used to confirm that you're a real person and send you eventual updates for this event. It will NOT be transmitted to other instances or to the event organizer.",
"Your federated identity": "Your federated identity", "Your federated identity": "Your federated identity",
"Your local administrator resumed its policy:": "Your local administrator resumed its policy:",
"Your participation has been confirmed": "Your participation has been confirmed", "Your participation has been confirmed": "Your participation has been confirmed",
"Your participation has been rejected": "Your participation has been rejected", "Your participation has been rejected": "Your participation has been rejected",
"Your participation has been requested": "Your participation has been requested", "Your participation has been requested": "Your participation has been requested",
@ -627,5 +624,22 @@
"Participations": "Participations", "Participations": "Participations",
"Nothing to see here": "Nothing to see here", "Nothing to see here": "Nothing to see here",
"Not confirmed": "Not confirmed", "Not confirmed": "Not confirmed",
"{actor} suspended profile {profile}": "{actor} suspended profile {profile}" "{actor} suspended profile {profile}": "{actor} suspended profile {profile}",
"Suspend": "Suspend",
"Unsuspend": "Unsuspend",
"None": "None",
"Disabled": "Disabled",
"Activated": "Activated",
"No profile matches the filters": "No profile matches the filters",
"Mobilizon": "Mobilizon",
"{instanceName} is an instance of the {mobilizon} software.": "{instanceName} is an instance of the {mobilizon} software.",
"Instance Rules": "Instance Rules",
"Rules": "Rules",
"No rules defined yet.": "No rules defined yet.",
"full rules": "full rules",
"instance rules": "instance rules",
"terms of service": "terms of service",
"Please read the instance's {fullRules}": "Please read the instance's {fullRules}",
"I agree to the {instanceRules} and {termsOfService}": "I agree to the {instanceRules} and {termsOfService}",
"This email is already used.": "This email is already used."
} }

File diff suppressed because it is too large Load Diff

View File

@ -37,7 +37,7 @@
"Are you sure you want to delete this event? This action cannot be reverted.": "Haluatko varmasti poistaa tämän tapahtuman? Toimintoa ei voi perua.", "Are you sure you want to delete this event? This action cannot be reverted.": "Haluatko varmasti poistaa tämän tapahtuman? Toimintoa ei voi perua.",
"Avatar": "Avatar", "Avatar": "Avatar",
"Back to previous page": "Palaa edelliselle sivulle", "Back to previous page": "Palaa edelliselle sivulle",
"Before you can login, you need to click on the link inside it to validate your account": "Sinun on ennen sisäänkirjautumista vahvistettava tilisi napsauttamalla siinä olevaa linkkiä", "Before you can login, you need to click on the link inside it to validate your account.": "Sinun on ennen sisäänkirjautumista vahvistettava tilisi napsauttamalla siinä olevaa linkkiä.",
"By @{username}": "Tehnyt @{username}", "By @{username}": "Tehnyt @{username}",
"Cancel": "Peruuta", "Cancel": "Peruuta",
"Cancel anonymous participation": "Peruuta anonyymi osallistuminen", "Cancel anonymous participation": "Peruuta anonyymi osallistuminen",

View File

@ -47,7 +47,7 @@
"Assigned to": "Assigné à", "Assigned to": "Assigné à",
"Avatar": "Avatar", "Avatar": "Avatar",
"Back to previous page": "Retour à la page précédente", "Back to previous page": "Retour à la page précédente",
"Before you can login, you need to click on the link inside it to validate your account": "Avant que vous puissiez vous enregistrer, vous devez cliquer sur le lien à l'intérieur pour valider votre compte", "Before you can login, you need to click on the link inside it to validate your account.": "Avant que vous puissiez vous enregistrer, vous devez cliquer sur le lien à l'intérieur pour valider votre compte.",
"Bold": "Gras", "Bold": "Gras",
"By @{group}": "Par @{group}", "By @{group}": "Par @{group}",
"By @{username}": "Par @{username}", "By @{username}": "Par @{username}",
@ -647,5 +647,22 @@
"Participations": "Participations", "Participations": "Participations",
"Nothing to see here": "Il n'y a rien à voir ici", "Nothing to see here": "Il n'y a rien à voir ici",
"Not confirmed": "Non confirmé·e", "Not confirmed": "Non confirmé·e",
"{actor} suspended profile {profile}": "{actor} a suspendu le profil {profile}" "{actor} suspended profile {profile}": "{actor} a suspendu le profil {profile}",
"Suspend": "Suspendre",
"Unsuspend": "Annuler la suspension",
"None": "Aucun",
"Disabled": "Désactivé",
"Activated": "Activé",
"No profile matches the filters": "Aucun profil ne correspond aux filtres",
"Mobilizon": "Mobilizon",
"{instanceName} is an instance of the {mobilizon} software.": "{instanceName} est une instance du logiciel {mobilizon}.",
"Instance Rules": "Règles de l'instance",
"Rules": "Règles",
"No rules defined yet.": "Pas de règles définies pour le moment.",
"full rules": "règles complètes",
"instance rules": "règles de l'instance",
"terms of service": "conditions générales d'utilisation",
"Please read the instance's {fullRules}": "Merci de lire les {fullRules} de l'instance",
"I agree to the {instanceRules} and {termsOfService}": "J'accepte les {instanceRules} et les {termsOfService}",
"This email is already used.": "Cette adresse email est déjà utilisée."
} }

View File

@ -21,7 +21,7 @@
"Are you sure you want to cancel your participation at event \"{title}\"?": "Bent u zeker dat u uw deelname aan het evenement \"{title}\" wil annuleren?", "Are you sure you want to cancel your participation at event \"{title}\"?": "Bent u zeker dat u uw deelname aan het evenement \"{title}\" wil annuleren?",
"Are you sure you want to delete this event? This action cannot be reverted.": "Bent u zeker dat u dit evenement wil verwijderen? Dit kan niet ongedaan gemaakt worden.", "Are you sure you want to delete this event? This action cannot be reverted.": "Bent u zeker dat u dit evenement wil verwijderen? Dit kan niet ongedaan gemaakt worden.",
"Avatar": "Profielfoto", "Avatar": "Profielfoto",
"Before you can login, you need to click on the link inside it to validate your account": "Voordat u zich kan aanmelden, moet u op de link erin klikken om uw account te valideren", "Before you can login, you need to click on the link inside it to validate your account.": "Voordat u zich kan aanmelden, moet u op de link erin klikken om uw account te valideren.",
"By @{username}": "Door @{username}", "By @{username}": "Door @{username}",
"Cancel": "Annuleren", "Cancel": "Annuleren",
"Cancel creation": "Aanmaken annuleren", "Cancel creation": "Aanmaken annuleren",

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,7 @@
"Are you sure you want to cancel your participation at event \"{title}\"?": "Czy na pewno chcesz wycofać swój udział w wydarzeniu „{title}”?", "Are you sure you want to cancel your participation at event \"{title}\"?": "Czy na pewno chcesz wycofać swój udział w wydarzeniu „{title}”?",
"Are you sure you want to delete this event? This action cannot be reverted.": "Czy na pewno chcesz usunąć to wydarzenie? To działanie nie może zostać odwrócone.", "Are you sure you want to delete this event? This action cannot be reverted.": "Czy na pewno chcesz usunąć to wydarzenie? To działanie nie może zostać odwrócone.",
"Avatar": "Awatar", "Avatar": "Awatar",
"Before you can login, you need to click on the link inside it to validate your account": "Zanim się zalogujesz, musisz odwiedzić odnośnik znajdujący się w niej, aby potwierdzić swoje konto", "Before you can login, you need to click on the link inside it to validate your account.": "Zanim się zalogujesz, musisz odwiedzić odnośnik znajdujący się w niej, aby potwierdzić swoje konto.",
"By @{username}": "Od @{username}", "By @{username}": "Od @{username}",
"Cancel": "Anuluj", "Cancel": "Anuluj",
"Cancel creation": "Anuluj tworzenie", "Cancel creation": "Anuluj tworzenie",

View File

@ -33,7 +33,7 @@
"Are you sure you want to delete this event? This action cannot be reverted.": "Você está seguro que quer apagar este evento? Esta ação não pode ser desfeita.", "Are you sure you want to delete this event? This action cannot be reverted.": "Você está seguro que quer apagar este evento? Esta ação não pode ser desfeita.",
"Avatar": "Avatar", "Avatar": "Avatar",
"Back to previous page": "Voltar à página anterior", "Back to previous page": "Voltar à página anterior",
"Before you can login, you need to click on the link inside it to validate your account": "Antes de você poder começar, você precisa clicar no link que está no interior para validar a sua conta", "Before you can login, you need to click on the link inside it to validate your account.": "Antes de você poder começar, você precisa clicar no link que está no interior para validar a sua conta.",
"By @{username}": "Por @{username}", "By @{username}": "Por @{username}",
"Cancel": "Cancelar", "Cancel": "Cancelar",
"Cancel anonymous participation": "Cancelar participação anônima", "Cancel anonymous participation": "Cancelar participação anônima",

View File

@ -28,7 +28,7 @@
"Are you sure you want to cancel your participation at event \"{title}\"?": "Är du säker på att du vill avsluta ditt deltagande i evenemanget \"{title}\"?", "Are you sure you want to cancel your participation at event \"{title}\"?": "Är du säker på att du vill avsluta ditt deltagande i evenemanget \"{title}\"?",
"Are you sure you want to delete this event? This action cannot be reverted.": "Är du säker på att du vill radera det här evenemanget? Den här handlingen kan inte ångras.", "Are you sure you want to delete this event? This action cannot be reverted.": "Är du säker på att du vill radera det här evenemanget? Den här handlingen kan inte ångras.",
"Avatar": "Avatar", "Avatar": "Avatar",
"Before you can login, you need to click on the link inside it to validate your account": "Innan du loggar in måste du klicka på länken inuti det för att validera ditt konto", "Before you can login, you need to click on the link inside it to validate your account.": "Innan du loggar in måste du klicka på länken inuti det för att validera ditt konto.",
"By @{username}": "Av @{username}", "By @{username}": "Av @{username}",
"Cancel": "Avbryt", "Cancel": "Avbryt",
"Cancel creation": "Avbryt skapandet", "Cancel creation": "Avbryt skapandet",

View File

@ -73,6 +73,12 @@ const router = new Router({
component: () => import(/* webpackChunkName: "cookies" */ "@/views/Terms.vue"), component: () => import(/* webpackChunkName: "cookies" */ "@/views/Terms.vue"),
meta: { requiredAuth: false }, meta: { requiredAuth: false },
}, },
{
path: "/rules",
name: RouteName.RULES,
component: () => import(/* webpackChunkName: "cookies" */ "@/views/Rules.vue"),
meta: { requiredAuth: false },
},
{ {
path: "/interact", path: "/interact",
name: RouteName.INTERACT, name: RouteName.INTERACT,

View File

@ -13,6 +13,7 @@ enum GlobalRouteName {
SEARCH = "Search", SEARCH = "Search",
TERMS = "TERMS", TERMS = "TERMS",
INTERACT = "INTERACT", INTERACT = "INTERACT",
RULES = "RULES",
} }
// Hack to merge enums // Hack to merge enums

View File

@ -20,5 +20,6 @@ export interface IAdminSettings {
instanceTerms: string; instanceTerms: string;
instanceTermsType: InstanceTermsType; instanceTermsType: InstanceTermsType;
instanceTermsUrl: string | null; instanceTermsUrl: string | null;
instanceRules: string;
registrationsOpen: boolean; registrationsOpen: boolean;
} }

View File

@ -59,6 +59,7 @@ export interface IConfig {
type: InstanceTermsType; type: InstanceTermsType;
url: string; url: string;
}; };
rules: string;
resourceProviders: IProvider[]; resourceProviders: IProvider[];
timezones: string[]; timezones: string[];
features: { features: {

View File

@ -82,7 +82,7 @@ export const errors: IError[] = [
}, },
{ {
match: /^This email is already used.$/, match: /^This email is already used.$/,
value: null, value: i18n.t("This email is already used.") as string,
}, },
{ {
match: /^User account not confirmed$/, match: /^User account not confirmed$/,

View File

@ -39,9 +39,13 @@
</b-field> </b-field>
<p class="control has-text-centered"> <p class="control has-text-centered">
<b-button type="is-primary" size="is-large" native-type="submit">{{ <b-button
$t("Create my profile") type="is-primary"
}}</b-button> size="is-large"
native-type="submit"
:disabled="sendingValidation"
>{{ $t("Create my profile") }}</b-button
>
</p> </p>
</form> </form>
@ -54,11 +58,13 @@
}) })
}} }}
</h2> </h2>
<p>{{ $t("A validation email was sent to {email}", { email }) }}</p> <i18n path="A validation email was sent to {email}" tag="p">
<code slot="email">{{ email }}</code>
</i18n>
<p> <p>
{{ {{
$t( $t(
"Before you can login, you need to click on the link inside it to validate your account" "Before you can login, you need to click on the link inside it to validate your account."
) )
}} }}
</p> </p>
@ -141,6 +147,7 @@ export default class Register extends mixins(identityEditionMixin) {
); );
console.error("Error while registering person", errorCatched); console.error("Error while registering person", errorCatched);
console.error("Errors while registering person", this.errors); console.error("Errors while registering person", this.errors);
this.sendingValidation = false;
} }
} }
} }

View File

@ -15,6 +15,9 @@
<p class="content" v-else>{{ $t("Registration is closed.") }}</p> <p class="content" v-else>{{ $t("Registration is closed.") }}</p>
</b-switch> </b-switch>
</b-field> </b-field>
<b-field :label="$t('Instance Rules')">
<b-input type="textarea" v-model="adminSettings.instanceRules" />
</b-field>
<b-field :label="$t('Instance Terms Source')"> <b-field :label="$t('Instance Terms Source')">
<div class="columns"> <div class="columns">
<div class="column is-one-third-desktop"> <div class="column is-one-third-desktop">

35
js/src/views/Rules.vue Normal file
View File

@ -0,0 +1,35 @@
<template>
<div class="container section" v-if="config">
<h2 class="title">{{ $t("Rules") }}</h2>
<div class="content" v-html="config.rules" v-if="config.rules" />
<p v-else>{{ $t("No rules defined yet.") }}</p>
</div>
</template>
<script lang="ts">
import { Component, Vue, Watch } from "vue-property-decorator";
import { RULES } from "@/graphql/config";
import { IConfig } from "@/types/config.model";
import { InstanceTermsType } from "@/types/admin.model";
import RouteName from "../router/name";
@Component({
apollo: {
config: {
query: RULES,
},
},
})
export default class Rules extends Vue {
config!: IConfig;
RouteName = RouteName;
}
</script>
<style lang="scss" scoped>
@import "@/variables.scss";
main > .container {
background: $white;
}
</style>

View File

@ -3,6 +3,12 @@
<section class="hero"> <section class="hero">
<div class="hero-body"> <div class="hero-body">
<h1 class="title">{{ $t("Register an account on Mobilizon!") }}</h1> <h1 class="title">{{ $t("Register an account on Mobilizon!") }}</h1>
<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>
</div> </div>
</section> </section>
<section> <section>
@ -22,15 +28,12 @@
<hr /> <hr />
<div class="content"> <div class="content">
<subtitle>{{ $t("About this instance") }}</subtitle> <subtitle>{{ $t("About this instance") }}</subtitle>
<div class="content"> <div class="content" v-html="config.description"></div>
<p>{{ $t("Your local administrator resumed its policy:") }}</p> <i18n path="Please read the instance's {fullRules}" tag="p">
<ul> <router-link slot="fullRules" :to="{ name: RouteName.RULES }">{{
<li>{{ $t("Enjoy discovering Mobilizon!") }}</li> $t("full rules")
</ul> }}</router-link>
</div> </i18n>
<!-- <p>-->
<!-- {{ $t('Please read the full rules') }}-->
<!-- </p>-->
</div> </div>
</div> </div>
<div class="column"> <div class="column">
@ -72,8 +75,26 @@
/> />
</b-field> </b-field>
<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>
<p class="control has-text-centered"> <p class="control has-text-centered">
<button class="button is-primary is-large">{{ $t("Register") }}</button> <b-button
type="is-primary"
size="is-large"
:disabled="sendingForm"
native-type="submit"
>
{{ $t("Register") }}
</b-button>
</p> </p>
<p class="control"> <p class="control">
<router-link <router-link
@ -89,7 +110,6 @@
name: RouteName.LOGIN, name: RouteName.LOGIN,
params: { email: credentials.email, password: credentials.password }, params: { email: credentials.email, password: credentials.password },
}" }"
:disabled="sendingValidation"
>{{ $t("Login") }}</router-link >{{ $t("Login") }}</router-link
> >
</p> </p>
@ -139,18 +159,16 @@ export default class Register extends Vue {
errors: object = {}; errors: object = {};
sendingValidation = false; sendingForm = false;
validationSent = false;
RouteName = RouteName; RouteName = RouteName;
config!: IConfig; config!: IConfig;
async submit() { async submit() {
this.sendingForm = true;
this.credentials.locale = this.$i18n.locale; this.credentials.locale = this.$i18n.locale;
try { try {
this.sendingValidation = true;
this.errors = {}; this.errors = {};
await this.$apollo.mutate({ await this.$apollo.mutate({
@ -158,9 +176,7 @@ export default class Register extends Vue {
variables: this.credentials, variables: this.credentials,
}); });
this.validationSent = true; return this.$router.push({
await this.$router.push({
name: RouteName.REGISTER_PROFILE, name: RouteName.REGISTER_PROFILE,
params: { email: this.credentials.email }, params: { email: this.credentials.email },
}); });
@ -170,6 +186,7 @@ export default class Register extends Vue {
acc[localError.details] = localError.message; acc[localError.details] = localError.message;
return acc; return acc;
}, {}); }, {});
this.sendingForm = false;
} }
} }
} }

View File

@ -158,7 +158,8 @@ defmodule Mobilizon.GraphQL.Resolvers.Admin do
registrations_open: Config.instance_registrations_open?(), registrations_open: Config.instance_registrations_open?(),
instance_terms: Config.instance_terms(), instance_terms: Config.instance_terms(),
instance_terms_type: Config.instance_terms_type(), instance_terms_type: Config.instance_terms_type(),
instance_terms_url: Config.instance_terms_url() instance_terms_url: Config.instance_terms_url(),
instance_rules: Config.instance_rules()
}} }}
end end

View File

@ -106,7 +106,8 @@ defmodule Mobilizon.GraphQL.Resolvers.Config do
timezones: Tzdata.zone_list(), timezones: Tzdata.zone_list(),
features: %{ features: %{
groups: Config.instance_group_feature_enabled?() groups: Config.instance_group_feature_enabled?()
} },
rules: Config.instance_rules()
} }
end end
end end

View File

@ -73,6 +73,7 @@ defmodule Mobilizon.GraphQL.Schema.AdminType do
field(:instance_terms, :string) field(:instance_terms, :string)
field(:instance_terms_type, :instance_terms_type) field(:instance_terms_type, :instance_terms_type)
field(:instance_terms_url, :string) field(:instance_terms_url, :string)
field(:instance_rules, :string)
field(:registrations_open, :boolean) field(:registrations_open, :boolean)
end end
@ -148,6 +149,7 @@ defmodule Mobilizon.GraphQL.Schema.AdminType do
arg(:instance_terms, :string) arg(:instance_terms, :string)
arg(:instance_terms_type, :instance_terms_type) arg(:instance_terms_type, :instance_terms_type)
arg(:instance_terms_url, :string) arg(:instance_terms_url, :string)
arg(:instance_rules, :string)
arg(:registrations_open, :boolean) arg(:registrations_open, :boolean)
resolve(&Admin.save_settings/3) resolve(&Admin.save_settings/3)

View File

@ -28,6 +28,8 @@ defmodule Mobilizon.GraphQL.Schema.ConfigType do
arg(:locale, :string, default_value: "en") arg(:locale, :string, default_value: "en")
resolve(&Config.terms/3) resolve(&Config.terms/3)
end end
field(:rules, :string, description: "The instance's rules")
end end
object :terms do object :terms do

View File

@ -42,6 +42,11 @@ defmodule Mobilizon.Config do
Mobilizon.Admin.get_admin_setting_value("instance", "instance_terms_url") Mobilizon.Admin.get_admin_setting_value("instance", "instance_terms_url")
end end
@spec instance_rules :: String.t()
def instance_rules do
Mobilizon.Admin.get_admin_setting_value("instance", "instance_rules")
end
@spec instance_version :: String.t() @spec instance_version :: String.t()
def instance_version, do: Mix.Project.config()[:version] def instance_version, do: Mix.Project.config()[:version]