refactor: Remove the registerPerson GraphQL query
- The first profile is now created after the user email validation - NavBar is correctly updated when a user is connected but without any profile - Always fetch identities from the server at login (no cache) - NoIdentitiesException is thrown again - Refactor EditIdentity to create the first profile - Translations updated - Tests updated Fixes #1762
This commit is contained in:
@@ -151,11 +151,7 @@ onBeforeMount(async () => {
|
||||
} catch (err) {
|
||||
if (err instanceof NoIdentitiesException) {
|
||||
await router.push({
|
||||
name: RouteName.REGISTER_PROFILE,
|
||||
params: {
|
||||
email: localStorage.getItem(AUTH_USER_EMAIL),
|
||||
userAlreadyActivated: "true",
|
||||
},
|
||||
name: RouteName.CREATE_IDENTITY,
|
||||
});
|
||||
} else {
|
||||
throw err;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
</router-link>
|
||||
<div
|
||||
class="flex items-center md:order-2 ml-auto gap-2"
|
||||
v-if="currentActor?.id"
|
||||
v-if="currentUser?.isLoggedIn"
|
||||
>
|
||||
<router-link
|
||||
:to="{ name: RouteName.CONVERSATION_LIST }"
|
||||
@@ -60,7 +60,7 @@
|
||||
<o-dropdown-item aria-role="listitem">
|
||||
<div class="px-4">
|
||||
<span class="block text-sm text-zinc-900 dark:text-white">{{
|
||||
displayName(currentActor)
|
||||
displayName(currentActor) || currentUser.email
|
||||
}}</span>
|
||||
<span
|
||||
class="block text-sm font-medium text-zinc-500 truncate dark:text-zinc-400"
|
||||
@@ -76,7 +76,7 @@
|
||||
</o-dropdown-item>
|
||||
<o-dropdown-item
|
||||
v-for="identity in identities"
|
||||
:active="identity.id === currentActor.id"
|
||||
:active="identity.id === currentActor?.id"
|
||||
:key="identity.id"
|
||||
tabindex="0"
|
||||
@click="
|
||||
@@ -211,14 +211,14 @@
|
||||
>{{ t("My groups") }}</router-link
|
||||
>
|
||||
</li>
|
||||
<li class="m-auto" v-if="!currentActor?.id">
|
||||
<li class="m-auto" v-if="!currentUser?.isLoggedIn">
|
||||
<router-link
|
||||
:to="{ name: RouteName.LOGIN }"
|
||||
class="block py-2 pr-4 pl-3 text-zinc-700 border-b border-gray-100 hover:bg-zinc-50 md:hover:bg-transparent md:border-0 md:hover:text-mbz-purple-700 md:p-0 dark:text-zinc-400 md:dark:hover:text-white dark:hover:bg-zinc-700 dark:hover:text-white md:dark:hover:bg-transparent dark:border-gray-700"
|
||||
>{{ t("Login") }}</router-link
|
||||
>
|
||||
</li>
|
||||
<li class="m-auto" v-if="!currentActor?.id && canRegister">
|
||||
<li class="m-auto" v-if="!currentUser?.isLoggedIn && canRegister">
|
||||
<router-link
|
||||
:to="{ name: RouteName.REGISTER }"
|
||||
class="block py-2 pr-4 pl-3 text-zinc-700 border-b border-gray-100 hover:bg-zinc-50 md:hover:bg-transparent md:border-0 md:hover:text-mbz-purple-700 md:p-0 dark:text-zinc-400 md:dark:hover:text-white dark:hover:bg-zinc-700 dark:hover:text-white md:dark:hover:bg-transparent dark:border-gray-700"
|
||||
@@ -235,7 +235,7 @@
|
||||
import MobilizonLogo from "@/components/MobilizonLogo.vue";
|
||||
import { ICurrentUserRole } from "@/types/enums";
|
||||
import { logout } from "../utils/auth";
|
||||
import { displayName } from "../types/actor";
|
||||
import { displayName, IPerson } from "../types/actor";
|
||||
import RouteName from "../router/name";
|
||||
import { computed, onMounted, ref, watch } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
@@ -341,13 +341,9 @@ watch(identities, () => {
|
||||
"We have no identities listed for current user",
|
||||
identities.value
|
||||
);
|
||||
console.info("Pushing route to REGISTER_PROFILE");
|
||||
console.info("Pushing route to CREATE_IDENTITY");
|
||||
router.push({
|
||||
name: RouteName.REGISTER_PROFILE,
|
||||
params: {
|
||||
email: currentUser.value?.email,
|
||||
userAlreadyActivated: "true",
|
||||
},
|
||||
name: RouteName.CREATE_IDENTITY,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -25,7 +25,13 @@ export function useCurrentActorClient() {
|
||||
export function useLazyCurrentUserIdentities() {
|
||||
return useLazyQuery<{
|
||||
loggedUser: Pick<ICurrentUser, "actors">;
|
||||
}>(IDENTITIES);
|
||||
}>(
|
||||
IDENTITIES,
|
||||
{},
|
||||
{
|
||||
fetchPolicy: "network-only",
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function useCurrentUserIdentities() {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { IDENTITIES, REGISTER_PERSON } from "@/graphql/actor";
|
||||
import {
|
||||
CURRENT_USER_CLIENT,
|
||||
LOGGED_USER_AND_SETTINGS,
|
||||
@@ -6,10 +5,7 @@ import {
|
||||
SET_USER_SETTINGS,
|
||||
UPDATE_USER_LOCALE,
|
||||
} from "@/graphql/user";
|
||||
import { IPerson } from "@/types/actor";
|
||||
import { ICurrentUser, IUser } from "@/types/current-user.model";
|
||||
import { ActorType } from "@/types/enums";
|
||||
import { ApolloCache, FetchResult } from "@apollo/client/core";
|
||||
import { useMutation, useQuery } from "@vue/apollo-composable";
|
||||
import { computed } from "vue";
|
||||
|
||||
@@ -65,44 +61,3 @@ export async function doUpdateSetting(
|
||||
export function updateLocale() {
|
||||
return useMutation<{ id: string; locale: string }>(UPDATE_USER_LOCALE);
|
||||
}
|
||||
|
||||
export function registerAccount() {
|
||||
return useMutation<
|
||||
{ registerPerson: IPerson },
|
||||
{
|
||||
preferredUsername: string;
|
||||
name: string;
|
||||
summary: string;
|
||||
email: string;
|
||||
}
|
||||
>(REGISTER_PERSON, () => ({
|
||||
update: (
|
||||
store: ApolloCache<{ registerPerson: IPerson }>,
|
||||
{ data: localData }: FetchResult,
|
||||
{ context }
|
||||
) => {
|
||||
if (context?.userAlreadyActivated) {
|
||||
const currentUserData = store.readQuery<{
|
||||
loggedUser: Pick<ICurrentUser, "actors" | "id">;
|
||||
}>({
|
||||
query: IDENTITIES,
|
||||
});
|
||||
|
||||
if (currentUserData && localData) {
|
||||
const newPersonData = {
|
||||
...localData.registerPerson,
|
||||
type: ActorType.PERSON,
|
||||
};
|
||||
|
||||
store.writeQuery({
|
||||
query: IDENTITIES,
|
||||
data: {
|
||||
...currentUserData.loggedUser,
|
||||
actors: [[...currentUserData.loggedUser.actors, newPersonData]],
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -451,29 +451,6 @@ export const DELETE_PERSON = gql`
|
||||
}
|
||||
`;
|
||||
|
||||
/**
|
||||
* This one is used only to register the first account.
|
||||
* Prefer CREATE_PERSON when creating another identity
|
||||
*/
|
||||
export const REGISTER_PERSON = gql`
|
||||
mutation RegisterPerson(
|
||||
$preferredUsername: String!
|
||||
$name: String!
|
||||
$summary: String!
|
||||
$email: String!
|
||||
) {
|
||||
registerPerson(
|
||||
preferredUsername: $preferredUsername
|
||||
name: $name
|
||||
summary: $summary
|
||||
email: $email
|
||||
) {
|
||||
...ActorFragment
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const SUSPEND_PROFILE = gql`
|
||||
mutation SuspendProfile($id: ID!) {
|
||||
suspendProfile(id: $id) {
|
||||
|
||||
@@ -1117,7 +1117,7 @@
|
||||
"Your account has been successfully deleted": "تم حذف حسابك بنجاح",
|
||||
"Your account has been validated": "لقد تم تأكيد حسابك",
|
||||
"Your account is being validated": "جارٍ تأكيد حسابك",
|
||||
"Your account is nearly ready, {username}": "إنّ حسابك جاهز تقريبًا ، يا {username}",
|
||||
"Your account is nearly ready": "إنّ حسابك جاهز تقريبًا ، يا",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "",
|
||||
"Your current email is {email}. You use it to log in.": "",
|
||||
"Your email": "",
|
||||
|
||||
@@ -1117,7 +1117,7 @@
|
||||
"Your account has been successfully deleted": "",
|
||||
"Your account has been validated": "",
|
||||
"Your account is being validated": "",
|
||||
"Your account is nearly ready, {username}": "",
|
||||
"Your account is nearly ready": "",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "",
|
||||
"Your current email is {email}. You use it to log in.": "",
|
||||
"Your email": "",
|
||||
|
||||
@@ -1119,7 +1119,7 @@
|
||||
"Your account has been successfully deleted": "",
|
||||
"Your account has been validated": "",
|
||||
"Your account is being validated": "",
|
||||
"Your account is nearly ready, {username}": "",
|
||||
"Your account is nearly ready": "",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "",
|
||||
"Your current email is {email}. You use it to log in.": "",
|
||||
"Your email": "",
|
||||
|
||||
@@ -1117,7 +1117,7 @@
|
||||
"Your account has been successfully deleted": "S'ha esborrat el teu compte",
|
||||
"Your account has been validated": "El teu compte ha estat validat",
|
||||
"Your account is being validated": "El teu compte està sent validat",
|
||||
"Your account is nearly ready, {username}": "El teu compte està gairebé apunt, {username}",
|
||||
"Your account is nearly ready": "El teu compte està gairebé apunt",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "El municipi i el radi només es faran servir per suggerir-te activitats properes. El radi d'activitats es considera des del centre administratiu de l'àrea.",
|
||||
"Your current email is {email}. You use it to log in.": "El teu correu actual és {email}. Fes-lo servir per iniciar sessió.",
|
||||
"Your email": "El teu mail",
|
||||
|
||||
@@ -1492,7 +1492,7 @@
|
||||
"Your account has been successfully deleted": "Váš účet byl úspěšně smazán",
|
||||
"Your account has been validated": "Váš účet byl ověřen",
|
||||
"Your account is being validated": "Váš účet je ověřován",
|
||||
"Your account is nearly ready, {username}": "Váš účet je téměř připraven, {username}",
|
||||
"Your account is nearly ready": "Váš účet je téměř připraven",
|
||||
"Your application code": "Kód vaší aplikace",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "Vaše město nebo oblast a okruh budou použity pouze k tomu, aby vám byly nabídnuty události v okolí. Poloměr události bude brát v úvahu administrativní centrum oblasti.",
|
||||
"Your current email is {email}. You use it to log in.": "Váš aktuální e-mail je {email}. Používáte ho k přihlášení.",
|
||||
|
||||
@@ -1117,7 +1117,7 @@
|
||||
"Your account has been successfully deleted": "",
|
||||
"Your account has been validated": "",
|
||||
"Your account is being validated": "",
|
||||
"Your account is nearly ready, {username}": "",
|
||||
"Your account is nearly ready": "",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "",
|
||||
"Your current email is {email}. You use it to log in.": "",
|
||||
"Your email": "",
|
||||
|
||||
@@ -1338,7 +1338,7 @@
|
||||
"Your account has been successfully deleted": "Ihr Konto wurde erfolgreich gelöscht",
|
||||
"Your account has been validated": "Ihr Konto wurde validiert",
|
||||
"Your account is being validated": "Ihr Konto wird geprüft",
|
||||
"Your account is nearly ready, {username}": "Ihr Konto ist fast bereit, {username}",
|
||||
"Your account is nearly ready": "Ihr Konto ist fast bereit",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "Ihr Ort, Landkreis oder Bundesland wird nur für die Anzeige von Veranstaltungen in der Nähe verwendet. Der Veranstaltungsradius bezieht sich auf den Verwaltungssitz des Gebietes.",
|
||||
"Your current email is {email}. You use it to log in.": "Ihre aktuelle E-Mail-Adresse ist {email}. Sie verwenden sie zum Anmelden.",
|
||||
"Your email": "Ihre E-Mail-Adresse",
|
||||
|
||||
@@ -383,7 +383,7 @@
|
||||
"Your account has been successfully deleted": "Your account has been successfully deleted",
|
||||
"Your account has been validated": "Your account has been validated",
|
||||
"Your account is being validated": "Your account is being validated",
|
||||
"Your account is nearly ready, {username}": "Your account is nearly ready, {username}",
|
||||
"Your account is nearly ready": "Your account is nearly ready",
|
||||
"Your current email is {email}. You use it to log in.": "Your current email is {email}. You use it to log in.",
|
||||
"Your email has been changed": "Your email has been changed",
|
||||
"Your email is being changed": "Your email is being changed",
|
||||
|
||||
@@ -1117,7 +1117,7 @@
|
||||
"Your account has been successfully deleted": "",
|
||||
"Your account has been validated": "",
|
||||
"Your account is being validated": "",
|
||||
"Your account is nearly ready, {username}": "",
|
||||
"Your account is nearly ready": "",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "",
|
||||
"Your current email is {email}. You use it to log in.": "",
|
||||
"Your email": "",
|
||||
|
||||
@@ -1498,7 +1498,7 @@
|
||||
"Your account has been successfully deleted": "Su cuenta ha sido eliminada exitosamente",
|
||||
"Your account has been validated": "Su cuenta ha sido validada",
|
||||
"Your account is being validated": "Su cuenta esta siendo validada",
|
||||
"Your account is nearly ready, {username}": "Su cuenta está casi lista, {username}",
|
||||
"Your account is nearly ready": "Su cuenta está casi lista",
|
||||
"Your application code": "Su código de aplicación",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "Su ciudad o región y el radio solo se utilizarán para sugerirle eventos cercanos. El radio del evento considerará el centro administrativo del área.",
|
||||
"Your current email is {email}. You use it to log in.": "Su correo electrónico actual es {correo electrónico}. Lo usas para iniciar sesión.",
|
||||
|
||||
@@ -1117,7 +1117,7 @@
|
||||
"Your account has been successfully deleted": "",
|
||||
"Your account has been validated": "",
|
||||
"Your account is being validated": "",
|
||||
"Your account is nearly ready, {username}": "",
|
||||
"Your account is nearly ready": "",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "",
|
||||
"Your current email is {email}. You use it to log in.": "",
|
||||
"Your email": "",
|
||||
|
||||
@@ -1125,7 +1125,7 @@
|
||||
"Your account has been successfully deleted": "",
|
||||
"Your account has been validated": "",
|
||||
"Your account is being validated": "",
|
||||
"Your account is nearly ready, {username}": "",
|
||||
"Your account is nearly ready": "",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "",
|
||||
"Your current email is {email}. You use it to log in.": "",
|
||||
"Your email": "",
|
||||
|
||||
@@ -1132,7 +1132,7 @@
|
||||
"Your account has been successfully deleted": "Tilin poistaminen onnistui",
|
||||
"Your account has been validated": "Tilisi on vahvistettu",
|
||||
"Your account is being validated": "Tiliäsi vahvistetaan",
|
||||
"Your account is nearly ready, {username}": "Tilisi on melkein valmis, {username}",
|
||||
"Your account is nearly ready": "Tilisi on melkein valmis",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "Kaupunkisi tai alueesi ja säde käytetään vain ehdottamaan sinulle tapahtumia läheltä. Tapahtuman säde ottaa huomioon alueen hallinnollisen keskustan.",
|
||||
"Your current email is {email}. You use it to log in.": "Nykyinen sähköpostiosoitteesi on {email}. Kirjaudu sisään sillä.",
|
||||
"Your email": "Sähköpostiosoitteesi",
|
||||
|
||||
@@ -170,7 +170,7 @@
|
||||
"Back to user list": "Retour à la liste des utilisateur·ices",
|
||||
"Banner": "Bannière",
|
||||
"Become part of the community and start organizing events": "Faites partie de la communauté et commencez à organiser des événements",
|
||||
"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 ne puissiez vous connecter, vous devez cliquer sur le lien à l'intérieur pour valider votre compte.",
|
||||
"Begins on": "Commence le",
|
||||
"Best match": "Pertinence",
|
||||
"Big Blue Button": "Big Blue Button",
|
||||
@@ -1494,7 +1494,7 @@
|
||||
"Your account has been successfully deleted": "Votre compte a été supprimé avec succès",
|
||||
"Your account has been validated": "Votre compte a été validé",
|
||||
"Your account is being validated": "Votre compte est en cours de validation",
|
||||
"Your account is nearly ready, {username}": "Votre compte est presque prêt, {username}",
|
||||
"Your account is nearly ready": "Votre compte est presque prêt",
|
||||
"Your application code": "Votre code d'application",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "Votre ville ou région et le rayon seront uniquement utilisés pour vous suggérer des événements proches. Le rayon des événements proches sera calculé par rapport au centre administratif de la zone.",
|
||||
"Your current email is {email}. You use it to log in.": "Votre adresse e-mail actuelle est {email}. Vous l'utilisez pour vous connecter.",
|
||||
|
||||
@@ -1195,7 +1195,7 @@
|
||||
"Your account has been successfully deleted": "Chaidh an cunntas agad a sguabadh às",
|
||||
"Your account has been validated": "Chaidh an cunntas agad a dhearbhadh",
|
||||
"Your account is being validated": "Tha an cunntas agad ’ga dhearbhadh",
|
||||
"Your account is nearly ready, {username}": "Cha mhòr nach eil an cunntas gad ullamh, {username}",
|
||||
"Your account is nearly ready": "Cha mhòr nach eil an cunntas gad ullamh",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "Cha dèid am baile no sgìre ’s an t-astar agad a chleachdadh ach airson tachartasan am fagas a mholadh dhut. Bheir astar nan tachartasan an aire air meadhan riaghlaidh na sgìre.",
|
||||
"Your current email is {email}. You use it to log in.": "Is {email} am post-d làithreach agad. Cleachd e airson clàradh a-steach.",
|
||||
"Your email": "Am post-d agad",
|
||||
|
||||
@@ -1497,7 +1497,7 @@
|
||||
"Your account has been successfully deleted": "A túa conta foi eliminada",
|
||||
"Your account has been validated": "A túa conta foi validada",
|
||||
"Your account is being validated": "A túa conta está sendo validada",
|
||||
"Your account is nearly ready, {username}": "A túa conta xa case está preparada, {username}",
|
||||
"Your account is nearly ready": "A túa conta xa case está preparada",
|
||||
"Your application code": "O teu código de aplicación",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "A túa cidade ou rexión e o radio só se utilizará para suxerirche eventos próximos. O radio do evento será considerado desde o centro da área administrativa.",
|
||||
"Your current email is {email}. You use it to log in.": "O teu correo é {email}. Utilízao para acceder.",
|
||||
|
||||
@@ -376,5 +376,5 @@
|
||||
"Your account has been successfully deleted": "החשבון שלך נמחק בהצלחה",
|
||||
"Your account has been validated": "החשבון שלך אומת",
|
||||
"Your account is being validated": "החשבון שלך ממתין לאימות",
|
||||
"Your account is nearly ready, {username}": "החשבון שלך כמעט מוכן, {username}"
|
||||
"Your account is nearly ready": "החשבון שלך כמעט מוכן"
|
||||
}
|
||||
|
||||
@@ -1447,7 +1447,7 @@
|
||||
"Your account has been successfully deleted": "Vaš račun je uspješno izbrisan",
|
||||
"Your account has been validated": "Vaš račun je ovjeren",
|
||||
"Your account is being validated": "Vaš račun se ovjerava",
|
||||
"Your account is nearly ready, {username}": "Vaš račun je uskoro spreman, {username}",
|
||||
"Your account is nearly ready": "Vaš račun je uskoro spreman",
|
||||
"Your application code": "Kȏd tvoje aplikacije",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "Vaš grad/regija i radius će biti korišteni samo za predlaganje obližnjih događaja. Radiu događaja će razmatrati administrativni centar vašeg mjesta.",
|
||||
"Your current email is {email}. You use it to log in.": "Tvoja aktualna e-mail adresa je {email}. Koristiš je za prijavu.",
|
||||
|
||||
@@ -1492,7 +1492,7 @@
|
||||
"Your account has been successfully deleted": "A fiókja sikeresen törölve lett",
|
||||
"Your account has been validated": "A fiókja ellenőrizve lett",
|
||||
"Your account is being validated": "A fiókja ellenőrizés alatt van",
|
||||
"Your account is nearly ready, {username}": "A fiókja majdnem készen, {username}",
|
||||
"Your account is nearly ready": "A fiókja majdnem készen",
|
||||
"Your application code": "Az alkalmazáskódja",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "A települése vagy a régiója és a sugár csak a közeli események ajánlásához lesz használva. Az esemény sugara a terület adminisztratív középpontját veszi figyelembe.",
|
||||
"Your current email is {email}. You use it to log in.": "A jelenlegi e-mail-címe {email}. Használja ezt a bejelentkezéshez.",
|
||||
|
||||
@@ -1128,7 +1128,7 @@
|
||||
"Your account has been successfully deleted": "Akun Anda berhasil dihapus",
|
||||
"Your account has been validated": "Akun Anda telah divalidasi",
|
||||
"Your account is being validated": "Akun Anda sedang di validasi",
|
||||
"Your account is nearly ready, {username}": "Akun Anda hampir siap, {username}",
|
||||
"Your account is nearly ready": "Akun Anda hampir siap",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "",
|
||||
"Your current email is {email}. You use it to log in.": "Email Anda saat ini adalah {email}. Anda menggunakannya untuk masuk.",
|
||||
"Your email": "Email Anda",
|
||||
|
||||
@@ -1489,7 +1489,7 @@
|
||||
"Your account has been successfully deleted": "Il tuo account è stato eliminato con successo",
|
||||
"Your account has been validated": "Il tuo account è stato validato",
|
||||
"Your account is being validated": "Il tuo account è in via di validazione",
|
||||
"Your account is nearly ready, {username}": "Il tuo account è quasi pronto, {username}",
|
||||
"Your account is nearly ready": "Il tuo account è quasi pronto",
|
||||
"Your application code": "Il codice della tua applicazione",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "La tua città o regione e il raggio saranno usati solo per suggerirti eventi nelle vicinanze. Il raggio dell'evento considererà il centro amministrativo della zona.",
|
||||
"Your current email is {email}. You use it to log in.": "La tua email attuale è {email}. La usi per accedere.",
|
||||
|
||||
@@ -1152,7 +1152,7 @@
|
||||
"Your account has been successfully deleted": "あなたのアカウントの削除に成功しました",
|
||||
"Your account has been validated": "あなたのアカウントは認証されました",
|
||||
"Your account is being validated": "",
|
||||
"Your account is nearly ready, {username}": "",
|
||||
"Your account is nearly ready": "",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "",
|
||||
"Your current email is {email}. You use it to log in.": "現在のメールアドレスは{email}です。このアドレスを利用してログインしましょう",
|
||||
"Your email": "メールアドレス",
|
||||
|
||||
@@ -1117,7 +1117,7 @@
|
||||
"Your account has been successfully deleted": "",
|
||||
"Your account has been validated": "",
|
||||
"Your account is being validated": "",
|
||||
"Your account is nearly ready, {username}": "",
|
||||
"Your account is nearly ready": "",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "",
|
||||
"Your current email is {email}. You use it to log in.": "",
|
||||
"Your email": "Imayl-ik",
|
||||
|
||||
@@ -1117,7 +1117,7 @@
|
||||
"Your account has been successfully deleted": "",
|
||||
"Your account has been validated": "",
|
||||
"Your account is being validated": "",
|
||||
"Your account is nearly ready, {username}": "",
|
||||
"Your account is nearly ready": "",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "",
|
||||
"Your current email is {email}. You use it to log in.": "",
|
||||
"Your email": "",
|
||||
|
||||
@@ -1382,7 +1382,7 @@
|
||||
"Your account has been successfully deleted": "Uw account is succesvol verwijderd",
|
||||
"Your account has been validated": "Uw account is gevalideerd",
|
||||
"Your account is being validated": "Uw account wordt gevalideerd",
|
||||
"Your account is nearly ready, {username}": "Uw account is bijna klaar, {username}",
|
||||
"Your account is nearly ready": "Uw account is bijna klaar",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "Uw stad of regio en de straal worden alleen gebruikt om u evenementen in de buurt voor te stellen. De straal van het evenement houdt rekening met het administratieve centrum van het gebied.",
|
||||
"Your current email is {email}. You use it to log in.": "Uw huidige e-mail is {email}. Dit gebruikt u om in te loggen.",
|
||||
"Your email": "Uw e-mailadres",
|
||||
|
||||
@@ -1284,7 +1284,7 @@
|
||||
"Your account has been successfully deleted": "Kontoen din er sletta",
|
||||
"Your account has been validated": "Kontoen din er godkjend",
|
||||
"Your account is being validated": "Kontoen din blir godkjend",
|
||||
"Your account is nearly ready, {username}": "Kontoen din er snart klar, {username}",
|
||||
"Your account is nearly ready": "Kontoen din er snart klar",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "Byen eller området ditt og radiusen blir berre brukt til å føreslå hendingar i nærleiken. Hendingsradiusen går ut frå administrasjonssenteret i området du har valt.",
|
||||
"Your current email is {email}. You use it to log in.": "Epostadressa du har no, er {email}. Du bruker ho til å logga inn.",
|
||||
"Your email": "Epostadressa di",
|
||||
|
||||
@@ -1117,7 +1117,7 @@
|
||||
"Your account has been successfully deleted": "Lo compte es estat corrèctament suprimit",
|
||||
"Your account has been validated": "Vòstre compte es estat validat",
|
||||
"Your account is being validated": "Vòstre compte es en validacion",
|
||||
"Your account is nearly ready, {username}": "Vòstre compte es gaireben prèst, {username}",
|
||||
"Your account is nearly ready": "Vòstre compte es gaireben prèst",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "La vila o la region e lo rai seràn sonque utilizats per vos suggerir d’eveniments prèp. Lo rai dels eveniments prèp serà calculat al respècte al centre administratiu de la zòna.",
|
||||
"Your current email is {email}. You use it to log in.": "Vòstra adreça actuala es {email}. L’utilizatz per vos connectar.",
|
||||
"Your email": "Vòstra adreça electronica",
|
||||
|
||||
@@ -1478,7 +1478,7 @@
|
||||
"Your account has been successfully deleted": "Pomyślnie usunięto Twoje konto",
|
||||
"Your account has been validated": "Twoje konto zostało zweryfikowane",
|
||||
"Your account is being validated": "Twoje konto jest w trakcie walidacji",
|
||||
"Your account is nearly ready, {username}": "Twoje konto jest już prawie gotowe, {username}",
|
||||
"Your account is nearly ready": "Twoje konto jest już prawie gotowe",
|
||||
"Your application code": "Kod do aplikacji",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "Twoje miasto lub region i promień będą używane tylko do sugerowania pobliskich wydarzeń. Promień pobliskich wydarzeń zostanie obliczony w odniesieniu do centrum administracyjnego strefy.",
|
||||
"Your current email is {email}. You use it to log in.": "Twój obecny adres e-mail to {email}. Używasz go, aby się zalogować.",
|
||||
|
||||
@@ -1117,7 +1117,7 @@
|
||||
"Your account has been successfully deleted": "",
|
||||
"Your account has been validated": "",
|
||||
"Your account is being validated": "",
|
||||
"Your account is nearly ready, {username}": "",
|
||||
"Your account is nearly ready": "",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "",
|
||||
"Your current email is {email}. You use it to log in.": "",
|
||||
"Your email": "",
|
||||
|
||||
@@ -1492,7 +1492,7 @@
|
||||
"Your account has been successfully deleted": "Sua conta foi apagada com sucesso",
|
||||
"Your account has been validated": "Sua conta foi validada",
|
||||
"Your account is being validated": "Sua conta esta sendo validada",
|
||||
"Your account is nearly ready, {username}": "Sua conta está quase pronta, {username}",
|
||||
"Your account is nearly ready": "Sua conta está quase pronta",
|
||||
"Your application code": "Seu código de aplicação",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "Sua cidade ou região e o raio serão usados apenas para sugerir eventos próximos. O raio do evento levará em consideração o centro administrativo da área.",
|
||||
"Your current email is {email}. You use it to log in.": "Seu email atual é {email}. Utilize-o para fazer entrar.",
|
||||
|
||||
@@ -1117,7 +1117,7 @@
|
||||
"Your account has been successfully deleted": "Ваша учетная запись была успешно удалена",
|
||||
"Your account has been validated": "Ваша учетная запись была подтверждена",
|
||||
"Your account is being validated": "Ваша учетная запись проверяется",
|
||||
"Your account is nearly ready, {username}": "Ваш аккаунт почти готов, {username}",
|
||||
"Your account is nearly ready": "Ваш аккаунт почти готов",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "Ваш город, регион или область будут использоваться только для рекомендации вам ближайших мероприятий. Радиус мероприятия считается относительно административного центра области.",
|
||||
"Your current email is {email}. You use it to log in.": "Ваш адрес электронной почты {email}. Вы используете его для входа в систему.",
|
||||
"Your email": "Ваш адрес электронной почты",
|
||||
|
||||
@@ -1117,7 +1117,7 @@
|
||||
"Your account has been successfully deleted": "Vaš račun je uspešno izbrisan",
|
||||
"Your account has been validated": "Vaš račun je potrjen",
|
||||
"Your account is being validated": "Vaš račun je v procesu potrjevanja",
|
||||
"Your account is nearly ready, {username}": "Vaš račun je skoraj pripravljen, {username}",
|
||||
"Your account is nearly ready": "Vaš račun je skoraj pripravljen",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "Vaše mesto ali regija in območje bosta uporabljena le za predlaganje dogodkov v bližini. Območje dogodka bo upošteval upravno središče območja.",
|
||||
"Your current email is {email}. You use it to log in.": "Vaš trenutni e-poštni naslov je {email}. Uporabljate ga za prijavo.",
|
||||
"Your email": "Vaša e-pošta",
|
||||
|
||||
@@ -1475,7 +1475,7 @@
|
||||
"Your account has been successfully deleted": "Borttagningen av ditt konto lyckades",
|
||||
"Your account has been validated": "Ditt konto har validerats",
|
||||
"Your account is being validated": "Ditt konto håller på att valideras",
|
||||
"Your account is nearly ready, {username}": "Ditt konto är nästan redo, {username}",
|
||||
"Your account is nearly ready": "Ditt konto är nästan redo",
|
||||
"Your application code": "Din applikationskod",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "Din stad eller region och radien kommer endast att användas för att föreslå evenemang i närheten. Evenemangets radie kommer att ta hänsyn till områdets administrativa centrum.",
|
||||
"Your current email is {email}. You use it to log in.": "Din nuvarande e-postadress är {email}. Du använder den för att logga in.",
|
||||
|
||||
@@ -1289,7 +1289,7 @@
|
||||
"Your account has been successfully deleted": "您的账户已被成功删除",
|
||||
"Your account has been validated": "您的账户已被验证",
|
||||
"Your account is being validated": "您的账户正在验证中",
|
||||
"Your account is nearly ready, {username}": "您的账户已接近准备就绪,{username}",
|
||||
"Your account is nearly ready": "您的账户已接近准备就绪",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "你的城市或地区和半径将只用于向你推荐附近的活动。活动半径将从该地区的行政中心算起。",
|
||||
"Your current email is {email}. You use it to log in.": "你目前的电子邮件地址是{email}。你需要用它来登录。",
|
||||
"Your email": "你的电子邮件",
|
||||
|
||||
@@ -1153,7 +1153,7 @@
|
||||
"Your account has been successfully deleted": "",
|
||||
"Your account has been validated": "",
|
||||
"Your account is being validated": "",
|
||||
"Your account is nearly ready, {username}": "{username},您的帳號就快準備好了",
|
||||
"Your account is nearly ready": "您的帳號就快準備好了",
|
||||
"Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "",
|
||||
"Your current email is {email}. You use it to log in.": "您目前用來登入的電子郵件地址是 {email}。",
|
||||
"Your email": "您的電子郵件地址",
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { beforeRegisterGuard } from "@/router/guards/register-guard";
|
||||
import { RouteLocationNormalized, RouteRecordRaw } from "vue-router";
|
||||
import { RouteRecordRaw } from "vue-router";
|
||||
import { i18n } from "@/utils/i18n";
|
||||
|
||||
const t = i18n.global.t;
|
||||
|
||||
export enum UserRouteName {
|
||||
REGISTER = "Register",
|
||||
REGISTER_PROFILE = "RegisterProfile",
|
||||
RESEND_CONFIRMATION = "ResendConfirmation",
|
||||
SEND_PASSWORD_RESET = "SendPasswordReset",
|
||||
PASSWORD_RESET = "PasswordReset",
|
||||
@@ -29,20 +28,6 @@ export const userRoutes: RouteRecordRaw[] = [
|
||||
},
|
||||
beforeEnter: beforeRegisterGuard,
|
||||
},
|
||||
{
|
||||
path: "/register/profile/:email/:userAlreadyActivated?",
|
||||
name: UserRouteName.REGISTER_PROFILE,
|
||||
component: (): Promise<any> => import("@/views/Account/RegisterView.vue"),
|
||||
// We can only pass string values through params, therefore
|
||||
props: (route: RouteLocationNormalized): Record<string, unknown> => ({
|
||||
email: route.params.email,
|
||||
userAlreadyActivated: route.params.userAlreadyActivated === "true",
|
||||
}),
|
||||
meta: {
|
||||
requiredAuth: false,
|
||||
announcer: { message: (): string => t("Register") as string },
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/resend-instructions/:email?",
|
||||
name: UserRouteName.RESEND_CONFIRMATION,
|
||||
|
||||
@@ -43,25 +43,21 @@ export async function initializeCurrentActor(
|
||||
const actorId = localStorage.getItem(AUTH_USER_ACTOR_ID);
|
||||
console.debug("Initializing current actor", actorId);
|
||||
|
||||
try {
|
||||
if (!identities) {
|
||||
console.debug("Failed to load user's identities", identities);
|
||||
return;
|
||||
}
|
||||
if (!identities) {
|
||||
console.debug("Failed to load user's identities", identities);
|
||||
return;
|
||||
}
|
||||
|
||||
if (identities && identities.length < 1) {
|
||||
console.warn("Logged user has no identities!");
|
||||
throw new NoIdentitiesException();
|
||||
}
|
||||
const activeIdentity =
|
||||
(identities || []).find(
|
||||
(identity: IPerson | undefined) => identity?.id === actorId
|
||||
) || ((identities || [])[0] as IPerson);
|
||||
if (identities && identities.length < 1) {
|
||||
console.warn("Logged user has no identities!");
|
||||
throw new NoIdentitiesException();
|
||||
}
|
||||
const activeIdentity =
|
||||
(identities || []).find(
|
||||
(identity: IPerson | undefined) => identity?.id === actorId
|
||||
) || ((identities || [])[0] as IPerson);
|
||||
|
||||
if (activeIdentity) {
|
||||
await changeIdentity(activeIdentity);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Failed to initialize current Actor", e);
|
||||
if (activeIdentity) {
|
||||
await changeIdentity(activeIdentity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,233 +0,0 @@
|
||||
<template>
|
||||
<section class="container mx-auto max-w-screen-sm">
|
||||
<h1 class="text-2xl" v-if="userAlreadyActivated">
|
||||
{{ t("Congratulations, your account is now created!") }}
|
||||
</h1>
|
||||
<h1 class="text-2xl" v-else>
|
||||
{{
|
||||
t("Register an account on {instanceName}!", {
|
||||
instanceName,
|
||||
})
|
||||
}}
|
||||
</h1>
|
||||
<p class="prose dark:prose-invert" v-if="userAlreadyActivated">
|
||||
{{ t("Now, create your first profile:") }}
|
||||
</p>
|
||||
<form v-if="!validationSent" @submit.prevent="submit">
|
||||
<o-notification variant="danger" v-if="errors.extra">
|
||||
{{ errors.extra }}
|
||||
</o-notification>
|
||||
|
||||
<o-field :label="t('Displayed nickname')" labelFor="identityName">
|
||||
<o-input
|
||||
aria-required="true"
|
||||
required
|
||||
v-model="identity.name"
|
||||
id="identityName"
|
||||
expanded
|
||||
@update:modelValue="(value: string) => updateUsername(value)"
|
||||
/>
|
||||
</o-field>
|
||||
|
||||
<o-field
|
||||
:label="t('Username')"
|
||||
:variant="errors.preferred_username ? 'danger' : 'primary'"
|
||||
:message="errors.preferred_username"
|
||||
labelFor="identityPreferredUsername"
|
||||
>
|
||||
<o-field
|
||||
:message="
|
||||
t(
|
||||
'Only alphanumeric lowercased characters and underscores are supported.'
|
||||
)
|
||||
"
|
||||
>
|
||||
<o-input
|
||||
aria-required="true"
|
||||
required
|
||||
expanded
|
||||
id="identityPreferredUsername"
|
||||
v-model="identity.preferredUsername"
|
||||
:variant="errors.preferred_username ? 'danger' : ''"
|
||||
:validation-message="
|
||||
identity.preferredUsername
|
||||
? t(
|
||||
'Only alphanumeric lowercased characters and underscores are supported.'
|
||||
)
|
||||
: null
|
||||
"
|
||||
/>
|
||||
<p class="control">
|
||||
<span class="button">@{{ host }}</span>
|
||||
</p>
|
||||
</o-field>
|
||||
</o-field>
|
||||
<p class="prose dark:prose-invert">
|
||||
{{
|
||||
t(
|
||||
"This identifier is unique to your profile. It allows others to find you."
|
||||
)
|
||||
}}
|
||||
</p>
|
||||
|
||||
<o-field :label="t('Short bio')" labelFor="identitySummary">
|
||||
<o-input
|
||||
type="textarea"
|
||||
maxlength="100"
|
||||
rows="2"
|
||||
id="identitySummary"
|
||||
v-model="identity.summary"
|
||||
expanded
|
||||
/>
|
||||
</o-field>
|
||||
|
||||
<p class="prose dark:prose-invert">
|
||||
{{
|
||||
t(
|
||||
"You will be able to add an avatar and set other options in your account settings."
|
||||
)
|
||||
}}
|
||||
</p>
|
||||
|
||||
<p class="text-center">
|
||||
<o-button
|
||||
variant="primary"
|
||||
size="large"
|
||||
native-type="submit"
|
||||
:disabled="sendingValidation"
|
||||
>{{ t("Create my profile") }}</o-button
|
||||
>
|
||||
</p>
|
||||
</form>
|
||||
|
||||
<div v-if="validationSent && !userAlreadyActivated">
|
||||
<o-notification variant="success" :closable="false">
|
||||
<h2 class="title">
|
||||
{{
|
||||
t("Your account is nearly ready, {username}", {
|
||||
username: identity.name ?? identity.preferredUsername,
|
||||
})
|
||||
}}
|
||||
</h2>
|
||||
<i18n-t keypath="A validation email was sent to {email}" tag="p">
|
||||
<template #email>
|
||||
<code>{{ email }}</code>
|
||||
</template>
|
||||
</i18n-t>
|
||||
<p>
|
||||
{{
|
||||
t(
|
||||
"Before you can login, you need to click on the link inside it to validate your account."
|
||||
)
|
||||
}}
|
||||
</p>
|
||||
<o-button tag="router-link" :to="{ name: RouteName.HOME }">{{
|
||||
t("Back to homepage")
|
||||
}}</o-button>
|
||||
</o-notification>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { Person } from "../../types/actor";
|
||||
import { MOBILIZON_INSTANCE_HOST } from "../../api/_entrypoint";
|
||||
import RouteName from "../../router/name";
|
||||
import { changeIdentity } from "../../utils/identity";
|
||||
import { useInstanceName } from "@/composition/apollo/config";
|
||||
import { ref, computed, onBeforeMount } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import { registerAccount } from "@/composition/apollo/user";
|
||||
import { convertToUsername } from "@/utils/username";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { useHead } from "@/utils/head";
|
||||
import { getValueFromMeta } from "@/utils/html";
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
email: string;
|
||||
userAlreadyActivated?: boolean;
|
||||
}>(),
|
||||
{
|
||||
userAlreadyActivated: false,
|
||||
}
|
||||
);
|
||||
|
||||
const { instanceName } = useInstanceName();
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const { t } = useI18n({ useScope: "global" });
|
||||
|
||||
useHead({
|
||||
title: computed(() => t("Register")),
|
||||
});
|
||||
|
||||
const host: string = MOBILIZON_INSTANCE_HOST;
|
||||
|
||||
const errors = ref<Record<string, unknown>>({});
|
||||
|
||||
const validationSent = ref(false);
|
||||
|
||||
const sendingValidation = ref(false);
|
||||
|
||||
const identity = ref(new Person());
|
||||
|
||||
onBeforeMount(() => {
|
||||
// Make sure no one goes to this page if we don't want to
|
||||
if (!props.email) {
|
||||
router.replace({ name: RouteName.PAGE_NOT_FOUND });
|
||||
}
|
||||
const username = getValueFromMeta("auth-user-suggested-actor-username");
|
||||
const name = getValueFromMeta("auth-user-suggested-actor-name");
|
||||
if (username) {
|
||||
identity.value.preferredUsername = convertToUsername(username);
|
||||
}
|
||||
if (name) {
|
||||
identity.value.name = name;
|
||||
}
|
||||
});
|
||||
|
||||
const updateUsername = (value: string) => {
|
||||
identity.value.preferredUsername = convertToUsername(value);
|
||||
};
|
||||
|
||||
const { onDone, onError, mutate } = registerAccount();
|
||||
|
||||
onDone(async ({ data }) => {
|
||||
validationSent.value = true;
|
||||
window.localStorage.setItem("new-registered-user", "yes");
|
||||
|
||||
if (data && props.userAlreadyActivated) {
|
||||
await changeIdentity(data.registerPerson);
|
||||
|
||||
await router.push({ name: RouteName.HOME });
|
||||
}
|
||||
});
|
||||
|
||||
onError((err) => {
|
||||
errors.value = err.graphQLErrors.reduce(
|
||||
(acc: { [key: string]: string }, error: any) => {
|
||||
acc[error.details ?? error.field ?? "extra"] = Array.isArray(
|
||||
error.message
|
||||
)
|
||||
? (error.message as string[]).join(",")
|
||||
: error.message;
|
||||
return acc;
|
||||
},
|
||||
{}
|
||||
);
|
||||
console.error("Error while registering person", err);
|
||||
console.error("Errors while registering person", errors);
|
||||
sendingValidation.value = false;
|
||||
});
|
||||
|
||||
const submit = async (): Promise<void> => {
|
||||
sendingValidation.value = true;
|
||||
errors.value = {};
|
||||
mutate(
|
||||
{ email: props.email, ...identity.value },
|
||||
{ context: { userAlreadyActivated: props.userAlreadyActivated } }
|
||||
);
|
||||
};
|
||||
</script>
|
||||
@@ -6,9 +6,13 @@
|
||||
<span v-if="isUpdate" class="line-clamp-2">{{
|
||||
displayName(identity)
|
||||
}}</span>
|
||||
<span v-else>{{ t("I create an identity") }}</span>
|
||||
<span v-else>{{ t("Create a new profile") }}</span>
|
||||
</h1>
|
||||
<o-field horizontal :label="t('Avatar')">
|
||||
<div v-if="identities?.length == 0">
|
||||
{{ t("Congratulations, your account is now created!") }}
|
||||
{{ t("Now, create your first profile:") }}
|
||||
</div>
|
||||
<o-field :label="t('Avatar')">
|
||||
<picture-upload
|
||||
v-model="avatarFile"
|
||||
:defaultImage="identity.avatar"
|
||||
@@ -16,11 +20,7 @@
|
||||
/>
|
||||
</o-field>
|
||||
|
||||
<o-field
|
||||
horizontal
|
||||
:label="t('Display name')"
|
||||
label-for="identity-display-name"
|
||||
>
|
||||
<o-field :label="t('Display name')" label-for="identity-display-name">
|
||||
<o-input
|
||||
aria-required="true"
|
||||
required
|
||||
@@ -33,7 +33,6 @@
|
||||
</o-field>
|
||||
|
||||
<o-field
|
||||
horizontal
|
||||
class="username-field"
|
||||
:label="t('Username')"
|
||||
label-for="identity-username"
|
||||
@@ -59,11 +58,15 @@
|
||||
</o-field>
|
||||
</o-field>
|
||||
|
||||
<o-field
|
||||
horizontal
|
||||
:label="t('Description')"
|
||||
label-for="identity-summary"
|
||||
>
|
||||
<p class="prose dark:prose-invert">
|
||||
{{
|
||||
t(
|
||||
"This identifier is unique to your profile. It allows others to find you."
|
||||
)
|
||||
}}
|
||||
</p>
|
||||
|
||||
<o-field :label="t('Description')" label-for="identity-summary">
|
||||
<o-input
|
||||
type="textarea"
|
||||
dir="auto"
|
||||
@@ -87,7 +90,7 @@
|
||||
<o-field class="flex justify-center !my-6">
|
||||
<div class="control">
|
||||
<o-button type="button" variant="primary" @click="submit()">
|
||||
{{ t("Save") }}
|
||||
{{ t("Create my profile") }}
|
||||
</o-button>
|
||||
</div>
|
||||
</o-field>
|
||||
@@ -107,7 +110,9 @@
|
||||
<p>
|
||||
{{
|
||||
t(
|
||||
"These feeds contain event data for the events for which this specific profile is a participant or creator. You should keep these private. You can find feeds for all of your profiles into your notification settings."
|
||||
"These feeds contain event data for the events for which this specific profile is a participant or creator." +
|
||||
"You should keep these private." +
|
||||
" You can find feeds for all of your profiles into your notification settings."
|
||||
)
|
||||
}}
|
||||
</p>
|
||||
@@ -214,7 +219,10 @@ import { ApolloCache, FetchResult, InMemoryCache } from "@apollo/client/core";
|
||||
import pick from "lodash/pick";
|
||||
import { ActorType } from "@/types/enums";
|
||||
import { useRouter } from "vue-router";
|
||||
import { useCurrentActorClient } from "@/composition/apollo/actor";
|
||||
import {
|
||||
useCurrentActorClient,
|
||||
useCurrentUserIdentities,
|
||||
} from "@/composition/apollo/actor";
|
||||
import { useMutation, useQuery, useApolloClient } from "@vue/apollo-composable";
|
||||
import { useAvatarMaxSize } from "@/composition/config";
|
||||
import { computed, inject, reactive, ref, watch } from "vue";
|
||||
@@ -233,6 +241,8 @@ const props = defineProps<{ isUpdate: boolean; identityName?: string }>();
|
||||
|
||||
const { currentActor } = useCurrentActorClient();
|
||||
|
||||
const { identities } = useCurrentUserIdentities();
|
||||
|
||||
const {
|
||||
result: personResult,
|
||||
onError: onPersonError,
|
||||
@@ -459,13 +469,22 @@ const {
|
||||
},
|
||||
}));
|
||||
|
||||
createIdentityDone(() => {
|
||||
createIdentityDone(async () => {
|
||||
notifier?.success(
|
||||
t("Identity {displayName} created", {
|
||||
displayName: displayName(identity.value),
|
||||
})
|
||||
);
|
||||
|
||||
// If it is the fisrt created identity, then we need to activate this identity
|
||||
const client = resolveClient();
|
||||
const data = client.readQuery<{
|
||||
loggedUser: Pick<ICurrentUser, "actors">;
|
||||
}>({ query: IDENTITIES });
|
||||
if (data) {
|
||||
await maybeUpdateCurrentActorCache(data.loggedUser.actors[0]);
|
||||
}
|
||||
|
||||
router.push({
|
||||
name: RouteName.UPDATE_IDENTITY,
|
||||
params: { identityName: identity.value.preferredUsername },
|
||||
@@ -687,8 +706,11 @@ const redirectIfNoIdentitySelected = async (identityParam?: string) => {
|
||||
|
||||
const maybeUpdateCurrentActorCache = async (newIdentity: IPerson) => {
|
||||
if (currentActor.value) {
|
||||
// If there is no current actor, update the current actor
|
||||
if (
|
||||
currentActor.value.preferredUsername === identity.value.preferredUsername
|
||||
currentActor.value.preferredUsername ===
|
||||
identity.value.preferredUsername ||
|
||||
currentActor.value.id == null
|
||||
) {
|
||||
await changeIdentity(newIdentity);
|
||||
}
|
||||
|
||||
@@ -268,11 +268,7 @@ const loginAction = async (e: Event) => {
|
||||
if (err instanceof NoIdentitiesException && currentUser.value) {
|
||||
console.debug("No identities, redirecting to profile registration");
|
||||
await router.push({
|
||||
name: RouteName.REGISTER_PROFILE,
|
||||
params: {
|
||||
email: currentUser.value.email,
|
||||
userAlreadyActivated: "true",
|
||||
},
|
||||
name: RouteName.CREATE_IDENTITY,
|
||||
});
|
||||
} else {
|
||||
console.error(err);
|
||||
|
||||
@@ -50,7 +50,7 @@ onUpdateCurrentUserClientDone(async () => {
|
||||
await changeIdentity(loggedUser.defaultActor);
|
||||
await router.push({ name: RouteName.HOME });
|
||||
} else {
|
||||
// No need to push to REGISTER_PROFILE, the navbar will do it for us
|
||||
// No need to push to CREATE_IDENTITY, the navbar will do it for us
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
</i18n-t>
|
||||
</div>
|
||||
</div>
|
||||
<div class="">
|
||||
<div v-if="!validationSent">
|
||||
<o-notification variant="warning" v-if="config?.registrationsAllowlist">
|
||||
{{ t("Registrations are restricted by allowlisting.") }}
|
||||
</o-notification>
|
||||
@@ -199,6 +199,29 @@
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div v-else>
|
||||
<h2 class="title my-5">
|
||||
{{ t("Your account is nearly ready") }}
|
||||
</h2>
|
||||
<i18n-t keypath="A validation email was sent to {email}" tag="p">
|
||||
<template #email>
|
||||
<code>{{ credentials.email }}</code>
|
||||
</template>
|
||||
</i18n-t>
|
||||
<p>
|
||||
{{
|
||||
t(
|
||||
"Before you can login, you need to click on the link inside it to validate your account."
|
||||
)
|
||||
}}
|
||||
</p>
|
||||
<o-button
|
||||
class="mt-5"
|
||||
tag="router-link"
|
||||
:to="{ name: RouteName.HOME }"
|
||||
>{{ t("Back to homepage") }}</o-button
|
||||
>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
@@ -212,7 +235,7 @@ import AuthProviders from "../../components/User/AuthProviders.vue";
|
||||
import { computed, reactive, ref, watch } from "vue";
|
||||
import { useMutation, useQuery } from "@vue/apollo-composable";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { useRoute } from "vue-router";
|
||||
import { useHead } from "@/utils/head";
|
||||
import { AbsintheGraphQLErrors } from "@/types/errors.model";
|
||||
|
||||
@@ -222,7 +245,7 @@ type credentialsType = { email: string; password: string; locale: string };
|
||||
|
||||
const { t, locale } = useI18n({ useScope: "global" });
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const validationSent = ref(false);
|
||||
|
||||
const { result: configResult } = useQuery<{ config: IConfig }>(CONFIG);
|
||||
|
||||
@@ -256,10 +279,7 @@ useHead({
|
||||
const { onDone, onError, mutate } = useMutation(CREATE_USER);
|
||||
|
||||
onDone(() => {
|
||||
router.push({
|
||||
name: RouteName.REGISTER_PROFILE,
|
||||
params: { email: credentials.email },
|
||||
});
|
||||
validationSent.value = true;
|
||||
});
|
||||
|
||||
onError((error) => {
|
||||
|
||||
@@ -72,8 +72,7 @@ onUpdatingCurrentUserClientDone(async () => {
|
||||
} else {
|
||||
// If the user didn't register any profile yet, let's create one for them
|
||||
await router.push({
|
||||
name: RouteName.REGISTER_PROFILE,
|
||||
params: { email: user.value?.email, userAlreadyActivated: "true" },
|
||||
name: RouteName.CREATE_IDENTITY,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user