chore: simple Login view improvements
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
Dominik Pschenitschni 2022-04-09 20:53:23 +02:00
parent ba1a1fc041
commit 6bb6f95a16
Signed by: dpschen
GPG Key ID: B257AC0149F43A77
1 changed files with 4 additions and 7 deletions

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,