Fix anonymous & remote participation pages

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2022-10-31 18:54:05 +01:00
parent 9a135bb67f
commit dc075ccf0d
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
9 changed files with 167 additions and 168 deletions

View File

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

View File

@ -1,6 +1,6 @@
<template> <template>
<article <article
class="bg-white dark:bg-gray-700 dark:text-white dark:hover:text-white rounded-lg shadow-md max-w-3xl p-2" class="bg-white dark:bg-zinc-700 dark:text-white dark:hover:text-white rounded-lg shadow-md max-w-3xl p-2"
> >
<div class="flex gap-2"> <div class="flex gap-2">
<div class=""> <div class="">

View File

@ -1,106 +1,99 @@
<template> <template>
<section class="container mx-auto hero"> <section class="container mx-auto max-w-2xl">
<div class="hero-body" v-if="event"> <h2 class="text-2xl">
<div class="container mx-auto"> {{ t("You wish to participate to the following event") }}
<h2 class="text-2xl"> </h2>
{{ $t("You wish to participate to the following event") }} <EventListViewCard v-if="event" :event="event" />
</h2> <div class="flex flex-wrap gap-4 items-center w-full my-6">
<EventListViewCard v-if="event" :event="event" /> <div class="bg-white dark:bg-zinc-700 rounded-md p-4 flex-1">
<div class="columns has-text-centered"> <router-link :to="{ name: RouteName.EVENT_PARTICIPATE_WITH_ACCOUNT }">
<div class="column"> <figure class="flex justify-center my-2">
<router-link <img
:to="{ name: RouteName.EVENT_PARTICIPATE_WITH_ACCOUNT }" src="/img/undraw_profile.svg"
> alt="Profile illustration"
<figure class="image is-128x128"> width="128"
<img height="128"
src="../../assets/undraw_profile.svg" />
alt="Profile illustration" </figure>
/> <o-button variant="primary">{{
</figure> t("I have a Mobilizon account")
<o-button variant="primary">{{ }}</o-button>
$t("I have a Mobilizon account") </router-link>
}}</o-button> <p>
</router-link> <small>
<p> {{
<small> t("Either on the {instance} instance or on another instance.", {
{{ instance: host,
$t( })
"Either on the {instance} instance or on another instance.", }}
{ </small>
instance: host, <o-tooltip
} variant="dark"
) :label="
}} t(
</small> 'Mobilizon is a federated network. You can interact with this event from a different server.'
<o-tooltip )
variant="dark"
:label="
$t(
'Mobilizon is a federated network. You can interact with this event from a different server.'
)
"
>
<o-icon size="small" icon="help-circle-outline" />
</o-tooltip>
</p>
</div>
<vertical-divider
:content="$t('Or')"
v-if="anonymousParticipationAllowed"
/>
<div
class="column"
v-if="
anonymousParticipationAllowed &&
hasAnonymousEmailParticipationMethod
" "
> >
<router-link <o-icon size="small" icon="help-circle-outline" />
:to="{ name: RouteName.EVENT_PARTICIPATE_WITHOUT_ACCOUNT }" </o-tooltip>
v-if="event.local" </p>
>
<figure class="image is-128x128">
<img
src="../../assets/undraw_mail_2.svg"
alt="Privacy illustration"
/>
</figure>
<o-button variant="primary">{{
$t("I don't have a Mobilizon account")
}}</o-button>
</router-link>
<a :href="`${event.url}/participate/without-account`" v-else>
<figure class="image is-128x128">
<img
src="../../assets/undraw_mail_2.svg"
alt="Privacy illustration"
/>
</figure>
<o-button variant="primary">{{
$t("I don't have a Mobilizon account")
}}</o-button>
</a>
<p>
<small>{{ $t("Participate using your email address") }}</small>
<br />
<small v-if="!event.local">
{{ $t("You will be redirected to the original instance") }}
</small>
</p>
</div>
</div>
<div class="has-text-centered">
<o-button tag="a" variant="text" @click="router.go(-1)">{{
$t("Back to previous page")
}}</o-button>
</div>
</div> </div>
<div
class="bg-white dark:bg-zinc-700 rounded-md p-4 flex-1"
v-if="
event &&
anonymousParticipationAllowed &&
hasAnonymousEmailParticipationMethod
"
>
<router-link
:to="{ name: RouteName.EVENT_PARTICIPATE_WITHOUT_ACCOUNT }"
v-if="event.local"
>
<figure class="flex justify-center my-2">
<img
width="128"
height="128"
src="/img/undraw_mail_2.svg"
alt="Privacy illustration"
/>
</figure>
<o-button variant="primary">{{
t("I don't have a Mobilizon account")
}}</o-button>
</router-link>
<a :href="`${event.url}/participate/without-account`" v-else>
<figure class="flex justify-center my-2">
<img
src="/img/undraw_mail_2.svg"
width="128"
height="128"
alt="Privacy illustration"
/>
</figure>
<o-button variant="primary">{{
t("I don't have a Mobilizon account")
}}</o-button>
</a>
<p>
<small>{{ t("Participate using your email address") }}</small>
<br />
<small v-if="!event.local">
{{ t("You will be redirected to the original instance") }}
</small>
</p>
</div>
</div>
<div class="has-text-centered">
<o-button tag="a" variant="text" @click="router.go(-1)">{{
t("Back to previous page")
}}</o-button>
</div> </div>
</section> </section>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import EventListViewCard from "@/components/Event/EventListViewCard.vue"; import EventListViewCard from "@/components/Event/EventListViewCard.vue";
import VerticalDivider from "@/components/Utils/VerticalDivider.vue";
import RouteName from "../../router/name"; import RouteName from "../../router/name";
import { useFetchEvent } from "@/composition/apollo/event"; import { useFetchEvent } from "@/composition/apollo/event";
import { useAnonymousParticipationConfig } from "@/composition/apollo/config"; import { useAnonymousParticipationConfig } from "@/composition/apollo/config";

View File

@ -1,66 +1,77 @@
<template> <template>
<section class="container mx-auto hero is-fullheight"> <section class="container mx-auto max-w-2xl">
<div class="hero-body"> <div class="flex flex-wrap gap-4 items-center w-full">
<div class="container mx-auto"> <div class="px-2 flex-1">
<div class="columns is-vcentered"> <h2 class="text-2xl">
<div class="column has-text-centered"> {{
<o-button t("I have an account on {instance}.", { instance: instanceName })
variant="primary" }}
size="medium" </h2>
tag="router-link" <i18n-t keypath="My federated identity ends in {domain}">
:to="{ <template #domain>
name: RouteName.LOGIN, <code>@{{ host }}</code>
query: { </template>
code: LoginErrorCode.NEED_TO_LOGIN, </i18n-t>
redirect: pathAfterLogin, <o-button
}, variant="primary"
}" size="medium"
>{{ $t("Login on {instance}", { instance: host }) }}</o-button tag="router-link"
> class="mt-4"
</div> :to="{
<vertical-divider :content="$t('Or')" /> name: RouteName.LOGIN,
<div class="column"> query: {
<h2 class="text-2xl"> code: LoginErrorCode.NEED_TO_LOGIN,
{{ $t("I have an account on another Mobilizon instance.") }} redirect: pathAfterLogin,
</h2> },
<p>{{ $t("Other software may also support this.") }}</p> }"
<p>{{ sentence }}</p> >{{ t("Login on {instance}", { instance: host }) }}</o-button
<form @submit.prevent="redirectToInstance"> >
<o-field :label="$t('Your federated identity')">
<o-field>
<o-input
expanded
autocapitalize="none"
autocorrect="off"
v-model="remoteActorAddress"
:placeholder="$t('profile@instance')"
></o-input>
<p class="control">
<button class="button is-primary" type="submit">
{{ $t("Go") }}
</button>
</p>
</o-field>
</o-field>
</form>
</div>
</div>
<div class="has-text-centered">
<o-button tag="a" variant="text" @click="$router.go(-1)">{{
$t("Back to previous page")
}}</o-button>
</div>
</div> </div>
<div class="sm:border-l-4 px-2 sm:px-4 flex-1">
<h2 class="text-2xl">
{{ t("I have an account on another Mobilizon instance.") }}
</h2>
<p>{{ t("Other software may also support this.") }}</p>
<p>{{ sentence }}</p>
<form @submit.prevent="redirectToInstance">
<o-field
:label="t('Your federated identity')"
label-for="remoteProfileInput"
>
<o-field>
<o-input
id="remoteProfileInput"
expanded
autocapitalize="none"
autocorrect="off"
v-model="remoteActorAddress"
:placeholder="t('profile{\'@\'}instance')"
></o-input>
<p class="control">
<o-button type="submit">
{{ t("Go") }}
</o-button>
</p>
</o-field>
</o-field>
</form>
</div>
</div>
<div class="text-center">
<o-button tag="a" variant="text" @click="$router.go(-1)">{{
t("Back to previous page")
}}</o-button>
</div> </div>
</section> </section>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import VerticalDivider from "@/components/Utils/VerticalDivider.vue";
import { LoginErrorCode } from "@/types/enums"; import { LoginErrorCode } from "@/types/enums";
import RouteName from "../../router/name"; import RouteName from "../../router/name";
import { computed, ref } from "vue"; import { computed, ref } from "vue";
import { useI18n } from "vue-i18n";
import { useInstanceName } from "@/composition/apollo/config";
defineProps<{ const props = defineProps<{
uri: string; uri: string;
pathAfterLogin?: string; pathAfterLogin?: string;
sentence?: string; sentence?: string;
@ -68,7 +79,10 @@ defineProps<{
const remoteActorAddress = ref(""); const remoteActorAddress = ref("");
// eslint-disable-next-line class-methods-use-this const { t } = useI18n({ useScope: "global" });
const { instanceName } = useInstanceName();
const host = computed((): string => { const host = computed((): string => {
return window.location.hostname; return window.location.hostname;
}); });
@ -101,7 +115,7 @@ const webFingerFetch = async (
); );
if (link && link.template.includes("{uri}")) { if (link && link.template.includes("{uri}")) {
return link.template.replace("{uri}", encodeURIComponent(this.uri)); return link.template.replace("{uri}", encodeURIComponent(props.uri));
} }
} }
throw new Error("No interaction path found in webfinger data"); throw new Error("No interaction path found in webfinger data");

View File

@ -1,14 +0,0 @@
<template>
<div class="is-divider-vertical" :data-content="dataContent"></div>
</template>
<script lang="ts" setup>
import { computed } from "vue";
const props = withDefaults(defineProps<{ content?: string }>(), {
content: "Or",
});
const dataContent = computed((): string => {
return props.content.toLocaleUpperCase();
});
</script>

View File

@ -1311,7 +1311,7 @@
"more than 1360 contributors": "více než 1360 přispěvatelů", "more than 1360 contributors": "více než 1360 přispěvatelů",
"multitude of interconnected Mobilizon websites": "množství propojených webových stránek Mobilizon", "multitude of interconnected Mobilizon websites": "množství propojených webových stránek Mobilizon",
"new{'@'}email.com": "nový{'@'}email.com", "new{'@'}email.com": "nový{'@'}email.com",
"profile@instance": "profil@instance", "profile{'@'}instance": "profil{'@'}instance",
"report #{report_number}": "hlášení #{report_number}", "report #{report_number}": "hlášení #{report_number}",
"return to the event's page": "návrat na stránku události", "return to the event's page": "návrat na stránku události",
"return to the homepage": "zpět na domovskou stránku", "return to the homepage": "zpět na domovskou stránku",

View File

@ -1435,5 +1435,8 @@
"No results found for {search}": "No results found for {search}", "No results found for {search}": "No results found for {search}",
"No events found for {search}": "No events found for {search}", "No events found for {search}": "No events found for {search}",
"No groups found for {search}": "No groups found for {search}", "No groups found for {search}": "No groups found for {search}",
"No event found at this address": "No event found at this address" "No event found at this address": "No event found at this address",
"I have an account on {instance}.": "I have an account on {instance}.",
"profile{\\'@\\'}instance": "profile{\\'@\\'}instance",
"My federated identity ends in {domain}": "My federated identity ends in {domain}"
} }

View File

@ -1312,7 +1312,7 @@
"more than 1360 contributors": "plus de 1360 contributeur·rice·s", "more than 1360 contributors": "plus de 1360 contributeur·rice·s",
"multitude of interconnected Mobilizon websites": "multitude de sites web Mobilizon interconnectés", "multitude of interconnected Mobilizon websites": "multitude de sites web Mobilizon interconnectés",
"new{'@'}email.com": "nouvel{'@'}email.com", "new{'@'}email.com": "nouvel{'@'}email.com",
"profile@instance": "profil@instance", "profile{'@'}instance": "profil{'@'}instance",
"report #{report_number}": "le signalement #{report_number}", "report #{report_number}": "le signalement #{report_number}",
"return to the event's page": "retourner sur la page de l'événement", "return to the event's page": "retourner sur la page de l'événement",
"return to the homepage": "retour à la page d'accueil", "return to the homepage": "retour à la page d'accueil",
@ -1433,5 +1433,8 @@
"No results found for {search}": "Aucun résultat trouvé pour {search}", "No results found for {search}": "Aucun résultat trouvé pour {search}",
"No events found for {search}": "Aucun événement trouvé pour {search}", "No events found for {search}": "Aucun événement trouvé pour {search}",
"No groups found for {search}": "Aucun groupe trouvé pour {search}", "No groups found for {search}": "Aucun groupe trouvé pour {search}",
"No event found at this address": "Aucun événement trouvé à cette addresse" "No event found at this address": "Aucun événement trouvé à cette addresse",
"I have an account on {instance}.": "J'ai un compte sur {instance}.",
"profile{\\'@\\'}instance": "profil{\\'@\\'}instance",
"My federated identity ends in {domain}": "Mon identité fédérée se termine par {domain}"
} }