| 
									
										
										
										
											2021-07-31 15:07:19 -08:00
										 |  |  | <template> | 
					
						
							| 
									
										
										
										
											2022-02-23 15:04:45 -09:00
										 |  |  |   <v-container | 
					
						
							|  |  |  |     fill-height | 
					
						
							|  |  |  |     fluid | 
					
						
							| 
									
										
										
										
											2023-08-21 20:41:18 +02:00
										 |  |  |     class="d-flex justify-center align-center flex-column" | 
					
						
							| 
									
										
										
										
											2022-02-23 15:04:45 -09:00
										 |  |  |     :class="{ | 
					
						
							| 
									
										
										
										
											2022-03-15 17:34:53 -08:00
										 |  |  |       'bg-off-white': !$vuetify.theme.dark && !isDark, | 
					
						
							| 
									
										
										
										
											2022-02-23 15:04:45 -09:00
										 |  |  |     }" | 
					
						
							|  |  |  |   > | 
					
						
							| 
									
										
										
										
											2023-11-15 09:24:24 -06:00
										 |  |  |     <v-alert v-if="isFirstLogin" class="my-4" type="info" icon="mdi-information"> | 
					
						
							|  |  |  |       <div> | 
					
						
							|  |  |  |         <p class="mb-3"> | 
					
						
							|  |  |  |           {{ $tc('user.it-looks-like-this-is-your-first-time-logging-in')}} | 
					
						
							|  |  |  |         </p> | 
					
						
							|  |  |  |         <p class="mb-1"><strong>{{ $tc('user.username') }}:</strong> changeme@example.com</p> | 
					
						
							|  |  |  |         <p class="mb-3"><strong>{{  $tc('user.password') }}:</strong> MyPassword</p> | 
					
						
							|  |  |  |         <p> | 
					
						
							|  |  |  |           {{  $tc('user.dont-want-to-see-this-anymore-be-sure-to-change-your-email') }} | 
					
						
							|  |  |  |         </p> | 
					
						
							|  |  |  |       </div> | 
					
						
							|  |  |  |     </v-alert> | 
					
						
							| 
									
										
										
										
											2022-02-22 11:36:58 -09:00
										 |  |  |     <v-card tag="section" class="d-flex flex-column align-center" width="600px"> | 
					
						
							|  |  |  |       <v-toolbar width="100%" color="primary" class="d-flex justify-center mb-4" dark> | 
					
						
							|  |  |  |         <v-toolbar-title class="headline text-h4"> Mealie </v-toolbar-title> | 
					
						
							|  |  |  |       </v-toolbar> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       <div class="icon-container"> | 
					
						
							|  |  |  |         <v-divider class="icon-divider"></v-divider> | 
					
						
							| 
									
										
										
										
											2022-02-23 15:04:45 -09:00
										 |  |  |         <v-avatar class="pa-2 icon-avatar" color="primary" size="100"> | 
					
						
							|  |  |  |           <svg class="icon-white" style="width: 100px; height: 100px" viewBox="0 0 24 24"> | 
					
						
							|  |  |  |             <path | 
					
						
							|  |  |  |               d="M8.1,13.34L3.91,9.16C2.35,7.59 2.35,5.06 3.91,3.5L10.93,10.5L8.1,13.34M13.41,13L20.29,19.88L18.88,21.29L12,14.41L5.12,21.29L3.71,19.88L13.36,10.22L13.16,10C12.38,9.23 12.38,7.97 13.16,7.19L17.5,2.82L18.43,3.74L15.19,7L16.15,7.94L19.39,4.69L20.31,5.61L17.06,8.85L18,9.81L21.26,6.56L22.18,7.5L17.81,11.84C17.03,12.62 15.77,12.62 15,11.84L14.78,11.64L13.41,13Z" | 
					
						
							|  |  |  |             /> | 
					
						
							|  |  |  |           </svg> | 
					
						
							| 
									
										
										
										
											2022-02-22 11:36:58 -09:00
										 |  |  |         </v-avatar> | 
					
						
							|  |  |  |       </div> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-21 20:41:18 +02:00
										 |  |  |       <v-card-title class="headline justify-center pb-3"> {{ $t('user.sign-in') }} </v-card-title> | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  |       <v-card-text> | 
					
						
							| 
									
										
										
										
											2022-03-22 20:41:54 -08:00
										 |  |  |         <v-form @submit.prevent="authenticate"> | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  |           <v-text-field | 
					
						
							|  |  |  |             v-model="form.email" | 
					
						
							| 
									
										
										
										
											2022-02-22 11:36:58 -09:00
										 |  |  |             :prepend-inner-icon="$globals.icons.email" | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  |             filled | 
					
						
							|  |  |  |             rounded | 
					
						
							|  |  |  |             autofocus | 
					
						
							|  |  |  |             class="rounded-lg" | 
					
						
							|  |  |  |             name="login" | 
					
						
							| 
									
										
										
										
											2023-01-29 02:39:51 +01:00
										 |  |  |             :label="$t('user.email-or-username')" | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  |             type="text" | 
					
						
							|  |  |  |           /> | 
					
						
							|  |  |  |           <v-text-field | 
					
						
							|  |  |  |             id="password" | 
					
						
							|  |  |  |             v-model="form.password" | 
					
						
							| 
									
										
										
										
											2022-02-22 11:36:58 -09:00
										 |  |  |             :prepend-inner-icon="$globals.icons.lock" | 
					
						
							| 
									
										
										
										
											2022-03-22 20:41:54 -08:00
										 |  |  |             :append-icon="passwordIcon" | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  |             filled | 
					
						
							|  |  |  |             rounded | 
					
						
							|  |  |  |             class="rounded-lg" | 
					
						
							|  |  |  |             name="password" | 
					
						
							| 
									
										
										
										
											2023-01-29 02:39:51 +01:00
										 |  |  |             :label="$t('user.password')" | 
					
						
							| 
									
										
										
										
											2022-03-22 20:41:54 -08:00
										 |  |  |             :type="inputType" | 
					
						
							|  |  |  |             @click:append="togglePasswordShow" | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  |           /> | 
					
						
							| 
									
										
										
										
											2023-01-29 02:39:51 +01:00
										 |  |  |           <v-checkbox v-model="form.remember" class="ml-2 mt-n2" :label="$t('user.remember-me')"></v-checkbox> | 
					
						
							| 
									
										
										
										
											2022-02-22 11:36:58 -09:00
										 |  |  |           <v-card-actions class="justify-center pt-0"> | 
					
						
							| 
									
										
										
										
											2021-10-02 12:18:01 -08:00
										 |  |  |             <div class="max-button"> | 
					
						
							| 
									
										
										
										
											2024-10-05 16:12:11 -05:00
										 |  |  |               <v-btn :loading="loggingIn" :disabled="oidcLoggingIn" color="primary" type="submit" large rounded class="rounded-xl" block> | 
					
						
							| 
									
										
										
										
											2021-10-02 12:18:01 -08:00
										 |  |  |                 {{ $t("user.login") }} | 
					
						
							|  |  |  |               </v-btn> | 
					
						
							|  |  |  |             </div> | 
					
						
							|  |  |  |           </v-card-actions> | 
					
						
							| 
									
										
										
										
											2024-03-10 13:51:36 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |           <div v-if="allowOidc" class="d-flex my-4 justify-center align-center" width="80%"> | 
					
						
							|  |  |  |             <v-divider class="div-width"/> | 
					
						
							|  |  |  |             <span | 
					
						
							|  |  |  |                 class="absolute px-2" | 
					
						
							|  |  |  |                 :class="{ | 
					
						
							|  |  |  |                     'bg-white': !$vuetify.theme.dark && !isDark, | 
					
						
							|  |  |  |                     'bg-background': $vuetify.theme.dark || isDark, | 
					
						
							|  |  |  |                 }" | 
					
						
							|  |  |  |             > | 
					
						
							|  |  |  |                 {{ $t("user.or") }} | 
					
						
							|  |  |  |             </span> | 
					
						
							|  |  |  |           </div> | 
					
						
							|  |  |  |           <v-card-actions v-if="allowOidc" class="justify-center"> | 
					
						
							|  |  |  |           <div class="max-button"> | 
					
						
							| 
									
										
										
										
											2024-10-05 16:12:11 -05:00
										 |  |  |             <v-btn :loading="oidcLoggingIn" color="primary" large rounded class="rounded-xl" block @click.native="() => oidcAuthenticate()"> | 
					
						
							| 
									
										
										
										
											2024-03-10 13:51:36 -05:00
										 |  |  |                 {{ $t("user.login-oidc") }} {{ oidcProviderName }} | 
					
						
							|  |  |  |             </v-btn> | 
					
						
							|  |  |  |           </div> | 
					
						
							|  |  |  |         </v-card-actions> | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  |         </v-form> | 
					
						
							|  |  |  |       </v-card-text> | 
					
						
							| 
									
										
										
										
											2023-10-07 21:36:47 +02:00
										 |  |  |       <v-card-actions class="d-flex justify-center flex-column flex-sm-row"> | 
					
						
							| 
									
										
										
										
											2021-10-07 09:39:47 -08:00
										 |  |  |         <v-btn v-if="allowSignup" text to="/register"> {{ $t("user.register") }} </v-btn> | 
					
						
							|  |  |  |         <v-btn v-else text disabled> {{ $t("user.invite-only") }} </v-btn> | 
					
						
							|  |  |  |         <v-btn class="mr-auto" text to="/forgot-password"> {{ $t("user.reset-password") }} </v-btn> | 
					
						
							|  |  |  |       </v-card-actions> | 
					
						
							| 
									
										
										
										
											2022-02-22 11:36:58 -09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-21 20:41:18 +02:00
										 |  |  |       <v-card-text class="d-flex justify-center flex-column flex-sm-row"> | 
					
						
							| 
									
										
										
										
											2022-02-22 11:36:58 -09:00
										 |  |  |         <div | 
					
						
							|  |  |  |           v-for="link in [ | 
					
						
							|  |  |  |             { | 
					
						
							| 
									
										
										
										
											2023-01-29 02:39:51 +01:00
										 |  |  |               text: $t('about.sponsor'), | 
					
						
							| 
									
										
										
										
											2022-02-22 11:36:58 -09:00
										 |  |  |               icon: $globals.icons.heart, | 
					
						
							|  |  |  |               href: 'https://github.com/sponsors/hay-kot', | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             { | 
					
						
							| 
									
										
										
										
											2023-01-29 02:39:51 +01:00
										 |  |  |               text: $t('about.github'), | 
					
						
							| 
									
										
										
										
											2022-02-22 11:36:58 -09:00
										 |  |  |               icon: $globals.icons.github, | 
					
						
							|  |  |  |               href: 'https://github.com/hay-kot/mealie', | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             { | 
					
						
							| 
									
										
										
										
											2023-01-29 02:39:51 +01:00
										 |  |  |               text: $t('about.docs'), | 
					
						
							| 
									
										
										
										
											2022-02-22 11:36:58 -09:00
										 |  |  |               icon: $globals.icons.folderOutline, | 
					
						
							|  |  |  |               href: 'https://docs.mealie.io/', | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |           ]" | 
					
						
							|  |  |  |           :key="link.text" | 
					
						
							| 
									
										
										
										
											2023-08-21 20:41:18 +02:00
										 |  |  |           class="text-center" | 
					
						
							| 
									
										
										
										
											2022-02-22 11:36:58 -09:00
										 |  |  |         > | 
					
						
							|  |  |  |           <v-btn text :href="link.href" target="_blank"> | 
					
						
							|  |  |  |             <v-icon left> | 
					
						
							|  |  |  |               {{ link.icon }} | 
					
						
							|  |  |  |             </v-icon> | 
					
						
							|  |  |  |             {{ link.text }} | 
					
						
							|  |  |  |           </v-btn> | 
					
						
							|  |  |  |         </div> | 
					
						
							|  |  |  |       </v-card-text> | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  |     </v-card> | 
					
						
							|  |  |  |   </v-container> | 
					
						
							| 
									
										
										
										
											2021-07-31 15:07:19 -08:00
										 |  |  | </template> | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-14 12:26:28 -08:00
										 |  |  | <script lang="ts"> | 
					
						
							| 
									
										
										
										
											2024-10-05 16:12:11 -05:00
										 |  |  | import { defineComponent, ref, useContext, computed, reactive, useRouter, useAsync, onBeforeMount } from "@nuxtjs/composition-api"; | 
					
						
							| 
									
										
										
										
											2023-01-06 11:51:38 -08:00
										 |  |  | import { useDark, whenever } from "@vueuse/core"; | 
					
						
							| 
									
										
										
										
											2023-11-05 19:07:02 -06:00
										 |  |  | import { useLoggedInState } from "~/composables/use-logged-in-state"; | 
					
						
							| 
									
										
										
										
											2022-03-15 17:34:53 -08:00
										 |  |  | import { useAppInfo } from "~/composables/api"; | 
					
						
							| 
									
										
										
										
											2022-05-06 11:18:06 -08:00
										 |  |  | import { usePasswordField } from "~/composables/use-passwords"; | 
					
						
							| 
									
										
										
										
											2021-11-20 14:30:38 -09:00
										 |  |  | import { alert } from "~/composables/use-toast"; | 
					
						
							| 
									
										
										
										
											2023-11-15 09:24:24 -06:00
										 |  |  | import { useAsyncKey } from "~/composables/use-utils"; | 
					
						
							|  |  |  | import { AppStartupInfo } from "~/lib/api/types/admin"; | 
					
						
							| 
									
										
										
										
											2023-10-07 21:36:47 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-14 12:26:28 -08:00
										 |  |  | export default defineComponent({ | 
					
						
							| 
									
										
										
										
											2022-02-20 15:14:31 -09:00
										 |  |  |   layout: "blank", | 
					
						
							| 
									
										
										
										
											2021-07-31 15:07:19 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-14 12:26:28 -08:00
										 |  |  |   setup() { | 
					
						
							| 
									
										
										
										
											2022-03-15 17:34:53 -08:00
										 |  |  |     const isDark = useDark(); | 
					
						
							| 
									
										
										
										
											2022-02-23 15:04:45 -09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-06 11:51:38 -08:00
										 |  |  |     const router = useRouter(); | 
					
						
							| 
									
										
										
										
											2023-11-15 09:24:24 -06:00
										 |  |  |     const { $auth, i18n, $axios } = useContext(); | 
					
						
							| 
									
										
										
										
											2023-11-05 19:07:02 -06:00
										 |  |  |     const { loggedIn } = useLoggedInState(); | 
					
						
							|  |  |  |     const groupSlug = computed(() => $auth.user?.groupSlug); | 
					
						
							| 
									
										
										
										
											2024-03-11 08:28:54 -05:00
										 |  |  |     const isDemo = ref(false); | 
					
						
							|  |  |  |     const isFirstLogin = ref(false); | 
					
						
							| 
									
										
										
										
											2023-01-06 11:51:38 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-14 12:26:28 -08:00
										 |  |  |     const form = reactive({ | 
					
						
							| 
									
										
										
										
											2022-02-20 15:14:31 -09:00
										 |  |  |       email: "", | 
					
						
							|  |  |  |       password: "", | 
					
						
							| 
									
										
										
										
											2021-12-04 16:06:24 -09:00
										 |  |  |       remember: false, | 
					
						
							| 
									
										
										
										
											2021-09-14 12:26:28 -08:00
										 |  |  |     }); | 
					
						
							| 
									
										
										
										
											2021-09-09 08:51:29 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-15 09:24:24 -06:00
										 |  |  |     useAsync(async () => { | 
					
						
							|  |  |  |       const data = await $axios.get<AppStartupInfo>("/api/app/about/startup-info"); | 
					
						
							| 
									
										
										
										
											2024-03-11 08:28:54 -05:00
										 |  |  |       isDemo.value = data.data.isDemo; | 
					
						
							| 
									
										
										
										
											2023-11-15 09:24:24 -06:00
										 |  |  |       isFirstLogin.value = data.data.isFirstLogin; | 
					
						
							| 
									
										
										
										
											2024-03-11 08:28:54 -05:00
										 |  |  |     }, useAsyncKey()); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     whenever( | 
					
						
							|  |  |  |       () => loggedIn.value && groupSlug.value, | 
					
						
							|  |  |  |       () => { | 
					
						
							|  |  |  |         if (!isDemo.value && isFirstLogin.value && $auth.user?.admin) { | 
					
						
							|  |  |  |           router.push("/admin/setup"); | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |           router.push(`/g/${groupSlug.value || ""}`); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |       { immediate: true }, | 
					
						
							|  |  |  |     ); | 
					
						
							| 
									
										
										
										
											2023-11-15 09:24:24 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-14 12:26:28 -08:00
										 |  |  |     const loggingIn = ref(false); | 
					
						
							| 
									
										
										
										
											2024-10-05 16:12:11 -05:00
										 |  |  |     const oidcLoggingIn = ref(false) | 
					
						
							| 
									
										
										
										
											2021-09-09 08:51:29 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-15 17:34:53 -08:00
										 |  |  |     const appInfo = useAppInfo(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-22 20:41:54 -08:00
										 |  |  |     const { passwordIcon, inputType, togglePasswordShow } = usePasswordField(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-15 17:34:53 -08:00
										 |  |  |     const allowSignup = computed(() => appInfo.value?.allowSignup || false); | 
					
						
							| 
									
										
										
										
											2024-03-10 13:51:36 -05:00
										 |  |  |     const allowOidc = computed(() => appInfo.value?.enableOidc || false); | 
					
						
							|  |  |  |     const oidcRedirect = computed(() => appInfo.value?.oidcRedirect || false); | 
					
						
							|  |  |  |     const oidcProviderName = computed(() => appInfo.value?.oidcProviderName || "OAuth") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     whenever( | 
					
						
							| 
									
										
										
										
											2024-04-04 16:23:33 -05:00
										 |  |  |         () => allowOidc.value && oidcRedirect.value && !isCallback() && !isDirectLogin() && !$auth.check().valid, | 
					
						
							| 
									
										
										
										
											2024-03-10 13:51:36 -05:00
										 |  |  |         () => oidcAuthenticate(), | 
					
						
							|  |  |  |         {immediate: true} | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-10-05 16:12:11 -05:00
										 |  |  |     onBeforeMount(async () => { | 
					
						
							|  |  |  |         if (isCallback()) { | 
					
						
							|  |  |  |             await oidcAuthenticate(true) | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     }) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-10 13:51:36 -05:00
										 |  |  |     function isCallback() { | 
					
						
							| 
									
										
										
										
											2024-10-05 16:12:11 -05:00
										 |  |  |         const params = new URLSearchParams(window.location.search) | 
					
						
							|  |  |  |         return params.has("code") || params.has("error") | 
					
						
							| 
									
										
										
										
											2024-03-10 13:51:36 -05:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function isDirectLogin() { | 
					
						
							| 
									
										
										
										
											2024-10-05 16:12:11 -05:00
										 |  |  |         const params = new URLSearchParams(window.location.search) | 
					
						
							|  |  |  |         return params.has("direct") && params.get("direct") === "1" | 
					
						
							| 
									
										
										
										
											2024-03-10 13:51:36 -05:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-10-05 16:12:11 -05:00
										 |  |  |     async function oidcAuthenticate(callback = false) { | 
					
						
							|  |  |  |         if (callback) { | 
					
						
							|  |  |  |             oidcLoggingIn.value = true | 
					
						
							|  |  |  |             try { | 
					
						
							|  |  |  |                 await $auth.loginWith("oidc", { params: new URLSearchParams(window.location.search)}) | 
					
						
							|  |  |  |             } catch (error) { | 
					
						
							|  |  |  |                 await router.replace("/login?direct=1") | 
					
						
							|  |  |  |                 alertOnError(error) | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             oidcLoggingIn.value = false | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             window.location.replace("/api/auth/oauth") // start the redirect process
 | 
					
						
							| 
									
										
										
										
											2024-03-10 13:51:36 -05:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-09-09 08:51:29 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-14 12:26:28 -08:00
										 |  |  |     async function authenticate() { | 
					
						
							| 
									
										
										
										
											2022-02-20 15:14:31 -09:00
										 |  |  |       if (form.email.length === 0 || form.password.length === 0) { | 
					
						
							| 
									
										
										
										
											2023-01-29 02:39:51 +01:00
										 |  |  |         alert.error(i18n.t("user.please-enter-your-email-and-password") as string); | 
					
						
							| 
									
										
										
										
											2022-02-20 15:14:31 -09:00
										 |  |  |         return; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-14 12:26:28 -08:00
										 |  |  |       loggingIn.value = true; | 
					
						
							|  |  |  |       const formData = new FormData(); | 
					
						
							|  |  |  |       formData.append("username", form.email); | 
					
						
							|  |  |  |       formData.append("password", form.password); | 
					
						
							| 
									
										
										
										
											2021-12-04 16:06:24 -09:00
										 |  |  |       formData.append("remember_me", String(form.remember)); | 
					
						
							| 
									
										
										
										
											2021-09-09 08:51:29 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-20 14:30:38 -09:00
										 |  |  |       try { | 
					
						
							|  |  |  |         await $auth.loginWith("local", { data: formData }); | 
					
						
							|  |  |  |       } catch (error) { | 
					
						
							| 
									
										
										
										
											2024-10-05 16:12:11 -05:00
										 |  |  |         alertOnError(error) | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       loggingIn.value = false; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function alertOnError(error: any) { | 
					
						
							| 
									
										
										
										
											2022-01-09 07:15:23 +01:00
										 |  |  |         // TODO Check if error is an AxiosError, but isAxiosError is not working right now
 | 
					
						
							|  |  |  |         // See https://github.com/nuxt-community/axios-module/issues/550
 | 
					
						
							|  |  |  |         // Import $axios from useContext()
 | 
					
						
							|  |  |  |         // if ($axios.isAxiosError(error) && error.response?.status === 401) {
 | 
					
						
							| 
									
										
										
										
											2022-08-13 13:18:12 -08:00
										 |  |  |         // @ts-ignore- see above
 | 
					
						
							| 
									
										
										
										
											2022-01-09 07:15:23 +01:00
										 |  |  |         if (error.response?.status === 401) { | 
					
						
							| 
									
										
										
										
											2023-01-29 02:39:51 +01:00
										 |  |  |           alert.error(i18n.t("user.invalid-credentials") as string); | 
					
						
							| 
									
										
										
										
											2022-08-13 13:18:12 -08:00
										 |  |  |           // @ts-ignore - see above
 | 
					
						
							|  |  |  |         } else if (error.response?.status === 423) { | 
					
						
							| 
									
										
										
										
											2023-01-29 02:39:51 +01:00
										 |  |  |           alert.error(i18n.t("user.account-locked-please-try-again-later") as string); | 
					
						
							| 
									
										
										
										
											2021-12-04 16:06:24 -09:00
										 |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2023-01-29 02:39:51 +01:00
										 |  |  |           alert.error(i18n.t("events.something-went-wrong") as string); | 
					
						
							| 
									
										
										
										
											2021-11-20 14:30:38 -09:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2021-09-14 12:26:28 -08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-09-09 08:51:29 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-14 12:26:28 -08:00
										 |  |  |     return { | 
					
						
							| 
									
										
										
										
											2022-03-15 17:34:53 -08:00
										 |  |  |       isDark, | 
					
						
							| 
									
										
										
										
											2021-09-14 12:26:28 -08:00
										 |  |  |       form, | 
					
						
							|  |  |  |       loggingIn, | 
					
						
							|  |  |  |       allowSignup, | 
					
						
							| 
									
										
										
										
											2024-03-10 13:51:36 -05:00
										 |  |  |       allowOidc, | 
					
						
							| 
									
										
										
										
											2021-09-14 12:26:28 -08:00
										 |  |  |       authenticate, | 
					
						
							| 
									
										
										
										
											2024-03-10 13:51:36 -05:00
										 |  |  |       oidcAuthenticate, | 
					
						
							|  |  |  |       oidcProviderName, | 
					
						
							| 
									
										
										
										
											2024-10-05 16:12:11 -05:00
										 |  |  |       oidcLoggingIn, | 
					
						
							| 
									
										
										
										
											2022-03-22 20:41:54 -08:00
										 |  |  |       passwordIcon, | 
					
						
							|  |  |  |       inputType, | 
					
						
							|  |  |  |       togglePasswordShow, | 
					
						
							| 
									
										
										
										
											2023-11-15 09:24:24 -06:00
										 |  |  |       isFirstLogin | 
					
						
							| 
									
										
										
										
											2021-09-14 12:26:28 -08:00
										 |  |  |     }; | 
					
						
							|  |  |  |   }, | 
					
						
							| 
									
										
										
										
											2021-10-07 09:39:47 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   head() { | 
					
						
							|  |  |  |     return { | 
					
						
							|  |  |  |       title: this.$t("user.login") as string, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |   }, | 
					
						
							| 
									
										
										
										
											2021-07-31 15:07:19 -08:00
										 |  |  | }); | 
					
						
							| 
									
										
										
										
											2021-09-09 08:51:29 -08:00
										 |  |  | </script> | 
					
						
							| 
									
										
										
										
											2021-10-02 12:18:01 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | <style lang="css"> | 
					
						
							|  |  |  | .max-button { | 
					
						
							|  |  |  |   width: 300px; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2022-02-22 11:36:58 -09:00
										 |  |  | 
 | 
					
						
							|  |  |  | .icon-primary { | 
					
						
							|  |  |  |   fill: var(--v-primary-base); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-23 15:04:45 -09:00
										 |  |  | .icon-white { | 
					
						
							|  |  |  |   fill: white; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-22 11:36:58 -09:00
										 |  |  | .icon-container { | 
					
						
							|  |  |  |   display: flex; | 
					
						
							|  |  |  |   flex-direction: column; | 
					
						
							|  |  |  |   align-items: center; | 
					
						
							|  |  |  |   width: 100%; | 
					
						
							|  |  |  |   position: relative; | 
					
						
							|  |  |  |   margin-top: 3.5rem; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .icon-divider { | 
					
						
							|  |  |  |   width: 100%; | 
					
						
							|  |  |  |   margin-bottom: -3.5rem; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .icon-avatar { | 
					
						
							|  |  |  |   border-color: rgba(0, 0, 0, 0.12); | 
					
						
							|  |  |  |   border: 2px; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2022-02-23 15:04:45 -09:00
										 |  |  | 
 | 
					
						
							|  |  |  | .bg-off-white { | 
					
						
							|  |  |  |   background: #f5f8fa; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2024-03-10 13:51:36 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | .absolute { | 
					
						
							|  |  |  |     position: absolute; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .div-width { | 
					
						
							|  |  |  |     max-width: 75%; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .bg-background { | 
					
						
							|  |  |  |     background-color: #1e1e1e; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .bg-white { | 
					
						
							|  |  |  |     background-color: #fff; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2022-01-09 07:15:23 +01:00
										 |  |  | </style> |