summaryrefslogtreecommitdiff
path: root/pse-dashboard/src/views/LoginView.vue
blob: 303db3a4214d201eff048ea464293cd9809b120c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<script setup>
import { ref } from 'vue';
import { FloatingLabelInput, FormLayout, PasswordInput } from '@/components'
import { store } from '@/store.js';
import router from '@/router.js';

const username = ref("");
const password = ref("");
const stayLoggedIn = ref(false);

async function login(e) {
    const success = await store.login({
        username: username.value,
        password: password.value
    }, stayLoggedIn.value);

    if (success) {
        router.push("/subscriptions");
    }
}

</script>
<template>
    <FormLayout>
        <!-- Text über Texteingabe -->
        <h1 class="h3 mb-3 fw-normal">
            {{ $t("message.loginRequest") }}
        </h1>

        <form @submit.prevent="login">
            <!-- Eingabefeld für Nutzername -->
            <FloatingLabelInput
                v-model="username"
                :label="$t('form.username')"
            />

            <!-- Eingabefeld für Passwort -->
            <PasswordInput
                v-model="password"
                :label="$t('form.password')"
            />
            
            <div class="row">
                <!-- Angemeldet bleiben Checkbox -->
                <div class="col-6">
                    <div class="checkbox mb-3">
                        <label>
                            <input
                                v-model="stayLoggedIn"
                                type="checkbox"
                                value="remember-me"
                            >
                            {{ $t("message.rememberMe") }}
                        </label>
                    </div>
                </div>

                <!-- Passwort vergessen Link -->
                <div class="col-6">
                    <router-link to="/forgotPassword">
                        {{ $t("message.forgotPassword") }}?
                    </router-link>
                </div>
            </div>

            <!-- Knopf um sich anzumelden -->
            <button
                type="submit"
                class="w-100 btn btn-lg btn-primary"
            >
                {{ $t("message.login") }}
            </button>

            <!-- Registrieren Link -->
            <p class="mt-1">
                {{ $t("message.noAccountYet") }}?
                <router-link to="/registration">
                    {{ $t("message.signUp") }}
                </router-link>
            </p>
        </form>

        <!-- Footer -->
        <p class="mt-5 mb-3 text-muted">
            &copy; 2023
        </p>
    </FormLayout>
</template>
<style scoped>
</style>