@sqrzro/auth 4.0.0-alpha.10 → 4.0.0-alpha.11
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/dist/forms/LoginForm/index.js +1 -1
- package/dist/forms/PasswordForm/index.js +1 -1
- package/dist/forms/PasswordResetForm/index.js +2 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/interfaces.d.ts +2 -0
- package/package.json +3 -3
- package/src/forms/LoginForm/index.tsx +6 -2
- package/src/forms/PasswordForm/index.tsx +18 -14
- package/src/forms/PasswordResetForm/index.tsx +8 -5
- package/src/index.ts +3 -0
- package/src/interfaces.ts +2 -0
|
@@ -8,6 +8,6 @@ function LoginForm({ classNames }) {
|
|
|
8
8
|
const { fieldProps, formData, formProps } = useForm({
|
|
9
9
|
onSubmit: submit,
|
|
10
10
|
});
|
|
11
|
-
return (_jsxs(Fragment, { children: [_jsx("h1", { className: classNames?.title, children: "Sign in to continue" }), _jsxs(Form, { classNames: { root: classNames?.form }, ...formProps, children: [_jsx(TextFormField, { ...fieldProps('email'), hasAssistiveError: true }), _jsx(PasswordFormField, { ...fieldProps('password'), hasAssistiveError: true }), _jsx("div", { className: classNames?.actions, children: _jsx(FormSubmit, { isFullWidth: true, children: "Sign In" }) }), _jsx("footer", { className: classNames?.footer, children: _jsx(Link, { className: classNames?.link, href: `/auth/password${formData.email ? `?email=${formData.email}` : ''}`, children: "Forgot Password?" }) })] })] }));
|
|
11
|
+
return (_jsxs(Fragment, { children: [_jsx("h1", { className: classNames?.title, children: "Sign in to continue" }), _jsxs(Form, { classNames: { root: classNames?.form }, ...formProps, children: [_jsx("div", { className: classNames?.field, children: _jsx(TextFormField, { ...fieldProps('email'), hasAssistiveError: true }) }), _jsx("div", { className: classNames?.field, children: _jsx(PasswordFormField, { ...fieldProps('password'), hasAssistiveError: true }) }), _jsx("div", { className: classNames?.actions, children: _jsx(FormSubmit, { isFullWidth: true, children: "Sign In" }) }), _jsx("footer", { className: classNames?.footer, children: _jsx(Link, { className: classNames?.link, href: `/auth/password${formData.email ? `?email=${formData.email}` : ''}`, children: "Forgot Password?" }) })] })] }));
|
|
12
12
|
}
|
|
13
13
|
export default LoginForm;
|
|
@@ -22,6 +22,6 @@ function PasswordForm({ classNames, defaults }) {
|
|
|
22
22
|
setFormData('email', '');
|
|
23
23
|
setSentCount(0);
|
|
24
24
|
}
|
|
25
|
-
return (_jsxs(Fragment, { children: [_jsx("div", { style: { display: sentCount === 0 ? 'block' : 'none' }, children: _jsxs(Form, { ...formProps, children: [_jsx("h1", { className: classNames?.title, children: "Reset Your Password" }), _jsx("
|
|
25
|
+
return (_jsxs(Fragment, { children: [_jsx("div", { style: { display: sentCount === 0 ? 'block' : 'none' }, children: _jsxs(Form, { classNames: { root: classNames?.form }, ...formProps, children: [_jsx("h1", { className: classNames?.title, children: "Reset Your Password" }), _jsx("div", { className: classNames?.content, children: _jsx("p", { children: "Enter the email address associated with your account and we'll send you a link to reset your password." }) }), _jsx("div", { className: classNames?.field, children: _jsx(TextFormField, { ...fieldProps('email'), hasAssistiveError: true }) }), _jsx("div", { className: classNames?.actions, children: _jsx(FormSubmit, { isFullWidth: true, children: "Send Email" }) }), _jsx("footer", { className: classNames?.footer, children: _jsx(Link, { className: classNames?.link, href: "/auth/login", children: "Back" }) })] }) }), _jsx("div", { style: { display: sentCount === 0 ? 'none' : 'block' }, children: _jsxs("div", { className: classNames?.form, children: [_jsx("h1", { className: classNames?.title, children: "Check Your Email" }), sentCount === 1 ? (_jsxs("div", { className: classNames?.content, children: [_jsxs("p", { children: ["If ", _jsx("strong", { children: formData.email }), " matches an email we have on file, then we've sent you an email containing further instructions for resetting your password."] }), _jsxs("p", { children: ["If you haven't received an email in 5 minutes, check your spam,", ' ', _jsx(Link, { className: classNames?.link, onClick: handleResend, children: "resend" }), ", or", ' ', _jsx(Link, { className: classNames?.link, onClick: handleReset, children: "try a different email address" }), "."] })] })) : (_jsxs("div", { className: classNames?.content, children: [_jsxs("p", { children: ["We've resent password reset instructions to", ' ', _jsx("strong", { children: formData.email }), ", if it is an email we have on file."] }), _jsxs("p", { children: ["Please check again. If you still haven't received an email,", ' ', _jsx(Link, { className: classNames?.link, onClick: handleReset, children: "try a different email address" }), "."] })] }))] }) })] }));
|
|
26
26
|
}
|
|
27
27
|
export default PasswordForm;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { useState } from 'react';
|
|
4
4
|
import { Form, FormSubmit, useForm } from '@sqrzro/ui/forms';
|
|
5
5
|
import PasswordComplexityFormField from '../../components/PasswordComplexityFormField';
|
|
6
6
|
import submit from './server';
|
|
@@ -10,6 +10,6 @@ function PasswordResetForm({ classNames, token, }) {
|
|
|
10
10
|
defaults: { token },
|
|
11
11
|
onSubmit: submit,
|
|
12
12
|
});
|
|
13
|
-
return (_jsx(
|
|
13
|
+
return (_jsxs(Form, { classNames: { root: classNames?.form }, ...formProps, children: [_jsx("h1", { className: classNames?.title, children: "Reset Your Password" }), _jsx("div", { className: classNames?.field, children: _jsx(PasswordComplexityFormField, { ...fieldProps('password'), onComplexity: (isValid) => setIsDisabled(!isValid) }) }), _jsx("div", { className: classNames?.actions, children: _jsx(FormSubmit, { isDisabled: isDisabled, children: "Reset Password" }) })] }));
|
|
14
14
|
}
|
|
15
15
|
export default PasswordResetForm;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,4 +2,6 @@ export type { AuthClassNames, AuthConfigObject } from './interfaces';
|
|
|
2
2
|
export type { AuthProps } from './components/Auth';
|
|
3
3
|
export { default as Auth } from './components/Auth';
|
|
4
4
|
export { default as LogoutButton } from './components/LogoutButton';
|
|
5
|
+
export { default as PasswordComplexityFormField } from './components/PasswordComplexityFormField';
|
|
6
|
+
export { default as getComplexityRule } from './rules/complexity';
|
|
5
7
|
export { default as getAuthProxy } from './get-auth-proxy';
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { default as Auth } from './components/Auth';
|
|
2
2
|
export { default as LogoutButton } from './components/LogoutButton';
|
|
3
|
+
export { default as PasswordComplexityFormField } from './components/PasswordComplexityFormField';
|
|
4
|
+
export { default as getComplexityRule } from './rules/complexity';
|
|
3
5
|
export { default as getAuthProxy } from './get-auth-proxy';
|
package/dist/interfaces.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqrzro/auth",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.0.0-alpha.
|
|
4
|
+
"version": "4.0.0-alpha.11",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"zod": "^4.3.6",
|
|
9
|
-
"@sqrzro/server": "^4.0.0-alpha.20",
|
|
10
9
|
"@sqrzro/ui": "^4.0.0-alpha.20",
|
|
11
|
-
"@sqrzro/utility": "^4.0.0-alpha.7"
|
|
10
|
+
"@sqrzro/utility": "^4.0.0-alpha.7",
|
|
11
|
+
"@sqrzro/server": "^4.0.0-alpha.20"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"@types/react": "^19.2.7",
|
|
@@ -18,8 +18,12 @@ function LoginForm({ classNames }: AuthClassNameProps): React.ReactElement | nul
|
|
|
18
18
|
<Fragment>
|
|
19
19
|
<h1 className={classNames?.title}>Sign in to continue</h1>
|
|
20
20
|
<Form classNames={{ root: classNames?.form }} {...formProps}>
|
|
21
|
-
<
|
|
22
|
-
|
|
21
|
+
<div className={classNames?.field}>
|
|
22
|
+
<TextFormField {...fieldProps('email')} hasAssistiveError />
|
|
23
|
+
</div>
|
|
24
|
+
<div className={classNames?.field}>
|
|
25
|
+
<PasswordFormField {...fieldProps('password')} hasAssistiveError />
|
|
26
|
+
</div>
|
|
23
27
|
<div className={classNames?.actions}>
|
|
24
28
|
<FormSubmit isFullWidth>Sign In</FormSubmit>
|
|
25
29
|
</div>
|
|
@@ -40,13 +40,17 @@ function PasswordForm({ classNames, defaults }: PasswordFormProps): React.ReactE
|
|
|
40
40
|
return (
|
|
41
41
|
<Fragment>
|
|
42
42
|
<div style={{ display: sentCount === 0 ? 'block' : 'none' }}>
|
|
43
|
-
<Form {...formProps}>
|
|
43
|
+
<Form classNames={{ root: classNames?.form }} {...formProps}>
|
|
44
44
|
<h1 className={classNames?.title}>Reset Your Password</h1>
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
<div className={classNames?.content}>
|
|
46
|
+
<p>
|
|
47
|
+
Enter the email address associated with your account and we'll send
|
|
48
|
+
you a link to reset your password.
|
|
49
|
+
</p>
|
|
50
|
+
</div>
|
|
51
|
+
<div className={classNames?.field}>
|
|
52
|
+
<TextFormField {...fieldProps('email')} hasAssistiveError />
|
|
53
|
+
</div>
|
|
50
54
|
<div className={classNames?.actions}>
|
|
51
55
|
<FormSubmit isFullWidth>Send Email</FormSubmit>
|
|
52
56
|
</div>
|
|
@@ -61,13 +65,13 @@ function PasswordForm({ classNames, defaults }: PasswordFormProps): React.ReactE
|
|
|
61
65
|
<div className={classNames?.form}>
|
|
62
66
|
<h1 className={classNames?.title}>Check Your Email</h1>
|
|
63
67
|
{sentCount === 1 ? (
|
|
64
|
-
<
|
|
65
|
-
<p
|
|
68
|
+
<div className={classNames?.content}>
|
|
69
|
+
<p>
|
|
66
70
|
If <strong>{formData.email}</strong> matches an email we have on
|
|
67
71
|
file, then we've sent you an email containing further
|
|
68
72
|
instructions for resetting your password.
|
|
69
73
|
</p>
|
|
70
|
-
<p
|
|
74
|
+
<p>
|
|
71
75
|
If you haven't received an email in 5 minutes, check your spam,{' '}
|
|
72
76
|
<Link className={classNames?.link} onClick={handleResend}>
|
|
73
77
|
resend
|
|
@@ -78,22 +82,22 @@ function PasswordForm({ classNames, defaults }: PasswordFormProps): React.ReactE
|
|
|
78
82
|
</Link>
|
|
79
83
|
.
|
|
80
84
|
</p>
|
|
81
|
-
</
|
|
85
|
+
</div>
|
|
82
86
|
) : (
|
|
83
|
-
<
|
|
84
|
-
<p
|
|
87
|
+
<div className={classNames?.content}>
|
|
88
|
+
<p>
|
|
85
89
|
We've resent password reset instructions to{' '}
|
|
86
90
|
<strong>{formData.email}</strong>, if it is an email we have on
|
|
87
91
|
file.
|
|
88
92
|
</p>
|
|
89
|
-
<p
|
|
93
|
+
<p>
|
|
90
94
|
Please check again. If you still haven't received an email,{' '}
|
|
91
95
|
<Link className={classNames?.link} onClick={handleReset}>
|
|
92
96
|
try a different email address
|
|
93
97
|
</Link>
|
|
94
98
|
.
|
|
95
99
|
</p>
|
|
96
|
-
</
|
|
100
|
+
</div>
|
|
97
101
|
)}
|
|
98
102
|
</div>
|
|
99
103
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { useState } from 'react';
|
|
4
4
|
|
|
5
5
|
import { Form, FormSubmit, useForm } from '@sqrzro/ui/forms';
|
|
6
6
|
|
|
@@ -25,15 +25,18 @@ function PasswordResetForm({
|
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
return (
|
|
28
|
-
<
|
|
29
|
-
<
|
|
28
|
+
<Form classNames={{ root: classNames?.form }} {...formProps}>
|
|
29
|
+
<h1 className={classNames?.title}>Reset Your Password</h1>
|
|
30
|
+
<div className={classNames?.field}>
|
|
30
31
|
<PasswordComplexityFormField
|
|
31
32
|
{...fieldProps('password')}
|
|
32
33
|
onComplexity={(isValid) => setIsDisabled(!isValid)}
|
|
33
34
|
/>
|
|
35
|
+
</div>
|
|
36
|
+
<div className={classNames?.actions}>
|
|
34
37
|
<FormSubmit isDisabled={isDisabled}>Reset Password</FormSubmit>
|
|
35
|
-
</
|
|
36
|
-
</
|
|
38
|
+
</div>
|
|
39
|
+
</Form>
|
|
37
40
|
);
|
|
38
41
|
}
|
|
39
42
|
|
package/src/index.ts
CHANGED
|
@@ -4,5 +4,8 @@ export type { AuthProps } from './components/Auth';
|
|
|
4
4
|
export { default as Auth } from './components/Auth';
|
|
5
5
|
|
|
6
6
|
export { default as LogoutButton } from './components/LogoutButton';
|
|
7
|
+
export { default as PasswordComplexityFormField } from './components/PasswordComplexityFormField';
|
|
8
|
+
|
|
9
|
+
export { default as getComplexityRule } from './rules/complexity';
|
|
7
10
|
|
|
8
11
|
export { default as getAuthProxy } from './get-auth-proxy';
|