implemented token based login

This commit is contained in:
Sockenklaus
2021-10-22 05:28:51 +02:00
parent d5fdda6337
commit a323cf862a
8 changed files with 179 additions and 73 deletions

View File

@@ -1,7 +1,4 @@
<template>
<br />
<img src="/src/assets/logo.png">
<form class="m-auto">
<h1 class="h3 mb-3">Bitte einloggen</h1>
@@ -15,7 +12,7 @@
</div>
<div class="form-check my-3 mx-auto" style="width: 170px">
<input class="form-check-input" type="checkbox" id="rememberMeCheckbox">
<input class="form-check-input" v-model="input.rememberMe" type="checkbox" id="rememberMeCheckbox">
<label for="rememberMeCheckbox" class="form-check-label">
Eingeloggt bleiben
</label>
@@ -27,24 +24,22 @@
<script setup lang="ts">
import { useUser } from '@/stores/user'
import { useNotifications } from '@/stores/notifications'
import { reactive } from 'vue'
import { storeToRefs } from 'pinia'
import { useRouter } from 'vue-router'
const userStore = useUser()
const noteStore = useNotifications()
const router = useRouter()
const input = reactive({
username: '',
password: ''
password: '',
rememberMe: false
})
async function onClick() {
if(await userStore.login(input.username, input.password)) {
/**TODO #20 Use sessionStorage or localStorage based on rememberMe! */
if(await userStore.login(input.username, input.password, input.rememberMe)) {
router.push({name: 'Home'})
}