Fixed various issues with dynamic redirect uris and custom theme loading

This commit is contained in:
Antoine Nguyen
2025-07-26 20:30:29 +02:00
parent c191a8c859
commit 7b5cdbb285
5 changed files with 43 additions and 45 deletions
+1 -1
View File
@@ -4,5 +4,5 @@
"OAUTH_AUTHORITY_URL": "https://localhost:8000/api/o",
"OAUTH_CLIENT_ID": "LVQbfIIX3khWR3nDvix1u9yEGHZUxcx53bhJ7FlD",
"OAUTH_REDIRECT_URI": "/login/logged",
"OAUTH_POST_REDIRECT_URI": "https://localhost:3000/"
"OAUTH_POST_REDIRECT_URI": "/"
}
+1 -41
View File
@@ -4,44 +4,4 @@
</Suspense>
</template>
<script setup>
import { useTheme } from 'vuetify'
import themeApi from '@/api/theme'
const theme = useTheme()
themeApi.getTheme().then((response) => {
if (
response.data.theme_primary_color !==
theme.themes.value.light.colors.primary
) {
theme.themes.value.light.colors.primary = response.data.theme_primary_color
}
if (
response.data.theme_primary_color_light !==
theme.themes.value.light.colors['primary-lighten-1']
) {
theme.themes.value.light.colors['primary-lighten-1'] =
response.data.theme_primary_color_light
}
if (
response.data.theme_primary_color_dark !==
theme.themes.value.light.colors['primary-darken-1']
) {
theme.themes.value.light.colors['primary-darken-1'] =
response.data.theme_primary_color_dark
}
if (
response.data.theme_secondary_color !==
theme.themes.value.light.colors.secondary
) {
theme.themes.value.light.colors.secondary =
response.data.theme_secondary_color
}
if (
response.data.theme_label_color !== theme.themes.value.light.colors.label
) {
theme.themes.value.light.colors.label = response.data.theme_label_color
}
})
</script>
<script setup></script>
@@ -24,14 +24,17 @@
<script setup>
import { ref, computed } from 'vue'
import { useGettext } from 'vue3-gettext'
import { useTheme } from 'vuetify'
import { useAuthStore, useBusStore } from '@/stores'
import ConnectedView from './ConnectedView.vue'
import NavBar from '@/components/shared/NavBar.vue'
import TopMenu from '@/components/shared/TopMenu.vue'
import themeApi from '@/api/theme'
const authStore = useAuthStore()
const busStore = useBusStore()
const { $gettext } = useGettext()
const theme = useTheme()
const props = defineProps({
color: {
@@ -58,6 +61,41 @@ busStore.$onAction(({ name, after }) => {
})
}
}, true)
themeApi.getTheme().then((response) => {
if (
response.data.theme_primary_color !==
theme.themes.value.light.colors.primary
) {
theme.themes.value.light.colors.primary = response.data.theme_primary_color
}
if (
response.data.theme_primary_color_light !==
theme.themes.value.light.colors['primary-lighten-1']
) {
theme.themes.value.light.colors['primary-lighten-1'] =
response.data.theme_primary_color_light
}
if (
response.data.theme_primary_color_dark !==
theme.themes.value.light.colors['primary-darken-1']
) {
theme.themes.value.light.colors['primary-darken-1'] =
response.data.theme_primary_color_dark
}
if (
response.data.theme_secondary_color !==
theme.themes.value.light.colors.secondary
) {
theme.themes.value.light.colors.secondary =
response.data.theme_secondary_color
}
if (
response.data.theme_label_color !== theme.themes.value.light.colors.label
) {
theme.themes.value.light.colors.label = response.data.theme_label_color
}
})
</script>
<style>
+2 -2
View File
@@ -21,10 +21,10 @@ export const useAuthStore = defineStore('auth', () => {
let postLogoutRedirectUri = config.OAUTH_POST_REDIRECT_URI
if (!redirectUri.startsWith('http')) {
redirectUri = `${location.protocol}//${location.host}${redirectUri}`
redirectUri = `${location.protocol}//${location.host}${config.OAUTH_REDIRECT_URI}`
}
if (!postLogoutRedirectUri.startsWith('http')) {
postLogoutRedirectUri = `${location.protocol}//${location.host}${postLogouRedirectUri}`
postLogoutRedirectUri = `${location.protocol}//${location.host}${config.OAUTH_POST_REDIRECT_URI}`
}
const manager = new UserManager({
authority: config.OAUTH_AUTHORITY_URL,
+1 -1
View File
@@ -141,7 +141,7 @@ class CoreGlobalParametersSerializer(serializers.Serializer):
)
# Dashboard settings
custom_welcome_message = serializers.CharField(required=False)
custom_welcome_message = serializers.CharField(required=False, allow_blank=True)
rss_feed_url = serializers.URLField(
allow_blank=True, required=False, allow_null=True
)