From cc71899e86465faf831d431ce8b286b7f0087f89 Mon Sep 17 00:00:00 2001 From: Kailash Nadh Date: Sun, 13 Oct 2024 18:53:39 +0530 Subject: [PATCH] Add non-prod ODIC URL warning on admin settings UI. --- frontend/src/views/settings/security.vue | 13 +++++++++++++ i18n/en.json | 1 + 2 files changed, 14 insertions(+) diff --git a/frontend/src/views/settings/security.vue b/frontend/src/views/settings/security.vue index 2c2b051c..0ad7c611 100644 --- a/frontend/src/views/settings/security.vue +++ b/frontend/src/views/settings/security.vue @@ -35,6 +35,10 @@ +

+ + {{ $t('settings.security.OIDCRedirectWarning') }} +

@@ -93,6 +97,15 @@ export default Vue.extend({ isMobile() { return this.windowWidth <= 768; }, + + isURLOk() { + try { + const u = new URL(this.serverConfig.root_url); + return u.hostname !== 'localhost' && u.hostname !== '127.0.0.1'; + } catch (e) { + return false; + } + }, }, methods: { diff --git a/i18n/en.json b/i18n/en.json index c4bacc60..02c9ac10 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -368,6 +368,7 @@ "settings.security.OIDCClientID": "Client ID", "settings.security.OIDCClientSecret": "Client secret", "settings.security.OIDCRedirectURL": "Redirect URL for oAuth provider", + "settings.security.OIDCRedirectWarning": "This does not seem to be a production URL. Change the Root URL in 'General' settings.", "settings.appearance.adminHelp": "Custom CSS to apply to the admin UI.", "settings.appearance.adminName": "Admin", "settings.appearance.customCSS": "Custom CSS",