Skip to content

Commit

Permalink
Add non-prod ODIC URL warning on admin settings UI.
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Oct 13, 2024
1 parent af06d2e commit cc71899
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions frontend/src/views/settings/security.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -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: {
Expand Down
1 change: 1 addition & 0 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit cc71899

Please # to comment.