From 513b5d29485a9f0ae4325b9a196ea894c102be8e Mon Sep 17 00:00:00 2001 From: Lakhan Samani Date: Mon, 7 Mar 2022 12:23:45 +0530 Subject: [PATCH] fix: env client secret --- dashboard/src/constants.ts | 2 ++ dashboard/src/graphql/queries/index.ts | 2 ++ dashboard/src/pages/Environment.tsx | 36 ++++++++++++++++++++++++++ server/env/env.go | 2 +- 4 files changed, 41 insertions(+), 1 deletion(-) diff --git a/dashboard/src/constants.ts b/dashboard/src/constants.ts index fac0c0b..64fa372 100644 --- a/dashboard/src/constants.ts +++ b/dashboard/src/constants.ts @@ -2,6 +2,7 @@ export const LOGO_URL = 'https://user-images.githubusercontent.com/6964334/147834043-fc384cab-e7ca-40f8-9663-38fc25fd5f3a.png'; export const TextInputType = { + CLIENT_ID: 'CLIENT_ID', GOOGLE_CLIENT_ID: 'GOOGLE_CLIENT_ID', GITHUB_CLIENT_ID: 'GITHUB_CLIENT_ID', FACEBOOK_CLIENT_ID: 'FACEBOOK_CLIENT_ID', @@ -25,6 +26,7 @@ export const TextInputType = { }; export const HiddenInputType = { + CLIENT_SECRET: 'CLIENT_SECRET', GOOGLE_CLIENT_SECRET: 'GOOGLE_CLIENT_SECRET', GITHUB_CLIENT_SECRET: 'GITHUB_CLIENT_SECRET', FACEBOOK_CLIENT_SECRET: 'FACEBOOK_CLIENT_SECRET', diff --git a/dashboard/src/graphql/queries/index.ts b/dashboard/src/graphql/queries/index.ts index 3adedc9..b4efc70 100644 --- a/dashboard/src/graphql/queries/index.ts +++ b/dashboard/src/graphql/queries/index.ts @@ -9,6 +9,8 @@ export const AdminSessionQuery = ` export const EnvVariablesQuery = ` query { _env{ + CLIENT_ID, + CLIENT_SECRET, GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, GITHUB_CLIENT_ID, diff --git a/dashboard/src/pages/Environment.tsx b/dashboard/src/pages/Environment.tsx index 58dbd8d..06480bc 100644 --- a/dashboard/src/pages/Environment.tsx +++ b/dashboard/src/pages/Environment.tsx @@ -240,6 +240,42 @@ export default function Environment() { return ( + + Your instance information + + + + + Client ID + +
+ {}} + inputType={TextInputType.CLIENT_ID} + placeholder="Client ID" + isDisabled={true} + /> +
+
+ + + Client Secret + +
+ +
+
+
+ Social Media Logins diff --git a/server/env/env.go b/server/env/env.go index a29914e..d430e2f 100644 --- a/server/env/env.go +++ b/server/env/env.go @@ -90,7 +90,7 @@ func InitAllEnv() error { clientSecret := envData.StringEnv[constants.EnvKeyClientSecret] // unique client id for each instance - if clientID == "" { + if clientSecret == "" { clientSecret = uuid.New().String() envData.StringEnv[constants.EnvKeyClientSecret] = clientSecret }