File tree 4 files changed +33
-2
lines changed
4 files changed +33
-2
lines changed Original file line number Diff line number Diff line change 1
1
import { AuthForm } from "@/components/auth/oss" ;
2
+ import { isGithubOAuthEnabled , isGoogleOAuthEnabled } from "@/lib/helper" ;
2
3
3
4
const SignIn = ( ) => {
4
- return < AuthForm type = "sign-in" /> ;
5
+ return (
6
+ < AuthForm
7
+ type = "sign-in"
8
+ isGoogleOAuthEnabled = { isGoogleOAuthEnabled }
9
+ isGithubOAuthEnabled = { isGithubOAuthEnabled }
10
+ />
11
+ ) ;
5
12
} ;
6
13
7
14
export default SignIn ;
Original file line number Diff line number Diff line change 1
1
import { AuthForm } from "@/components/auth/oss" ;
2
+ import { isGithubOAuthEnabled } from "@/lib/helper" ;
3
+ import { isGoogleOAuthEnabled } from "@/lib/helper" ;
2
4
import { SearchParamsProps } from "@/types" ;
3
5
4
6
const SignUp = ( { searchParams } : { searchParams : SearchParamsProps } ) => {
@@ -7,7 +9,14 @@ const SignUp = ({ searchParams }: { searchParams: SearchParamsProps }) => {
7
9
? searchParams . invitation_token
8
10
: null ;
9
11
10
- return < AuthForm type = "sign-up" invitationToken = { invitationToken } /> ;
12
+ return (
13
+ < AuthForm
14
+ type = "sign-up"
15
+ invitationToken = { invitationToken }
16
+ isGoogleOAuthEnabled = { isGoogleOAuthEnabled }
17
+ isGithubOAuthEnabled = { isGithubOAuthEnabled }
18
+ />
19
+ ) ;
11
20
} ;
12
21
13
22
export default SignUp ;
Original file line number Diff line number Diff line change @@ -25,10 +25,14 @@ export const AuthForm = ({
25
25
type,
26
26
invitationToken,
27
27
isCloudEnv,
28
+ isGoogleOAuthEnabled,
29
+ isGithubOAuthEnabled,
28
30
} : {
29
31
type : string ;
30
32
invitationToken ?: string | null ;
31
33
isCloudEnv ?: boolean ;
34
+ isGoogleOAuthEnabled ?: boolean ;
35
+ isGithubOAuthEnabled ?: boolean ;
32
36
} ) => {
33
37
const formSchema = authFormSchema ( type ) ;
34
38
const router = useRouter ( ) ;
@@ -302,9 +306,11 @@ export const AuthForm = ({
302
306
variant = "bordered"
303
307
as = "a"
304
308
href = { getAuthUrl ( "google" ) }
309
+ isDisabled = { ! isGoogleOAuthEnabled }
305
310
>
306
311
Continue with Google
307
312
</ Button >
313
+
308
314
< Button
309
315
startContent = {
310
316
< Icon
@@ -316,6 +322,7 @@ export const AuthForm = ({
316
322
variant = "bordered"
317
323
as = "a"
318
324
href = { getAuthUrl ( "github" ) }
325
+ isDisabled = { ! isGithubOAuthEnabled }
319
326
>
320
327
Continue with Github
321
328
</ Button >
Original file line number Diff line number Diff line change @@ -34,6 +34,14 @@ export const getAuthUrl = (provider: AuthSocialProvider) => {
34
34
return url . toString ( ) ;
35
35
} ;
36
36
37
+ export const isGoogleOAuthEnabled =
38
+ process . env . SOCIAL_GOOGLE_OAUTH_CLIENT_ID !== "" &&
39
+ process . env . SOCIAL_GOOGLE_OAUTH_CLIENT_SECRET !== "" ;
40
+
41
+ export const isGithubOAuthEnabled =
42
+ process . env . SOCIAL_GITHUB_OAUTH_CLIENT_ID !== "" &&
43
+ process . env . SOCIAL_GITHUB_OAUTH_CLIENT_SECRET !== "" ;
44
+
37
45
export async function checkTaskStatus (
38
46
taskId : string ,
39
47
) : Promise < { completed : boolean ; error ?: string } > {
You can’t perform that action at this time.
0 commit comments