From f79f4101b6e360b696d7ea0fc3fbcba667869945 Mon Sep 17 00:00:00 2001 From: kolaente Date: Sat, 14 Aug 2021 17:31:35 +0200 Subject: [PATCH] Show errors from openid provider --- src/components/home/contentAuth.vue | 2 +- src/i18n/lang/en.json | 1 + src/views/user/OpenIdAuth.vue | 12 +++++++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/components/home/contentAuth.vue b/src/components/home/contentAuth.vue index e2cdc467..6a9853a5 100644 --- a/src/components/home/contentAuth.vue +++ b/src/components/home/contentAuth.vue @@ -62,7 +62,7 @@ export default { return state.namespaces.namespaces.filter(n => !n.isArchived) }, currentList: CURRENT_LIST, - background: 'background', + background: 'background', // FIXME: Return the full thing or nothing at all to prevent calls to /null menuActive: MENU_ACTIVE, userInfo: state => state.auth.info, authenticated: state => state.auth.authenticated, diff --git a/src/i18n/lang/en.json b/src/i18n/lang/en.json index 3cfc31e7..0fcf94f3 100644 --- a/src/i18n/lang/en.json +++ b/src/i18n/lang/en.json @@ -38,6 +38,7 @@ "loginWith": "Log in with {provider}", "authenticating": "Authenticating…", "openIdStateError": "State does not match, refusing to continue!", + "openIdGeneralError": "An error occured while authenticating against the third party.", "logout": "Logout" }, "settings": { diff --git a/src/views/user/OpenIdAuth.vue b/src/views/user/OpenIdAuth.vue index d929b430..3365ec42 100644 --- a/src/views/user/OpenIdAuth.vue +++ b/src/views/user/OpenIdAuth.vue @@ -39,8 +39,18 @@ export default { } localStorage.setItem('authenticating', true) + if (typeof this.$route.query.error !== 'undefined') { + let error = this.$t('user.auth.openIdGeneralError') + if (typeof this.$route.query.message !== 'undefined') { + error = this.$route.query.message + } + localStorage.removeItem('authenticating') + this.$store.commit(ERROR_MESSAGE, error) + return + } + const state = localStorage.getItem('state') - if(typeof this.$route.query.state === 'undefined' || this.$route.query.state !== state) { + if (typeof this.$route.query.state === 'undefined' || this.$route.query.state !== state) { localStorage.removeItem('authenticating') this.$store.commit(ERROR_MESSAGE, this.$t('user.auth.openIdStateError')) return