2020-10-10 21:02:32 +00:00
|
|
|
<template>
|
2020-10-15 01:36:25 +00:00
|
|
|
<q-page
|
|
|
|
padding
|
|
|
|
class="fit row justify-center items-center content-center"
|
|
|
|
>
|
|
|
|
<q-card class="col-xs-11 col-sm-8 col-md-6 col-lg-4 justify-center items-center content-center">
|
2020-10-10 21:02:32 +00:00
|
|
|
<q-toolbar class="bg-primary text-white">
|
|
|
|
<q-toolbar-title>
|
|
|
|
Login
|
|
|
|
</q-toolbar-title>
|
|
|
|
</q-toolbar>
|
|
|
|
|
|
|
|
<q-card-section>
|
2020-10-15 01:36:25 +00:00
|
|
|
<q-form
|
|
|
|
ref="LoginForm"
|
|
|
|
@submit="doLogin"
|
|
|
|
class="q-gutter-md"
|
|
|
|
>
|
2020-10-10 21:02:32 +00:00
|
|
|
<q-input
|
|
|
|
filled
|
2020-10-15 01:36:25 +00:00
|
|
|
v-model="userid"
|
2020-10-10 21:02:32 +00:00
|
|
|
label="Benutzername oder E-Mail"
|
|
|
|
:rules="rules"
|
|
|
|
/>
|
|
|
|
<q-input
|
|
|
|
filled
|
|
|
|
v-model="password"
|
|
|
|
type="password"
|
|
|
|
label="Password"
|
|
|
|
:rules="rules"
|
|
|
|
/>
|
|
|
|
<div class="row justify-end">
|
2020-10-15 01:36:25 +00:00
|
|
|
<q-btn
|
|
|
|
label="Login"
|
|
|
|
type="submit"
|
|
|
|
color="primary"
|
|
|
|
/>
|
2020-10-10 21:02:32 +00:00
|
|
|
</div>
|
|
|
|
</q-form>
|
|
|
|
</q-card-section>
|
|
|
|
</q-card>
|
|
|
|
</q-page>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { defineComponent, ref } from '@vue/composition-api';
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
// name: 'PageName'
|
2020-10-13 09:27:27 +00:00
|
|
|
setup(_, ctx) {
|
2020-10-15 01:36:25 +00:00
|
|
|
const userid = ref('');
|
2020-10-10 21:02:32 +00:00
|
|
|
const password = ref('');
|
|
|
|
const rules = [
|
2020-10-15 01:36:25 +00:00
|
|
|
(val: string) => (val && val.length > 0) || 'Feld darf nicht leer sein!',
|
2020-10-10 21:02:32 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
function doLogin() {
|
2020-10-15 01:36:25 +00:00
|
|
|
ctx.root.$store.dispatch('user/login', {
|
|
|
|
userid: userid.value,
|
|
|
|
password: password.value,
|
|
|
|
});
|
|
|
|
|
|
|
|
void ctx.root.$router.push({ name: 'user' });
|
2020-10-10 21:02:32 +00:00
|
|
|
}
|
|
|
|
|
2020-10-15 01:36:25 +00:00
|
|
|
return { userid, password, doLogin, rules };
|
|
|
|
},
|
2020-10-10 21:02:32 +00:00
|
|
|
});
|
|
|
|
</script>
|