Compare commits
2 Commits
release/20
...
feat/githu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fa42fc1538 | ||
|
|
0f4168d12c |
@@ -103,8 +103,10 @@
|
|||||||
"auth": {
|
"auth": {
|
||||||
"account_exists": "Account exists with different credential - Login to link both accounts",
|
"account_exists": "Account exists with different credential - Login to link both accounts",
|
||||||
"all_sign_in_options": "All sign in options",
|
"all_sign_in_options": "All sign in options",
|
||||||
|
"continue_with_auth_provider": "Continue with {provider}",
|
||||||
"continue_with_email": "Continue with Email",
|
"continue_with_email": "Continue with Email",
|
||||||
"continue_with_github": "Continue with GitHub",
|
"continue_with_github": "Continue with GitHub",
|
||||||
|
"continue_with_github_enterprise": "Continue with GitHub Enterprise",
|
||||||
"continue_with_google": "Continue with Google",
|
"continue_with_google": "Continue with Google",
|
||||||
"continue_with_microsoft": "Continue with Microsoft",
|
"continue_with_microsoft": "Continue with Microsoft",
|
||||||
"email": "Email",
|
"email": "Email",
|
||||||
|
|||||||
@@ -23,10 +23,10 @@
|
|||||||
@click="provider.action"
|
@click="provider.action"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<hr v-if="additonalLoginItems.length > 0" />
|
<hr v-if="additionalLoginItems.length > 0" />
|
||||||
|
|
||||||
<HoppSmartItem
|
<HoppSmartItem
|
||||||
v-for="loginItem in additonalLoginItems"
|
v-for="loginItem in additionalLoginItems"
|
||||||
:key="loginItem.id"
|
:key="loginItem.id"
|
||||||
:icon="loginItem.icon"
|
:icon="loginItem.icon"
|
||||||
:label="loginItem.text(t)"
|
:label="loginItem.text(t)"
|
||||||
@@ -170,7 +170,7 @@ type AuthProviderItem = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let allowedAuthProviders: AuthProviderItem[] = []
|
let allowedAuthProviders: AuthProviderItem[] = []
|
||||||
let additonalLoginItems: LoginItemDef[] = []
|
const additionalLoginItems: LoginItemDef[] = []
|
||||||
|
|
||||||
const doAdditionalLoginItemClickAction = async (item: LoginItemDef) => {
|
const doAdditionalLoginItemClickAction = async (item: LoginItemDef) => {
|
||||||
await item.onClick()
|
await item.onClick()
|
||||||
@@ -199,10 +199,33 @@ onMounted(async () => {
|
|||||||
allowedAuthProviders = enabledAuthProviders
|
allowedAuthProviders = enabledAuthProviders
|
||||||
|
|
||||||
// setup the additional login items
|
// setup the additional login items
|
||||||
additonalLoginItems =
|
platform.auth.additionalLoginItems?.forEach((item) => {
|
||||||
platform.auth.additionalLoginItems?.filter((item) =>
|
if (res.right.includes(item.id)) {
|
||||||
res.right.includes(item.id)
|
additionalLoginItems.push(item)
|
||||||
) ?? []
|
}
|
||||||
|
|
||||||
|
// since the BE send the OIDC auth providers as OIDC:providerName,
|
||||||
|
// we need to split the string and use the providerName as the text
|
||||||
|
if (item.id === "OIDC") {
|
||||||
|
res.right
|
||||||
|
.filter((provider) => provider.startsWith("OIDC"))
|
||||||
|
.forEach((provider) => {
|
||||||
|
const OIDCName = provider.split(":")[1]
|
||||||
|
const loginItemText = OIDCName
|
||||||
|
? () =>
|
||||||
|
t("auth.continue_with_auth_provider", {
|
||||||
|
provider: OIDCName,
|
||||||
|
})
|
||||||
|
: item.text
|
||||||
|
|
||||||
|
const OIDCLoginItem = {
|
||||||
|
...item,
|
||||||
|
text: loginItemText,
|
||||||
|
}
|
||||||
|
additionalLoginItems.push(OIDCLoginItem)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
isLoadingAllowedAuthProviders.value = false
|
isLoadingAllowedAuthProviders.value = false
|
||||||
})
|
})
|
||||||
@@ -311,6 +334,14 @@ const authProvidersAvailable: AuthProviderItem[] = [
|
|||||||
action: signInWithGithub,
|
action: signInWithGithub,
|
||||||
isLoading: signingInWithGitHub,
|
isLoading: signingInWithGitHub,
|
||||||
},
|
},
|
||||||
|
// the authprovider either send github or github:enterprise and both are handled by the same route
|
||||||
|
{
|
||||||
|
id: "GITHUB:ENTERPRISE",
|
||||||
|
icon: IconGithub,
|
||||||
|
label: t("auth.continue_with_github_enterprise"),
|
||||||
|
action: signInWithGithub,
|
||||||
|
isLoading: signingInWithGitHub,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: "GOOGLE",
|
id: "GOOGLE",
|
||||||
icon: IconGoogle,
|
icon: IconGoogle,
|
||||||
|
|||||||
Reference in New Issue
Block a user