added login, first preparation for menu

This commit is contained in:
Torsten Schulz
2024-07-21 13:09:56 +02:00
parent bbf4a2deb3
commit 597761cb15
10 changed files with 391 additions and 100 deletions

View File

@@ -11,30 +11,24 @@
<div>
<div>
<div>
<input data-object-name="user-name" size="20" type="text"
<input v-model="username" size="20" type="text"
:placeholder="$t('home.nologin.login.name')"
:title="$t('home.nologin.login.namedescription')">
</div>
<div>
<input data-object-name="password" size="20" type="password"
<input v-model="password" size="20" type="password"
:placeholder="$t('home.nologin.login.password')"
:title="$t('home.nologin.login.passworddescription')">
</div>
<div>
<label id="o1p5irxv" name="o1p5irxv" class="Wt-valid" title=""><input id="ino1p5irxv"
data-object-name="remember-me" name="ino1p5irxv" type="checkbox"
onchange="var e=event||window.event,o=this;Wt._p_.update(o,'s53',e,true);"><span
id="to1p5irxv" name="to1p5irxv" style="white-space:normal;">Eingeloggt bleiben</span></label>
<label><input type="checkbox"><span>Eingeloggt bleiben</span></label>
</div>
</div>
<div class="Wt-buttons">
<button id="o1p5irxz" data-object-name="login" type="button"
onclick="var e=event||window.event,o=this;if(o.classList.contains('Wt-disabled')){Wt4_9_1.cancelEvent(e);return;}Wt._p_.update(o,'s56',e,true);"
class="Wt-btn with-label">Einloggen</button>
<div>
<button type="button" @click="doLogin">Einloggen</button>
</div>
<div class="Wt-buttons">
<span id="o1p5iry0" data-object-name="lost-password" @click="openPasswordResetDialog"
class="link">{{
<div>
<span @click="openPasswordResetDialog" class="link">{{
$t('home.nologin.login.lostpassword') }}</span> | <span id="o1p5iry1"
@click="openRegisterDialog" class="link">{{ $t('home.nologin.login.register') }}</span>
</div>
@@ -51,15 +45,24 @@
import RandomChatDialog from '@/dialogues/chat/RandomChatDialog.vue';
import RegisterDialog from '@/dialogues/auth/RegisterDialog.vue';
import PasswordResetDialog from '@/dialogues/auth/PasswordResetDialog.vue';
import apiClient from '@/utils/axios.js';
import { mapActions } from 'vuex';
export default {
name: 'HomeNoLoginView',
data() {
return {
username: '',
password: '',
};
},
components: {
RandomChatDialog,
RegisterDialog,
PasswordResetDialog,
},
methods: {
...mapActions(['login']),
openRandomChat() {
this.$refs.randomChatDialog.open();
},
@@ -68,6 +71,10 @@ export default {
},
openPasswordResetDialog() {
this.$refs.passwordResetDialog.open();
},
async doLogin() {
const response = await apiClient.post('/api/auth/login', { username: this.username, password: this.password });
this.login(response.data);
}
}
};