Add non-prod ODIC URL warning on admin settings UI.

This commit is contained in:
Kailash Nadh 2024-10-13 18:53:39 +05:30
parent af06d2e462
commit cc71899e86
2 changed files with 14 additions and 0 deletions

View file

@ -35,6 +35,10 @@
<b-field :label="$t('settings.security.OIDCRedirectURL')">
<code><copy-text :text="`${serverConfig.root_url}/auth/oidc`" /></code>
</b-field>
<p v-if="!isURLOk" class="has-text-danger">
<b-icon icon="warning-empty" />
{{ $t('settings.security.OIDCRedirectWarning') }}
</p>
</div>
</div>
@ -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: {

View file

@ -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",