release v2.0.0 #4

Merged
crimsen merged 481 commits from develop into master 2024-01-18 15:15:08 +00:00
1 changed files with 11 additions and 5 deletions
Showing only changes of commit 8e552ba508 - Show all commits

View File

@ -70,10 +70,11 @@
<script lang="ts">
import { useRouter } from 'vue-router';
import { Loading, Notify } from 'quasar';
import { api, notEmpty, PersistentStorage, useMainStore, useUserStore } from '@flaschengeist/api';
import { Loading, Notify, useQuasar } from 'quasar';
import { api, notEmpty, PersistentStorage, useMainStore } from '@flaschengeist/api';
import { PasswordInput } from '@flaschengeist/api/components';
import { defineComponent, onMounted, ref } from 'vue';
import { useSessionStore } from 'app/api';
export default defineComponent({
name: 'PageLogin',
@ -88,8 +89,9 @@ export default defineComponent({
const mainRoute = { name: 'dashboard' };
const mainStore = useMainStore();
const userStore = useUserStore();
const sessionStore = useSessionStore();
const router = useRouter();
const quasar = useQuasar();
onMounted(() => {
if (mainStore.session) void router.replace(mainRoute);
@ -115,10 +117,14 @@ export default defineComponent({
const status = await mainStore.login(userid.value, password.value);
if (status === true) {
mainStore.user = await userStore.getUser(userid.value, true);
// On capacitor we set the lifetime to at least two weeks to not annoy users.
if (quasar.platform.is.capacitor)
void sessionStore.updateSession(14 * 24 * 60 * 60, mainStore.currentSession.token);
// Redirect user to previous page, if any.
const x = router.currentRoute.value.query['redirect'];
void router.push(typeof x === 'string' ? { path: x } : mainRoute);
void router.push(!!x && typeof x === 'string' ? { path: x } : mainRoute);
} else {
// Login failed, notify and reset form
password.value = '';
if (status === 401) {
Notify.create({