chore: simple Login view improvements (#1791)

Co-authored-by: Dominik Pschenitschni <mail@celement.de>
Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/1791
Reviewed-by: konrad <k@knt.li>
Co-authored-by: Dominik Pschenitschni <dpschen@noreply.kolaente.de>
Co-committed-by: Dominik Pschenitschni <dpschen@noreply.kolaente.de>
This commit is contained in:
Dominik Pschenitschni 2022-04-10 18:42:29 +00:00 committed by konrad
parent aff83773af
commit b9637e1bb6

View file

@ -88,9 +88,9 @@
v-if="hasOpenIdProviders" v-if="hasOpenIdProviders"
class="mt-4"> class="mt-4">
<x-button <x-button
@click="redirectToProvider(p)"
v-for="(p, k) in openidConnect.providers" v-for="(p, k) in openidConnect.providers"
:key="k" :key="k"
@click="redirectToProvider(p)"
variant="secondary" variant="secondary"
class="is-fullwidth mt-2" class="is-fullwidth mt-2"
> >
@ -134,17 +134,16 @@ export default defineComponent({
// FIXME: Why is this here? Can we find a better place for this? // FIXME: Why is this here? Can we find a better place for this?
let emailVerifyToken = localStorage.getItem('emailConfirmToken') let emailVerifyToken = localStorage.getItem('emailConfirmToken')
if (emailVerifyToken) { if (emailVerifyToken) {
const cancel = this.setLoading() const stopLoading = this.setLoading()
HTTP.post('user/confirm', {token: emailVerifyToken}) HTTP.post('user/confirm', {token: emailVerifyToken})
.then(() => { .then(() => {
localStorage.removeItem('emailConfirmToken') localStorage.removeItem('emailConfirmToken')
this.confirmedEmailSuccess = true this.confirmedEmailSuccess = true
cancel()
}) })
.catch(e => { .catch(e => {
cancel()
this.errorMessage = e.response.data.message this.errorMessage = e.response.data.message
}) })
.finally(stopLoading)
} }
// Check if the user is already logged in, if so, redirect them to the homepage // Check if the user is already logged in, if so, redirect them to the homepage
@ -166,9 +165,7 @@ export default defineComponent({
}, },
computed: { computed: {
hasOpenIdProviders() { hasOpenIdProviders() {
return this.openidConnect.enabled && return this.openidConnect.enabled && this.openidConnect.providers?.length > 0
this.openidConnect.providers &&
this.openidConnect.providers.length > 0
}, },
...mapState({ ...mapState({
registrationEnabled: state => state.config.registrationEnabled, registrationEnabled: state => state.config.registrationEnabled,