2021-06-07 17:41:25 +02:00
|
|
|
<template>
|
|
|
|
<div class="container">
|
|
|
|
<h1>Kompetenz Inventar by WTF eG</h1>
|
|
|
|
<form @submit.prevent="submitLogin()">
|
|
|
|
<div class="mb-3">
|
2021-06-24 00:40:27 +02:00
|
|
|
<label for="exampleInputusername1" class="form-label"
|
2021-06-07 17:41:25 +02:00
|
|
|
>E-Mail Aresse:
|
|
|
|
</label>
|
|
|
|
<input
|
2021-06-24 00:40:27 +02:00
|
|
|
type="username"
|
2021-06-07 17:41:25 +02:00
|
|
|
class="form-control"
|
2021-06-24 00:40:27 +02:00
|
|
|
id="exampleInputusername1"
|
|
|
|
v-model="username"
|
2021-06-07 17:41:25 +02:00
|
|
|
required
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
|
|
<label for="exampleInputPassword1" class="form-label">Passwort:</label>
|
|
|
|
<input
|
|
|
|
type="password"
|
|
|
|
class="form-control"
|
|
|
|
id="exampleInputPassword1"
|
|
|
|
v-model="password"
|
|
|
|
required
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<button type="submit" class="btn btn-primary mb-4">Login</button>
|
|
|
|
</form>
|
2021-06-14 15:02:53 +02:00
|
|
|
<a href="https://resetpw.wtf-eg.de/">Globales WTF Passwort zurücksetzen</a>
|
2021-06-24 00:40:27 +02:00
|
|
|
<div
|
|
|
|
class="alert alert-danger mb-4 mt-4"
|
|
|
|
role="alert"
|
|
|
|
v-if="showErrorMessage"
|
|
|
|
>
|
|
|
|
Mit deinen Login Daten ist ein Fehler aufgetreten. Versuch es nochmal oder
|
|
|
|
<a href="https://resetpw.wtf-eg.de/">erzeuge ein neues Passwort</a>.
|
2021-06-07 17:41:25 +02:00
|
|
|
</div>
|
|
|
|
<p>
|
|
|
|
Das Login gilt nur für WTF eG Mitglieder. Du kannst dein Ldap Passwort
|
|
|
|
hier ändern.
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
2021-06-24 00:40:27 +02:00
|
|
|
import axios from "axios";
|
2021-06-07 17:41:25 +02:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: "Index",
|
2021-06-24 00:40:27 +02:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
showErrorMessage: false,
|
|
|
|
username: "",
|
|
|
|
password: "",
|
|
|
|
};
|
2021-06-14 15:02:53 +02:00
|
|
|
},
|
2021-06-07 17:41:25 +02:00
|
|
|
methods: {
|
2021-06-24 00:40:27 +02:00
|
|
|
async submitLogin() {
|
|
|
|
this.showErrorMessage = false;
|
|
|
|
try {
|
2021-06-25 19:28:41 +02:00
|
|
|
console.log(this.apiUrl)
|
2021-06-24 00:40:27 +02:00
|
|
|
const loginResult = await axios.post(
|
2021-06-25 19:28:41 +02:00
|
|
|
`${this.apiUrl}/users/login`,
|
2021-06-24 00:40:27 +02:00
|
|
|
{
|
|
|
|
username: this.username,
|
|
|
|
password: this.password,
|
2021-06-07 17:41:25 +02:00
|
|
|
}
|
2021-06-24 00:40:27 +02:00
|
|
|
);
|
|
|
|
console.log(loginResult);
|
2021-06-25 19:28:41 +02:00
|
|
|
console.log(loginResult.status);
|
2021-06-24 00:40:27 +02:00
|
|
|
if (loginResult.status === 200) {
|
2021-06-25 19:28:41 +02:00
|
|
|
console.log('if true')
|
|
|
|
this.showErrorMessage = false;
|
2021-06-24 00:40:27 +02:00
|
|
|
//success login
|
2021-06-25 19:28:41 +02:00
|
|
|
localStorage.setItem("token", loginResult.data.token);
|
|
|
|
localStorage.setItem("user_id", loginResult.data.user_id);
|
|
|
|
this.$router.push({ path: "/s/search" });
|
2021-06-24 00:40:27 +02:00
|
|
|
} else {
|
|
|
|
this.showErrorMessage = true;
|
|
|
|
}
|
|
|
|
} catch (error) {
|
2021-06-25 19:28:41 +02:00
|
|
|
console.error(error);
|
2021-06-24 00:40:27 +02:00
|
|
|
this.showErrorMessage = true;
|
2021-06-07 17:41:25 +02:00
|
|
|
}
|
2021-06-24 00:40:27 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
2021-06-07 17:41:25 +02:00
|
|
|
</script>
|