From bde7206a1ca44fdf96d817921bb1efc497dcae40 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 7 Sep 2023 11:56:49 +0200 Subject: [PATCH 1/4] fix(auth): small front fixes in 3rd-party auth provider callback Signed-off-by: Thomas Citharel --- js/src/composition/apollo/user.ts | 2 +- js/src/views/User/ProviderValidation.vue | 30 +++++++++++++++--------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/js/src/composition/apollo/user.ts b/js/src/composition/apollo/user.ts index b1459ff2..49687840 100644 --- a/js/src/composition/apollo/user.ts +++ b/js/src/composition/apollo/user.ts @@ -80,7 +80,7 @@ export function registerAccount() { ) => { if (context?.userAlreadyActivated) { const currentUserData = store.readQuery<{ - loggedUser: Pick; + loggedUser: Pick; }>({ query: IDENTITIES, }); diff --git a/js/src/views/User/ProviderValidation.vue b/js/src/views/User/ProviderValidation.vue index db790f30..89cabb26 100644 --- a/js/src/views/User/ProviderValidation.vue +++ b/js/src/views/User/ProviderValidation.vue @@ -36,7 +36,10 @@ const userRole = getValueFromMeta("auth-user-role") as ICurrentUserRole; const router = useRouter(); -const { onDone, mutate } = useMutation< +const { + onDone: onUpdateCurrentUserClientDone, + mutate: updateCurrentUserClient, +} = useMutation< { updateCurrentUser: ICurrentUser }, { id: string; email: string; isLoggedIn: boolean; role: ICurrentUserRole } >(UPDATE_CURRENT_USER_CLIENT); @@ -45,16 +48,19 @@ const { onResult: onLoggedUserResult, load: loadUser } = useLazyQuery<{ loggedUser: IUser; }>(LOGGED_USER); -onDone(async () => { +onUpdateCurrentUserClientDone(async () => { loadUser(); - onLoggedUserResult(async ({ data: { loggedUser } }) => { - if (loggedUser.defaultActor) { - 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 - } - }); +}); + +onLoggedUserResult(async (result) => { + if (result.loading) return; + const loggedUser = result.data.loggedUser; + if (loggedUser.defaultActor) { + 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 + } }); onMounted(async () => { @@ -67,13 +73,15 @@ onMounted(async () => { email: userEmail, role: userRole, isLoggedIn: true, + defaultActor: undefined, + actors: [], }, accessToken, refreshToken, }; saveUserData(login); - mutate({ + updateCurrentUserClient({ id: userId, email: userEmail, isLoggedIn: true, From 7e13e2baa7690d5dfc4a8b12097a4ed85ea825d7 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 7 Sep 2023 11:57:09 +0200 Subject: [PATCH 2/4] fix(front): fixes in EditIdentity view Signed-off-by: Thomas Citharel --- js/src/assets/oruga-tailwindcss.css | 6 ++ .../views/Account/children/EditIdentity.vue | 74 ++++++++----------- 2 files changed, 36 insertions(+), 44 deletions(-) diff --git a/js/src/assets/oruga-tailwindcss.css b/js/src/assets/oruga-tailwindcss.css index 81d623e0..2583e89f 100644 --- a/js/src/assets/oruga-tailwindcss.css +++ b/js/src/assets/oruga-tailwindcss.css @@ -65,9 +65,15 @@ body { .field-label { @apply block text-gray-700 dark:text-gray-100 text-base font-bold mb-2; } +.o-field--horizontal.field { + @apply items-center; +} .o-field__horizontal-label .field-label { @apply mb-0; } +.o-field__horizontal-body > .field { + @apply mt-0; +} .field-danger { @apply text-red-500; } diff --git a/js/src/views/Account/children/EditIdentity.vue b/js/src/views/Account/children/EditIdentity.vue index 2873cd79..65f6123a 100644 --- a/js/src/views/Account/children/EditIdentity.vue +++ b/js/src/views/Account/children/EditIdentity.vue @@ -2,24 +2,23 @@
-

+

{{ displayName(identity) }} - {{ $t("I create an identity") }} + {{ t("I create an identity") }}

- + {{ error }} - +
- {{ $t("Save") }} + {{ t("Save") }}
- + - {{ $t("Delete this identity") }} + {{ t("Delete this identity") }}
-

{{ $t("Profile feeds") }}

+

{{ t("Profile feeds") }}

{{ - $t( + 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." ) }} @@ -116,7 +116,7 @@ :key="feedToken.token" > {{ $t("RSS/Atom Feed") }}{{ t("RSS/Atom Feed") }} {{ $t("ICS/WebCal Feed") }}{{ t("ICS/WebCal Feed") }} {{ $t("Regenerate new links") }}{{ t("Regenerate new links") }}

@@ -166,7 +166,7 @@ icon-left="refresh" variant="text" @click="generateFeedTokens" - >{{ $t("Create new links") }}{{ t("Create new links") }} @@ -176,28 +176,14 @@