Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
fix: sso templates (#1753)
boojackec26a9702dc5
diff --git a/web/src/components/CreateIdentityProviderDialog.tsx b/web/src/components/CreateIdentityProviderDialog.tsxindex 528388b78..3c58783c9 100644--- a/web/src/components/CreateIdentityProviderDialog.tsx+++ b/web/src/components/CreateIdentityProviderDialog.tsx@@ -8,99 +8,100 @@ import { generateDialog } from "./Dialog";import Icon from "./Icon";import { useTranslation } from "react-i18next";-interface Props extends DialogProps {- identityProvider?: IdentityProvider;- confirmCallback?: () => void;-}--const CreateIdentityProviderDialog: React.FC<Props> = (props: Props) => {- const { t } = useTranslation();- const templateList: IdentityProvider[] = [- {- id: UNKNOWN_ID,- name: "GitHub",- type: "OAUTH2",- identifierFilter: "",- config: {- oauth2Config: {- clientId: "",- clientSecret: "",- authUrl: "https://github.com/login/oauth/authorize",- tokenUrl: "https://github.com/login/oauth/access_token",- userInfoUrl: "https://api.github.com/user",- scopes: ["user"],- fieldMapping: {- identifier: t("setting.sso-section.identifier"),- displayName: "",- email: "",- },+const templateList: IdentityProvider[] = [+ {+ id: UNKNOWN_ID,+ name: "GitHub",+ type: "OAUTH2",+ identifierFilter: "",+ config: {+ oauth2Config: {+ clientId: "",+ clientSecret: "",+ authUrl: "https://github.com/login/oauth/authorize",+ tokenUrl: "https://github.com/login/oauth/access_token",+ userInfoUrl: "https://api.github.com/user",+ scopes: ["user"],+ fieldMapping: {+ identifier: "login",+ displayName: "name",+ email: "email",},},},- {- id: UNKNOWN_ID,- name: "GitLab",- type: "OAUTH2",- identifierFilter: "",- config: {- oauth2Config: {- clientId: "",- clientSecret: "",- authUrl: "https://gitlab.com/oauth/authorize",- tokenUrl: "https://gitlab.com/oauth/token",- userInfoUrl: "https://gitlab.com/oauth/userinfo",- scopes: ["openid"],- fieldMapping: {- identifier: t("setting.sso-section.identifier"),- displayName: "",- email: "",- },+ },+ {+ id: UNKNOWN_ID,+ name: "GitLab",+ type: "OAUTH2",+ identifierFilter: "",+ config: {+ oauth2Config: {+ clientId: "",+ clientSecret: "",+ authUrl: "https://gitlab.com/oauth/authorize",+ tokenUrl: "https://gitlab.com/oauth/token",+ userInfoUrl: "https://gitlab.com/oauth/userinfo",+ scopes: ["openid"],+ fieldMapping: {+ identifier: "name",+ displayName: "name",+ email: "email",},},},- {- id: UNKNOWN_ID,- name: "Google",- type: "OAUTH2",- identifierFilter: "",- config: {- oauth2Config: {- clientId: "",- clientSecret: "",- authUrl: "https://accounts.google.com/o/oauth2/v2/auth",- tokenUrl: "https://oauth2.googleapis.com/token",- userInfoUrl: "https://www.googleapis.com/oauth2/v2/userinfo",- scopes: ["https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile"],- fieldMapping: {- identifier: t("setting.sso-section.identifier"),- displayName: "",- email: "",- },+ },+ {+ id: UNKNOWN_ID,+ name: "Google",+ type: "OAUTH2",+ identifierFilter: "",+ config: {+ oauth2Config: {+ clientId: "",+ clientSecret: "",+ authUrl: "https://accounts.google.com/o/oauth2/v2/auth",+ tokenUrl: "https://oauth2.googleapis.com/token",+ userInfoUrl: "https://www.googleapis.com/oauth2/v2/userinfo",+ scopes: ["https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile"],+ fieldMapping: {+ identifier: "email",+ displayName: "name",+ email: "email",},},},- {- id: UNKNOWN_ID,- name: t("setting.sso-section.custom"),- type: "OAUTH2",- identifierFilter: "",- config: {- oauth2Config: {- clientId: "",- clientSecret: "",- authUrl: "",- tokenUrl: "",- userInfoUrl: "",- scopes: [],- fieldMapping: {- identifier: "",- displayName: "",- email: "",- },+ },+ {+ id: UNKNOWN_ID,+ name: "Custom",+ type: "OAUTH2",+ identifierFilter: "",+ config: {+ oauth2Config: {+ clientId: "",+ clientSecret: "",+ authUrl: "",+ tokenUrl: "",+ userInfoUrl: "",+ scopes: [],+ fieldMapping: {+ identifier: "",+ displayName: "",+ email: "",},},},- ];+ },+];++interface Props extends DialogProps {+ identityProvider?: IdentityProvider;+ confirmCallback?: () => void;+}++const CreateIdentityProviderDialog: React.FC<Props> = (props: Props) => {+ const { t } = useTranslation();const identityProviderTypes = [...new Set(templateList.map((t) => t.type))];const { confirmCallback, destroy, identityProvider } = props;const [basicInfo, setBasicInfo] = useState({