@djangocfg/layouts 2.1.56 → 2.1.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -3
- package/package.json +6 -5
- package/src/layouts/AuthLayout/AuthLayout.tsx +55 -47
- package/src/layouts/AuthLayout/{AuthHelp.tsx → components/AuthHelp.tsx} +3 -3
- package/src/layouts/AuthLayout/components/AuthSuccess.tsx +101 -0
- package/src/layouts/AuthLayout/{IdentifierForm.tsx → components/IdentifierForm.tsx} +15 -29
- package/src/layouts/AuthLayout/{OTPForm.tsx → components/OTPForm.tsx} +29 -34
- package/src/layouts/AuthLayout/components/TwoFactorForm.tsx +140 -0
- package/src/layouts/AuthLayout/components/TwoFactorSetup.tsx +286 -0
- package/src/layouts/AuthLayout/components/index.ts +7 -0
- package/src/layouts/AuthLayout/{OAuthCallback.tsx → components/oauth/OAuthCallback.tsx} +16 -15
- package/src/layouts/AuthLayout/components/oauth/OAuthProviders.tsx +56 -0
- package/src/layouts/AuthLayout/components/oauth/index.ts +2 -0
- package/src/layouts/AuthLayout/{AuthContext.tsx → context.tsx} +15 -15
- package/src/layouts/AuthLayout/index.ts +20 -18
- package/src/layouts/AuthLayout/types.ts +22 -66
- package/src/layouts/AuthLayout/OAuthProviders.tsx +0 -76
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { Github, Loader2 } from 'lucide-react';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
|
|
6
|
-
import { useGithubAuth } from '@djangocfg/api/auth';
|
|
7
|
-
import { Button } from '@djangocfg/ui-nextjs/components';
|
|
8
|
-
|
|
9
|
-
import { useAuthContext } from './AuthContext';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* OAuth Providers Component
|
|
13
|
-
*
|
|
14
|
-
* Shows OAuth login buttons (GitHub, etc.) when enabled.
|
|
15
|
-
* Handles the OAuth flow initiation.
|
|
16
|
-
*/
|
|
17
|
-
export const OAuthProviders: React.FC = () => {
|
|
18
|
-
const { enableGithubAuth, sourceUrl, setError } = useAuthContext();
|
|
19
|
-
|
|
20
|
-
const {
|
|
21
|
-
isLoading: isGithubLoading,
|
|
22
|
-
startGithubAuth,
|
|
23
|
-
} = useGithubAuth({
|
|
24
|
-
sourceUrl,
|
|
25
|
-
onError: (error) => {
|
|
26
|
-
setError(error);
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
// Don't render if no OAuth providers are enabled
|
|
31
|
-
if (!enableGithubAuth) {
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<div className="space-y-4">
|
|
37
|
-
{/* Divider */}
|
|
38
|
-
<div className="relative">
|
|
39
|
-
<div className="absolute inset-0 flex items-center">
|
|
40
|
-
<div className="w-full border-t border-border" />
|
|
41
|
-
</div>
|
|
42
|
-
<div className="relative flex justify-center text-xs uppercase">
|
|
43
|
-
<span className="bg-card px-2 text-muted-foreground">
|
|
44
|
-
Or continue with
|
|
45
|
-
</span>
|
|
46
|
-
</div>
|
|
47
|
-
</div>
|
|
48
|
-
|
|
49
|
-
{/* OAuth Buttons */}
|
|
50
|
-
<div className="grid gap-3">
|
|
51
|
-
{enableGithubAuth && (
|
|
52
|
-
<Button
|
|
53
|
-
type="button"
|
|
54
|
-
variant="outline"
|
|
55
|
-
className="w-full h-11 text-base font-medium"
|
|
56
|
-
onClick={startGithubAuth}
|
|
57
|
-
disabled={isGithubLoading}
|
|
58
|
-
>
|
|
59
|
-
{isGithubLoading ? (
|
|
60
|
-
<div className="flex items-center gap-2">
|
|
61
|
-
<Loader2 className="w-5 h-5 animate-spin" />
|
|
62
|
-
Connecting...
|
|
63
|
-
</div>
|
|
64
|
-
) : (
|
|
65
|
-
<div className="flex items-center gap-2">
|
|
66
|
-
<Github className="w-5 h-5" />
|
|
67
|
-
Continue with GitHub
|
|
68
|
-
</div>
|
|
69
|
-
)}
|
|
70
|
-
</Button>
|
|
71
|
-
)}
|
|
72
|
-
</div>
|
|
73
|
-
|
|
74
|
-
</div>
|
|
75
|
-
);
|
|
76
|
-
};
|