Wolfgang Huß 48c7bd0033
refactor(webapp): make login, registration, password-reset layout brandable (#8440)
* Make login, registration, password-reset layout brandable

- Rename some variables related to this

* Remove experimental code

* add lodash types

* fix build

fix type

---------

Co-authored-by: Ulf Gebhardt <ulf.gebhardt@webcraft-media.de>
2025-04-28 16:58:35 +00:00

44 lines
1.1 KiB
Vue

<template>
<div class="login-page">
<transition name="fade" appear>
<login-form @success="handleSuccess" />
</transition>
</div>
</template>
<script>
import LoginForm from '~/components/LoginForm/LoginForm.vue'
import loginConstants from '~/constants/loginBranded.js'
import { VERSION } from '~/constants/terms-and-conditions-version.js'
import { mapGetters } from 'vuex'
export default {
layout: loginConstants.LAYOUT,
components: {
LoginForm,
},
computed: {
...mapGetters({
user: 'auth/user',
}),
},
asyncData({ store, redirect }) {
if (store.getters['auth/user'].termsAndConditionsAgreedVersion === VERSION) {
redirect('/')
}
},
methods: {
async handleSuccess() {
this.$i18n.set(this.user.locale || 'en')
try {
await this.$router.replace(this.$route.query.path || '/')
} catch (err) {
// throw new Error(`Problem handling something: ${err}.`);
// TODO this is causing trouble - most likely due to double redirect on terms&conditions
}
},
},
}
</script>