diff --git a/docs/docs/documentation/getting-started/installation/backend-config.md b/docs/docs/documentation/getting-started/installation/backend-config.md index 13bb7e8e55e..31765e7ac2f 100644 --- a/docs/docs/documentation/getting-started/installation/backend-config.md +++ b/docs/docs/documentation/getting-started/installation/backend-config.md @@ -87,6 +87,7 @@ For usage, see [Usage - OpenID Connect](../usage/oidc.md) | OIDC_CLIENT_ID | None | The client id of your configured client in your provider | | OIDC_ADMIN_GROUP | None | If this group is present in the group claims, the user will be set as an admin | | OIDC_ALWAYS_REDIRECT | False | If `True`, then the login page will be bypassed an you will be sent directly to your Identity Provider. You can still get to the login page by adding `?direct=1` to the login URL | +| OIDC_PROVIDER_NAME | OAuth | The provider name is shown in SSO login button. "Login with " | ### Themeing diff --git a/docs/docs/overrides/api.html b/docs/docs/overrides/api.html index d8a857c5771..dfea4b7cb89 100644 --- a/docs/docs/overrides/api.html +++ b/docs/docs/overrides/api.html @@ -14,7 +14,7 @@
diff --git a/frontend/lang/messages/en-US.json b/frontend/lang/messages/en-US.json index 6d6751f6317..fa228cc7ba9 100644 --- a/frontend/lang/messages/en-US.json +++ b/frontend/lang/messages/en-US.json @@ -826,7 +826,7 @@ "link-id": "Link ID", "link-name": "Link Name", "login": "Login", - "login-oidc": "Login with OIDC", + "login-oidc": "Login with", "or": "or", "logout": "Logout", "manage-users": "Manage Users", diff --git a/frontend/lib/api/types/admin.ts b/frontend/lib/api/types/admin.ts index 16af1c578cf..ddb769fc3f6 100644 --- a/frontend/lib/api/types/admin.ts +++ b/frontend/lib/api/types/admin.ts @@ -12,6 +12,7 @@ export interface AdminAboutInfo { allowSignup: boolean; enableOidc: boolean; oidcRedirect: boolean; + oidcProviderName: string; versionLatest: string; apiPort: number; apiDocs: boolean; @@ -37,6 +38,7 @@ export interface AppInfo { allowSignup: boolean; enableOidc: boolean; oidcRedirect: boolean; + oidcProviderName: string; } export interface AppStartupInfo { isFirstLogin: boolean; diff --git a/frontend/pages/login.vue b/frontend/pages/login.vue index 49d09e8ffb9..a595a1a911e 100644 --- a/frontend/pages/login.vue +++ b/frontend/pages/login.vue @@ -85,8 +85,8 @@
- - {{ $t("user.login-oidc") }} + + {{ $t("user.login-oidc") }} {{ oidcProviderName }}
@@ -182,11 +182,15 @@ export default defineComponent({ const allowSignup = computed(() => appInfo.value?.allowSignup || false); const allowOidc = computed(() => appInfo.value?.enableOidc || false); - const oidcRedirect = computed(() => appInfo.value?.allowSignup || false); + const oidcRedirect = computed(() => appInfo.value?.oidcRedirect || false); + // eslint-disable-next-line @typescript-eslint/no-unsafe-return + const oidcProviderName = computed(() => appInfo.value?.oidcProviderName || "OAuth") - if (allowOidc && oidcRedirect && !isCallback() && !isDirectLogin()) { - oidc_authenticate() - } + whenever( + () => allowOidc.value && oidcRedirect.value && !isCallback() && !isDirectLogin(), + () => oidcAuthenticate(), + {immediate: true} + ) function isCallback() { return router.currentRoute.query.state; @@ -196,7 +200,7 @@ export default defineComponent({ return router.currentRoute.query.direct } - async function oidc_authenticate() { + async function oidcAuthenticate() { try { await $auth.loginWith("oidc") } catch (error) { @@ -243,7 +247,8 @@ export default defineComponent({ allowSignup, allowOidc, authenticate, - oidc_authenticate, + oidcAuthenticate, + oidcProviderName, passwordIcon, inputType, togglePasswordShow, diff --git a/mealie/core/settings/settings.py b/mealie/core/settings/settings.py index 5a5c5e2c2ff..11c06f22266 100644 --- a/mealie/core/settings/settings.py +++ b/mealie/core/settings/settings.py @@ -177,6 +177,7 @@ def LDAP_ENABLED(self) -> bool: OIDC_SIGNUP_ENABLED: bool = True OIDC_ADMIN_GROUP: NoneStr OIDC_AUTO_REDIRECT: bool = False + OIDC_PROVIDER_NAME: str = "OAuth" @property def OIDC_READY(self) -> bool: diff --git a/mealie/routes/app/app_about.py b/mealie/routes/app/app_about.py index 024d778f495..86c258fe4ad 100644 --- a/mealie/routes/app/app_about.py +++ b/mealie/routes/app/app_about.py @@ -22,6 +22,7 @@ def get_app_info(): allow_signup=settings.ALLOW_SIGNUP, enable_oidc=settings.OIDC_READY, oidc_redirect=settings.OIDC_AUTO_REDIRECT, + oidc_provider_name=settings.OIDC_PROVIDER_NAME, ) diff --git a/mealie/schema/admin/about.py b/mealie/schema/admin/about.py index d0461bac635..d1cfc15d9dc 100644 --- a/mealie/schema/admin/about.py +++ b/mealie/schema/admin/about.py @@ -16,6 +16,7 @@ class AppInfo(MealieModel): allow_signup: bool enable_oidc: bool oidc_redirect: bool + oidc_provider_name: str class AppTheme(MealieModel): diff --git a/template.env b/template.env index afa3dc92df5..793442a30d0 100644 --- a/template.env +++ b/template.env @@ -60,3 +60,4 @@ OIDC_AUTH_ENABLED=False #OIDC_CONFIGURATION_URL=https://auth.example.com/.well-known/openid-configuration #OIDC_CLIENT_ID=mealie #OIDC_AUTO_REDIRECT=False +#OIDC_PROVIDER_NAME=OAuth