@main12/auth-login 0.1.0 → 0.1.2
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 +187 -151
- package/dist/components/pages/ForgotPasswordPage.d.ts +1 -1
- package/dist/components/pages/ForgotPasswordPage.js +9 -42
- package/dist/components/pages/ForgotPasswordPageHero.d.ts +5 -0
- package/dist/components/pages/ForgotPasswordPageHero.js +69 -0
- package/dist/components/pages/ForgotPasswordPageTailwind.d.ts +5 -0
- package/dist/components/pages/ForgotPasswordPageTailwind.js +45 -0
- package/dist/components/pages/LoginPage.js +8 -218
- package/dist/components/pages/LoginPageHero.d.ts +11 -0
- package/dist/components/pages/LoginPageHero.js +298 -0
- package/dist/components/pages/LoginPageTailwind.d.ts +11 -0
- package/dist/components/pages/LoginPageTailwind.js +222 -0
- package/dist/components/pages/SetPasswordPage.d.ts +1 -1
- package/dist/components/pages/SetPasswordPage.js +9 -71
- package/dist/components/pages/SetPasswordPageHero.d.ts +5 -0
- package/dist/components/pages/SetPasswordPageHero.js +93 -0
- package/dist/components/pages/SetPasswordPageTailwind.d.ts +5 -0
- package/dist/components/pages/SetPasswordPageTailwind.js +74 -0
- package/dist/components/pages/SignupPage.d.ts +1 -1
- package/dist/components/pages/SignupPage.js +9 -126
- package/dist/components/pages/SignupPageHero.d.ts +10 -0
- package/dist/components/pages/SignupPageHero.js +150 -0
- package/dist/components/pages/SignupPageTailwind.d.ts +10 -0
- package/dist/components/pages/SignupPageTailwind.js +129 -0
- package/dist/components/pages/VerifyOtpPage.js +8 -83
- package/dist/components/pages/VerifyOtpPageHero.d.ts +5 -0
- package/dist/components/pages/VerifyOtpPageHero.js +104 -0
- package/dist/components/pages/VerifyOtpPageTailwind.d.ts +5 -0
- package/dist/components/pages/VerifyOtpPageTailwind.js +87 -0
- package/dist/config.d.ts +8 -0
- package/dist/config.js +6 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +5 -1
- package/package.json +5 -2
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import React, { Suspense } from 'react';
|
|
4
|
+
import { useSearchParams } from 'next/navigation';
|
|
5
|
+
import { Button, Input, Divider, Spinner } from '../ui/index.js';
|
|
6
|
+
import { useLoginFlow } from '../../auth/application/hooks/useLoginFlow.js';
|
|
7
|
+
import { AuthLayout } from '../AuthLayout.js';
|
|
8
|
+
function LoginContent({ onPasswordLogin, redirectTo = '/', showGoogleOAuth = true, signupUrl = '/signup', logo, poweredBy, cardClassName, backgroundClass }) {
|
|
9
|
+
const searchParams = useSearchParams();
|
|
10
|
+
const resolvedRedirect = searchParams.get('redirect') || redirectTo;
|
|
11
|
+
const { step, email, password, error, isLoading, isSendingOtp, showPassword, setEmail, setPassword, setShowPassword, handleEmailSubmit, handlePasswordSubmit, handleSendOtp, handleEditEmail, handleGoogleLogin } = useLoginFlow({
|
|
12
|
+
redirectTo: resolvedRedirect,
|
|
13
|
+
onPasswordLogin
|
|
14
|
+
});
|
|
15
|
+
const stepTitle = step === 'otp-prompt' ? 'Verify Identity' : step === 'email' ? 'Welcome Back' : 'Enter Password';
|
|
16
|
+
const stepSubtitle = step === 'otp-prompt' ? "We need to verify it's you." : step === 'email' ? 'Sign in with your email to continue.' : 'Enter your password to sign in.';
|
|
17
|
+
return /*#__PURE__*/ _jsxs(AuthLayout, {
|
|
18
|
+
logo: logo,
|
|
19
|
+
title: stepTitle,
|
|
20
|
+
subtitle: stepSubtitle,
|
|
21
|
+
poweredBy: poweredBy,
|
|
22
|
+
cardClassName: cardClassName,
|
|
23
|
+
backgroundClass: backgroundClass,
|
|
24
|
+
footer: /*#__PURE__*/ _jsxs("p", {
|
|
25
|
+
className: "text-center text-gray-600 text-sm",
|
|
26
|
+
children: [
|
|
27
|
+
"Don't have an account?",
|
|
28
|
+
' ',
|
|
29
|
+
/*#__PURE__*/ _jsx("a", {
|
|
30
|
+
href: signupUrl,
|
|
31
|
+
className: "text-gray-900 font-medium hover:underline",
|
|
32
|
+
children: "Sign up"
|
|
33
|
+
})
|
|
34
|
+
]
|
|
35
|
+
}),
|
|
36
|
+
children: [
|
|
37
|
+
step === 'email' && /*#__PURE__*/ _jsxs("div", {
|
|
38
|
+
className: "animate-[fadeIn_0.3s_ease-out]",
|
|
39
|
+
children: [
|
|
40
|
+
showGoogleOAuth && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
41
|
+
children: [
|
|
42
|
+
/*#__PURE__*/ _jsxs(Button, {
|
|
43
|
+
fullWidth: true,
|
|
44
|
+
variant: "bordered",
|
|
45
|
+
size: "lg",
|
|
46
|
+
className: "mb-4",
|
|
47
|
+
onPress: handleGoogleLogin,
|
|
48
|
+
children: [
|
|
49
|
+
/*#__PURE__*/ _jsx("span", {
|
|
50
|
+
className: "text-lg",
|
|
51
|
+
children: "G"
|
|
52
|
+
}),
|
|
53
|
+
" Continue with Google"
|
|
54
|
+
]
|
|
55
|
+
}),
|
|
56
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
57
|
+
className: "flex items-center gap-4 my-4",
|
|
58
|
+
children: [
|
|
59
|
+
/*#__PURE__*/ _jsx(Divider, {
|
|
60
|
+
className: "flex-1"
|
|
61
|
+
}),
|
|
62
|
+
/*#__PURE__*/ _jsx("span", {
|
|
63
|
+
className: "text-gray-500 text-sm",
|
|
64
|
+
children: "or"
|
|
65
|
+
}),
|
|
66
|
+
/*#__PURE__*/ _jsx(Divider, {
|
|
67
|
+
className: "flex-1"
|
|
68
|
+
})
|
|
69
|
+
]
|
|
70
|
+
})
|
|
71
|
+
]
|
|
72
|
+
}),
|
|
73
|
+
/*#__PURE__*/ _jsxs("form", {
|
|
74
|
+
onSubmit: handleEmailSubmit,
|
|
75
|
+
className: "space-y-4",
|
|
76
|
+
children: [
|
|
77
|
+
error && /*#__PURE__*/ _jsx("div", {
|
|
78
|
+
className: "bg-red-50 text-red-600 border border-red-200 rounded-lg p-3 text-sm",
|
|
79
|
+
children: error
|
|
80
|
+
}),
|
|
81
|
+
/*#__PURE__*/ _jsx(Input, {
|
|
82
|
+
type: "email",
|
|
83
|
+
label: "Email",
|
|
84
|
+
value: email,
|
|
85
|
+
onValueChange: setEmail,
|
|
86
|
+
isRequired: true
|
|
87
|
+
}),
|
|
88
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
89
|
+
type: "submit",
|
|
90
|
+
variant: "primary",
|
|
91
|
+
isLoading: isLoading,
|
|
92
|
+
children: "Continue"
|
|
93
|
+
})
|
|
94
|
+
]
|
|
95
|
+
})
|
|
96
|
+
]
|
|
97
|
+
}),
|
|
98
|
+
step === 'password' && /*#__PURE__*/ _jsxs("div", {
|
|
99
|
+
className: "animate-[fadeIn_0.3s_ease-out]",
|
|
100
|
+
children: [
|
|
101
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
102
|
+
className: "flex items-center justify-between border border-gray-300 rounded-xl px-4 py-3 mb-4",
|
|
103
|
+
children: [
|
|
104
|
+
/*#__PURE__*/ _jsx("span", {
|
|
105
|
+
className: "text-gray-900 text-sm",
|
|
106
|
+
children: email
|
|
107
|
+
}),
|
|
108
|
+
/*#__PURE__*/ _jsx("button", {
|
|
109
|
+
type: "button",
|
|
110
|
+
onClick: handleEditEmail,
|
|
111
|
+
className: "text-gray-600 text-sm font-medium hover:text-gray-900",
|
|
112
|
+
children: "Edit"
|
|
113
|
+
})
|
|
114
|
+
]
|
|
115
|
+
}),
|
|
116
|
+
/*#__PURE__*/ _jsxs("form", {
|
|
117
|
+
onSubmit: handlePasswordSubmit,
|
|
118
|
+
className: "space-y-4",
|
|
119
|
+
children: [
|
|
120
|
+
error && /*#__PURE__*/ _jsx("div", {
|
|
121
|
+
className: "bg-red-50 text-red-600 border border-red-200 rounded-lg p-3 text-sm",
|
|
122
|
+
children: error
|
|
123
|
+
}),
|
|
124
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
125
|
+
className: "relative",
|
|
126
|
+
children: [
|
|
127
|
+
/*#__PURE__*/ _jsx(Input, {
|
|
128
|
+
type: showPassword ? 'text' : 'password',
|
|
129
|
+
label: "Password",
|
|
130
|
+
value: password,
|
|
131
|
+
onValueChange: setPassword,
|
|
132
|
+
isRequired: true,
|
|
133
|
+
autoFocus: true
|
|
134
|
+
}),
|
|
135
|
+
/*#__PURE__*/ _jsx("button", {
|
|
136
|
+
type: "button",
|
|
137
|
+
onClick: ()=>setShowPassword(!showPassword),
|
|
138
|
+
className: "absolute right-4 top-9 text-gray-400 hover:text-gray-600",
|
|
139
|
+
children: showPassword ? '🙈' : '👁'
|
|
140
|
+
})
|
|
141
|
+
]
|
|
142
|
+
}),
|
|
143
|
+
/*#__PURE__*/ _jsx("div", {
|
|
144
|
+
className: "text-left",
|
|
145
|
+
children: /*#__PURE__*/ _jsx("a", {
|
|
146
|
+
href: "/forgot-password",
|
|
147
|
+
className: "text-sm text-gray-700 hover:text-gray-900 hover:underline",
|
|
148
|
+
children: "Forgot password?"
|
|
149
|
+
})
|
|
150
|
+
}),
|
|
151
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
152
|
+
type: "submit",
|
|
153
|
+
variant: "primary",
|
|
154
|
+
isLoading: isLoading,
|
|
155
|
+
children: "Continue"
|
|
156
|
+
})
|
|
157
|
+
]
|
|
158
|
+
})
|
|
159
|
+
]
|
|
160
|
+
}),
|
|
161
|
+
step === 'otp-prompt' && /*#__PURE__*/ _jsxs("div", {
|
|
162
|
+
className: "animate-[fadeIn_0.3s_ease-out]",
|
|
163
|
+
children: [
|
|
164
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
165
|
+
className: "flex items-center justify-between border border-gray-300 rounded-xl px-4 py-3 mb-4",
|
|
166
|
+
children: [
|
|
167
|
+
/*#__PURE__*/ _jsx("span", {
|
|
168
|
+
className: "text-gray-900 text-sm",
|
|
169
|
+
children: email
|
|
170
|
+
}),
|
|
171
|
+
/*#__PURE__*/ _jsx("button", {
|
|
172
|
+
type: "button",
|
|
173
|
+
onClick: handleEditEmail,
|
|
174
|
+
className: "text-gray-600 text-sm font-medium hover:text-gray-900",
|
|
175
|
+
children: "Edit"
|
|
176
|
+
})
|
|
177
|
+
]
|
|
178
|
+
}),
|
|
179
|
+
error && /*#__PURE__*/ _jsx("div", {
|
|
180
|
+
className: "bg-red-50 text-red-600 border border-red-200 rounded-lg p-3 text-sm mb-4",
|
|
181
|
+
children: error
|
|
182
|
+
}),
|
|
183
|
+
/*#__PURE__*/ _jsx("div", {
|
|
184
|
+
className: "bg-blue-50 border border-blue-200 rounded-lg p-4 mb-4",
|
|
185
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
186
|
+
className: "flex gap-3",
|
|
187
|
+
children: [
|
|
188
|
+
/*#__PURE__*/ _jsx("span", {
|
|
189
|
+
className: "text-blue-500 text-lg",
|
|
190
|
+
children: "✉"
|
|
191
|
+
}),
|
|
192
|
+
/*#__PURE__*/ _jsx("p", {
|
|
193
|
+
className: "text-sm text-blue-700",
|
|
194
|
+
children: "We'll send a verification code to this email."
|
|
195
|
+
})
|
|
196
|
+
]
|
|
197
|
+
})
|
|
198
|
+
}),
|
|
199
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
200
|
+
variant: "primary",
|
|
201
|
+
isLoading: isSendingOtp,
|
|
202
|
+
onPress: handleSendOtp,
|
|
203
|
+
children: isSendingOtp ? 'Sending...' : 'Send Code'
|
|
204
|
+
})
|
|
205
|
+
]
|
|
206
|
+
})
|
|
207
|
+
]
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
export default function LoginPage(props) {
|
|
211
|
+
return /*#__PURE__*/ _jsx(Suspense, {
|
|
212
|
+
fallback: /*#__PURE__*/ _jsx("div", {
|
|
213
|
+
className: "min-h-screen flex items-center justify-center",
|
|
214
|
+
children: /*#__PURE__*/ _jsx(Spinner, {
|
|
215
|
+
size: "lg"
|
|
216
|
+
})
|
|
217
|
+
}),
|
|
218
|
+
children: /*#__PURE__*/ _jsx(LoginContent, {
|
|
219
|
+
...props
|
|
220
|
+
})
|
|
221
|
+
});
|
|
222
|
+
}
|
|
@@ -2,4 +2,4 @@ import type { AuthLayoutConfig } from '../AuthLayout.js';
|
|
|
2
2
|
export interface SetPasswordPageProps extends AuthLayoutConfig {
|
|
3
3
|
redirectTo?: string;
|
|
4
4
|
}
|
|
5
|
-
export default function SetPasswordPage(
|
|
5
|
+
export default function SetPasswordPage(props: SetPasswordPageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,74 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const strengthBars = Array.from({
|
|
12
|
-
length: 5
|
|
13
|
-
}, (_, i)=>i < strength.score);
|
|
14
|
-
return /*#__PURE__*/ _jsx(AuthLayout, {
|
|
15
|
-
logo: logo,
|
|
16
|
-
title: "Set Your Password",
|
|
17
|
-
subtitle: "Create a secure password for your account",
|
|
18
|
-
poweredBy: poweredBy,
|
|
19
|
-
cardClassName: cardClassName,
|
|
20
|
-
backgroundClass: backgroundClass,
|
|
21
|
-
children: /*#__PURE__*/ _jsxs("form", {
|
|
22
|
-
onSubmit: handleSubmit,
|
|
23
|
-
className: "space-y-4",
|
|
24
|
-
children: [
|
|
25
|
-
error && /*#__PURE__*/ _jsx("div", {
|
|
26
|
-
className: "bg-red-50 text-red-600 border border-red-200 rounded-lg p-3 text-sm animate-[fadeIn_0.2s_ease-out]",
|
|
27
|
-
children: error
|
|
28
|
-
}),
|
|
29
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
30
|
-
className: "relative",
|
|
31
|
-
children: [
|
|
32
|
-
/*#__PURE__*/ _jsx(Input, {
|
|
33
|
-
type: showPassword ? 'text' : 'password',
|
|
34
|
-
label: "New Password",
|
|
35
|
-
value: password,
|
|
36
|
-
onValueChange: setPassword,
|
|
37
|
-
isRequired: true,
|
|
38
|
-
autoFocus: true
|
|
39
|
-
}),
|
|
40
|
-
/*#__PURE__*/ _jsx("button", {
|
|
41
|
-
type: "button",
|
|
42
|
-
onClick: ()=>setShowPassword(!showPassword),
|
|
43
|
-
className: "absolute right-4 top-9 text-gray-400 hover:text-gray-600",
|
|
44
|
-
children: showPassword ? '🙈' : '👁'
|
|
45
|
-
})
|
|
46
|
-
]
|
|
47
|
-
}),
|
|
48
|
-
password.length > 0 && /*#__PURE__*/ _jsx("div", {
|
|
49
|
-
className: "flex gap-1",
|
|
50
|
-
children: strengthBars.map((active, i)=>/*#__PURE__*/ _jsx("div", {
|
|
51
|
-
className: `h-1 flex-1 rounded-full ${active ? 'bg-[#D5E855]' : 'bg-gray-200'}`
|
|
52
|
-
}, i))
|
|
53
|
-
}),
|
|
54
|
-
password.length > 0 && !strength.isValid && /*#__PURE__*/ _jsx("p", {
|
|
55
|
-
className: "text-xs text-gray-500",
|
|
56
|
-
children: "At least 8 chars with 3 of: uppercase, lowercase, number, special character"
|
|
57
|
-
}),
|
|
58
|
-
/*#__PURE__*/ _jsx(Input, {
|
|
59
|
-
type: showPassword ? 'text' : 'password',
|
|
60
|
-
label: "Confirm Password",
|
|
61
|
-
value: confirmPassword,
|
|
62
|
-
onValueChange: setConfirmPassword,
|
|
63
|
-
isRequired: true
|
|
64
|
-
}),
|
|
65
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
66
|
-
type: "submit",
|
|
67
|
-
variant: "primary",
|
|
68
|
-
isLoading: isLoading,
|
|
69
|
-
children: "Set Password"
|
|
70
|
-
})
|
|
71
|
-
]
|
|
72
|
-
})
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { pluginConfig } from '../../config.js';
|
|
4
|
+
import SetPasswordPageTailwind from './SetPasswordPageTailwind.js';
|
|
5
|
+
import SetPasswordPageHero from './SetPasswordPageHero.js';
|
|
6
|
+
export default function SetPasswordPage(props) {
|
|
7
|
+
return pluginConfig.style === 'hero-ui' ? /*#__PURE__*/ _jsx(SetPasswordPageHero, {
|
|
8
|
+
...props
|
|
9
|
+
}) : /*#__PURE__*/ _jsx(SetPasswordPageTailwind, {
|
|
10
|
+
...props
|
|
73
11
|
});
|
|
74
12
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AuthLayoutConfig } from '../AuthLayout.js';
|
|
2
|
+
export interface SetPasswordPageHeroProps extends AuthLayoutConfig {
|
|
3
|
+
redirectTo?: string;
|
|
4
|
+
}
|
|
5
|
+
export default function SetPasswordPageHero({ redirectTo, logo, poweredBy, cardClassName, backgroundClass }: SetPasswordPageHeroProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Button, Input } from '@heroui/react';
|
|
5
|
+
import { Icon } from '@iconify/react';
|
|
6
|
+
import { motion } from 'framer-motion';
|
|
7
|
+
import { useSetPasswordFlow } from '../../auth/application/hooks/useSetPasswordFlow.js';
|
|
8
|
+
import { AuthLayout } from '../AuthLayout.js';
|
|
9
|
+
export default function SetPasswordPageHero({ redirectTo = '/', logo, poweredBy, cardClassName, backgroundClass }) {
|
|
10
|
+
const { password, confirmPassword, error, isLoading, showPassword, strength, setPassword, setConfirmPassword, setShowPassword, handleSubmit } = useSetPasswordFlow({
|
|
11
|
+
redirectTo
|
|
12
|
+
});
|
|
13
|
+
const bars = Array.from({
|
|
14
|
+
length: 5
|
|
15
|
+
}, (_, i)=>i < strength.score);
|
|
16
|
+
return /*#__PURE__*/ _jsx(AuthLayout, {
|
|
17
|
+
logo: logo,
|
|
18
|
+
title: "Set Your Password",
|
|
19
|
+
subtitle: "Create a secure password for your account",
|
|
20
|
+
poweredBy: poweredBy,
|
|
21
|
+
cardClassName: cardClassName,
|
|
22
|
+
backgroundClass: backgroundClass,
|
|
23
|
+
children: /*#__PURE__*/ _jsxs("form", {
|
|
24
|
+
onSubmit: handleSubmit,
|
|
25
|
+
className: "space-y-4",
|
|
26
|
+
children: [
|
|
27
|
+
error && /*#__PURE__*/ _jsx(motion.div, {
|
|
28
|
+
className: "bg-red-50 text-red-600 border border-red-200 rounded-lg p-3 text-sm",
|
|
29
|
+
initial: {
|
|
30
|
+
opacity: 0
|
|
31
|
+
},
|
|
32
|
+
animate: {
|
|
33
|
+
opacity: 1
|
|
34
|
+
},
|
|
35
|
+
children: error
|
|
36
|
+
}),
|
|
37
|
+
/*#__PURE__*/ _jsx(Input, {
|
|
38
|
+
type: showPassword ? 'text' : 'password',
|
|
39
|
+
label: "New Password",
|
|
40
|
+
value: password,
|
|
41
|
+
onValueChange: setPassword,
|
|
42
|
+
variant: "bordered",
|
|
43
|
+
size: "lg",
|
|
44
|
+
isRequired: true,
|
|
45
|
+
autoFocus: true,
|
|
46
|
+
classNames: {
|
|
47
|
+
input: 'text-gray-900',
|
|
48
|
+
label: 'text-gray-600',
|
|
49
|
+
inputWrapper: 'border-gray-300 bg-white'
|
|
50
|
+
},
|
|
51
|
+
endContent: /*#__PURE__*/ _jsx("button", {
|
|
52
|
+
type: "button",
|
|
53
|
+
onClick: ()=>setShowPassword(!showPassword),
|
|
54
|
+
children: /*#__PURE__*/ _jsx(Icon, {
|
|
55
|
+
icon: showPassword ? 'lucide:eye-off' : 'lucide:eye',
|
|
56
|
+
className: "text-gray-400",
|
|
57
|
+
width: 20
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
}),
|
|
61
|
+
password.length > 0 && /*#__PURE__*/ _jsx("div", {
|
|
62
|
+
className: "flex gap-1",
|
|
63
|
+
children: bars.map((a, i)=>/*#__PURE__*/ _jsx("div", {
|
|
64
|
+
className: `h-1 flex-1 rounded-full ${a ? 'bg-[#D5E855]' : 'bg-gray-200'}`
|
|
65
|
+
}, i))
|
|
66
|
+
}),
|
|
67
|
+
/*#__PURE__*/ _jsx(Input, {
|
|
68
|
+
type: showPassword ? 'text' : 'password',
|
|
69
|
+
label: "Confirm Password",
|
|
70
|
+
value: confirmPassword,
|
|
71
|
+
onValueChange: setConfirmPassword,
|
|
72
|
+
variant: "bordered",
|
|
73
|
+
size: "lg",
|
|
74
|
+
isRequired: true,
|
|
75
|
+
classNames: {
|
|
76
|
+
input: 'text-gray-900',
|
|
77
|
+
label: 'text-gray-600',
|
|
78
|
+
inputWrapper: 'border-gray-300 bg-white'
|
|
79
|
+
}
|
|
80
|
+
}),
|
|
81
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
82
|
+
type: "submit",
|
|
83
|
+
fullWidth: true,
|
|
84
|
+
size: "lg",
|
|
85
|
+
color: "primary",
|
|
86
|
+
isLoading: isLoading,
|
|
87
|
+
className: "h-12 font-semibold",
|
|
88
|
+
children: "Set Password"
|
|
89
|
+
})
|
|
90
|
+
]
|
|
91
|
+
})
|
|
92
|
+
});
|
|
93
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AuthLayoutConfig } from '../AuthLayout.js';
|
|
2
|
+
export interface SetPasswordPageProps extends AuthLayoutConfig {
|
|
3
|
+
redirectTo?: string;
|
|
4
|
+
}
|
|
5
|
+
export default function SetPasswordPage({ redirectTo, logo, poweredBy, cardClassName, backgroundClass, }: SetPasswordPageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Button, Input } from '../ui/index.js';
|
|
5
|
+
import { useSetPasswordFlow } from '../../auth/application/hooks/useSetPasswordFlow.js';
|
|
6
|
+
import { AuthLayout } from '../AuthLayout.js';
|
|
7
|
+
export default function SetPasswordPage({ redirectTo = '/', logo, poweredBy, cardClassName, backgroundClass }) {
|
|
8
|
+
const { password, confirmPassword, error, isLoading, showPassword, strength, setPassword, setConfirmPassword, setShowPassword, handleSubmit } = useSetPasswordFlow({
|
|
9
|
+
redirectTo
|
|
10
|
+
});
|
|
11
|
+
const strengthBars = Array.from({
|
|
12
|
+
length: 5
|
|
13
|
+
}, (_, i)=>i < strength.score);
|
|
14
|
+
return /*#__PURE__*/ _jsx(AuthLayout, {
|
|
15
|
+
logo: logo,
|
|
16
|
+
title: "Set Your Password",
|
|
17
|
+
subtitle: "Create a secure password for your account",
|
|
18
|
+
poweredBy: poweredBy,
|
|
19
|
+
cardClassName: cardClassName,
|
|
20
|
+
backgroundClass: backgroundClass,
|
|
21
|
+
children: /*#__PURE__*/ _jsxs("form", {
|
|
22
|
+
onSubmit: handleSubmit,
|
|
23
|
+
className: "space-y-4",
|
|
24
|
+
children: [
|
|
25
|
+
error && /*#__PURE__*/ _jsx("div", {
|
|
26
|
+
className: "bg-red-50 text-red-600 border border-red-200 rounded-lg p-3 text-sm animate-[fadeIn_0.2s_ease-out]",
|
|
27
|
+
children: error
|
|
28
|
+
}),
|
|
29
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
30
|
+
className: "relative",
|
|
31
|
+
children: [
|
|
32
|
+
/*#__PURE__*/ _jsx(Input, {
|
|
33
|
+
type: showPassword ? 'text' : 'password',
|
|
34
|
+
label: "New Password",
|
|
35
|
+
value: password,
|
|
36
|
+
onValueChange: setPassword,
|
|
37
|
+
isRequired: true,
|
|
38
|
+
autoFocus: true
|
|
39
|
+
}),
|
|
40
|
+
/*#__PURE__*/ _jsx("button", {
|
|
41
|
+
type: "button",
|
|
42
|
+
onClick: ()=>setShowPassword(!showPassword),
|
|
43
|
+
className: "absolute right-4 top-9 text-gray-400 hover:text-gray-600",
|
|
44
|
+
children: showPassword ? '🙈' : '👁'
|
|
45
|
+
})
|
|
46
|
+
]
|
|
47
|
+
}),
|
|
48
|
+
password.length > 0 && /*#__PURE__*/ _jsx("div", {
|
|
49
|
+
className: "flex gap-1",
|
|
50
|
+
children: strengthBars.map((active, i)=>/*#__PURE__*/ _jsx("div", {
|
|
51
|
+
className: `h-1 flex-1 rounded-full ${active ? 'bg-[#D5E855]' : 'bg-gray-200'}`
|
|
52
|
+
}, i))
|
|
53
|
+
}),
|
|
54
|
+
password.length > 0 && !strength.isValid && /*#__PURE__*/ _jsx("p", {
|
|
55
|
+
className: "text-xs text-gray-500",
|
|
56
|
+
children: "At least 8 chars with 3 of: uppercase, lowercase, number, special character"
|
|
57
|
+
}),
|
|
58
|
+
/*#__PURE__*/ _jsx(Input, {
|
|
59
|
+
type: showPassword ? 'text' : 'password',
|
|
60
|
+
label: "Confirm Password",
|
|
61
|
+
value: confirmPassword,
|
|
62
|
+
onValueChange: setConfirmPassword,
|
|
63
|
+
isRequired: true
|
|
64
|
+
}),
|
|
65
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
66
|
+
type: "submit",
|
|
67
|
+
variant: "primary",
|
|
68
|
+
isLoading: isLoading,
|
|
69
|
+
children: "Set Password"
|
|
70
|
+
})
|
|
71
|
+
]
|
|
72
|
+
})
|
|
73
|
+
});
|
|
74
|
+
}
|
|
@@ -7,4 +7,4 @@ export interface SignupPageProps extends AuthLayoutConfig {
|
|
|
7
7
|
showGoogleOAuth?: boolean;
|
|
8
8
|
loginUrl?: string;
|
|
9
9
|
}
|
|
10
|
-
export default function SignupPage(
|
|
10
|
+
export default function SignupPage(props: SignupPageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,129 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
export default function SignupPage(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const handleSubmit = async (e)=>{
|
|
12
|
-
e.preventDefault();
|
|
13
|
-
setIsLoading(true);
|
|
14
|
-
setError(null);
|
|
15
|
-
try {
|
|
16
|
-
await onSignup({
|
|
17
|
-
name,
|
|
18
|
-
email
|
|
19
|
-
});
|
|
20
|
-
window.location.href = `/verify-otp?email=${encodeURIComponent(email)}&purpose=signup`;
|
|
21
|
-
} catch (err) {
|
|
22
|
-
setError(err.message || 'Signup failed');
|
|
23
|
-
} finally{
|
|
24
|
-
setIsLoading(false);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
return /*#__PURE__*/ _jsxs(AuthLayout, {
|
|
28
|
-
logo: logo,
|
|
29
|
-
title: "Create Account",
|
|
30
|
-
subtitle: "Enter your details to get started",
|
|
31
|
-
poweredBy: poweredBy,
|
|
32
|
-
cardClassName: cardClassName,
|
|
33
|
-
backgroundClass: backgroundClass,
|
|
34
|
-
footer: /*#__PURE__*/ _jsxs("p", {
|
|
35
|
-
className: "text-center text-gray-600 text-sm",
|
|
36
|
-
children: [
|
|
37
|
-
"Already have an account?",
|
|
38
|
-
' ',
|
|
39
|
-
/*#__PURE__*/ _jsx("a", {
|
|
40
|
-
href: loginUrl,
|
|
41
|
-
className: "text-gray-900 font-medium hover:underline",
|
|
42
|
-
children: "Sign in"
|
|
43
|
-
})
|
|
44
|
-
]
|
|
45
|
-
}),
|
|
46
|
-
children: [
|
|
47
|
-
showGoogleOAuth && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
48
|
-
children: [
|
|
49
|
-
/*#__PURE__*/ _jsxs(Button, {
|
|
50
|
-
fullWidth: true,
|
|
51
|
-
variant: "bordered",
|
|
52
|
-
size: "lg",
|
|
53
|
-
className: "mb-4",
|
|
54
|
-
children: [
|
|
55
|
-
/*#__PURE__*/ _jsx("span", {
|
|
56
|
-
className: "text-lg",
|
|
57
|
-
children: "G"
|
|
58
|
-
}),
|
|
59
|
-
" Continue with Google"
|
|
60
|
-
]
|
|
61
|
-
}),
|
|
62
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
63
|
-
className: "flex items-center gap-4 my-4",
|
|
64
|
-
children: [
|
|
65
|
-
/*#__PURE__*/ _jsx(Divider, {
|
|
66
|
-
className: "flex-1"
|
|
67
|
-
}),
|
|
68
|
-
/*#__PURE__*/ _jsx("span", {
|
|
69
|
-
className: "text-gray-500 text-sm",
|
|
70
|
-
children: "or"
|
|
71
|
-
}),
|
|
72
|
-
/*#__PURE__*/ _jsx(Divider, {
|
|
73
|
-
className: "flex-1"
|
|
74
|
-
})
|
|
75
|
-
]
|
|
76
|
-
})
|
|
77
|
-
]
|
|
78
|
-
}),
|
|
79
|
-
/*#__PURE__*/ _jsxs("form", {
|
|
80
|
-
onSubmit: handleSubmit,
|
|
81
|
-
className: "space-y-4",
|
|
82
|
-
children: [
|
|
83
|
-
error && /*#__PURE__*/ _jsx("div", {
|
|
84
|
-
className: "bg-red-50 text-red-600 border border-red-200 rounded-lg p-3 text-sm animate-[fadeIn_0.2s_ease-out]",
|
|
85
|
-
children: error
|
|
86
|
-
}),
|
|
87
|
-
/*#__PURE__*/ _jsx(Input, {
|
|
88
|
-
label: "Full Name",
|
|
89
|
-
value: name,
|
|
90
|
-
onValueChange: setName,
|
|
91
|
-
isRequired: true
|
|
92
|
-
}),
|
|
93
|
-
/*#__PURE__*/ _jsx(Input, {
|
|
94
|
-
type: "email",
|
|
95
|
-
label: "Email",
|
|
96
|
-
value: email,
|
|
97
|
-
onValueChange: setEmail,
|
|
98
|
-
isRequired: true
|
|
99
|
-
}),
|
|
100
|
-
/*#__PURE__*/ _jsxs("p", {
|
|
101
|
-
className: "text-xs text-gray-600 text-center",
|
|
102
|
-
children: [
|
|
103
|
-
"By signing up, you agree to our",
|
|
104
|
-
' ',
|
|
105
|
-
/*#__PURE__*/ _jsx("a", {
|
|
106
|
-
href: "/terms",
|
|
107
|
-
className: "text-gray-900 hover:underline",
|
|
108
|
-
children: "Terms of Service"
|
|
109
|
-
}),
|
|
110
|
-
" and",
|
|
111
|
-
' ',
|
|
112
|
-
/*#__PURE__*/ _jsx("a", {
|
|
113
|
-
href: "/privacy",
|
|
114
|
-
className: "text-gray-900 hover:underline",
|
|
115
|
-
children: "Privacy Policy"
|
|
116
|
-
})
|
|
117
|
-
]
|
|
118
|
-
}),
|
|
119
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
120
|
-
type: "submit",
|
|
121
|
-
variant: "primary",
|
|
122
|
-
isLoading: isLoading,
|
|
123
|
-
children: "Create Account"
|
|
124
|
-
})
|
|
125
|
-
]
|
|
126
|
-
})
|
|
127
|
-
]
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { pluginConfig } from '../../config.js';
|
|
4
|
+
import SignupPageTailwind from './SignupPageTailwind.js';
|
|
5
|
+
import SignupPageHero from './SignupPageHero.js';
|
|
6
|
+
export default function SignupPage(props) {
|
|
7
|
+
return pluginConfig.style === 'hero-ui' ? /*#__PURE__*/ _jsx(SignupPageHero, {
|
|
8
|
+
...props
|
|
9
|
+
}) : /*#__PURE__*/ _jsx(SignupPageTailwind, {
|
|
10
|
+
...props
|
|
128
11
|
});
|
|
129
12
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AuthLayoutConfig } from '../AuthLayout.js';
|
|
2
|
+
export interface SignupPageHeroProps extends AuthLayoutConfig {
|
|
3
|
+
onSignup: (data: {
|
|
4
|
+
name: string;
|
|
5
|
+
email: string;
|
|
6
|
+
}) => Promise<void>;
|
|
7
|
+
showGoogleOAuth?: boolean;
|
|
8
|
+
loginUrl?: string;
|
|
9
|
+
}
|
|
10
|
+
export default function SignupPageHero({ onSignup, showGoogleOAuth, loginUrl, logo, poweredBy, cardClassName, backgroundClass }: SignupPageHeroProps): import("react/jsx-runtime").JSX.Element;
|