@contentgrowth/content-auth 0.2.5 → 0.2.6
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/backend/index.d.ts +17 -0
- package/dist/backend/index.js +1 -1
- package/dist/{chunk-6DFIEMYG.js → chunk-N5OK3XPK.js} +3 -1
- package/dist/{chunk-7JTB52CI.js → chunk-YXUGDZZK.js} +6 -5
- package/dist/frontend/index.d.ts +1 -1
- package/dist/frontend/index.js +1 -1
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/backend/index.d.ts
CHANGED
|
@@ -1104,6 +1104,23 @@ interface AuthConfig {
|
|
|
1104
1104
|
* Defaults to true. Set to false to use Better Auth's default (Scrypt/Argon2).
|
|
1105
1105
|
*/
|
|
1106
1106
|
useCloudflareNativeHashing?: boolean;
|
|
1107
|
+
/**
|
|
1108
|
+
* Email verification configuration.
|
|
1109
|
+
* For email/password signups, you can enable automatic verification emails.
|
|
1110
|
+
* OAuth signups (Google, GitHub) automatically set emailVerified = true.
|
|
1111
|
+
*/
|
|
1112
|
+
emailVerification?: {
|
|
1113
|
+
/** Send verification email automatically on signup. Default: false */
|
|
1114
|
+
sendOnSignUp?: boolean;
|
|
1115
|
+
/** Auto sign in user after email verification. Default: true */
|
|
1116
|
+
autoSignInAfterVerification?: boolean;
|
|
1117
|
+
/** Callback to send verification email */
|
|
1118
|
+
sendVerificationEmail?: (data: {
|
|
1119
|
+
user: any;
|
|
1120
|
+
url: string;
|
|
1121
|
+
token: string;
|
|
1122
|
+
}, request: any) => Promise<void> | void;
|
|
1123
|
+
};
|
|
1107
1124
|
[key: string]: any;
|
|
1108
1125
|
}
|
|
1109
1126
|
declare const createAuth: (config: AuthConfig) => better_auth.Auth<any>;
|
package/dist/backend/index.js
CHANGED
|
@@ -201,7 +201,7 @@ var createAuth = (config) => {
|
|
|
201
201
|
} else {
|
|
202
202
|
db = config.database;
|
|
203
203
|
}
|
|
204
|
-
const { database, secret, baseUrl, provider: _, useCloudflareNativeHashing = true, ...rest } = config;
|
|
204
|
+
const { database, secret, baseUrl, provider: _, useCloudflareNativeHashing = true, emailVerification, ...rest } = config;
|
|
205
205
|
let adapterOptions = {
|
|
206
206
|
provider,
|
|
207
207
|
schema: {
|
|
@@ -230,6 +230,8 @@ var createAuth = (config) => {
|
|
|
230
230
|
secret,
|
|
231
231
|
baseURL: baseUrl,
|
|
232
232
|
emailAndPassword: emailPasswordOptions,
|
|
233
|
+
// Pass emailVerification config if provided
|
|
234
|
+
...emailVerification ? { emailVerification } : {},
|
|
233
235
|
...otherOptions
|
|
234
236
|
});
|
|
235
237
|
return auth;
|
|
@@ -37,21 +37,22 @@ var AuthForm = ({
|
|
|
37
37
|
setLoading(true);
|
|
38
38
|
setError(null);
|
|
39
39
|
try {
|
|
40
|
+
let response;
|
|
40
41
|
if (isLogin) {
|
|
41
|
-
|
|
42
|
+
response = await client.signIn.email({
|
|
42
43
|
email,
|
|
43
44
|
password
|
|
44
45
|
});
|
|
45
|
-
if (
|
|
46
|
+
if (response.error) throw response.error;
|
|
46
47
|
} else {
|
|
47
|
-
|
|
48
|
+
response = await client.signUp.email({
|
|
48
49
|
email,
|
|
49
50
|
password,
|
|
50
51
|
name
|
|
51
52
|
});
|
|
52
|
-
if (
|
|
53
|
+
if (response.error) throw response.error;
|
|
53
54
|
}
|
|
54
|
-
onSuccess?.();
|
|
55
|
+
onSuccess?.(response.data);
|
|
55
56
|
} catch (err) {
|
|
56
57
|
setError(err.message || "An error occurred");
|
|
57
58
|
} finally {
|
package/dist/frontend/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import 'better-auth/plugins';
|
|
|
9
9
|
interface AuthFormProps {
|
|
10
10
|
view?: 'signin' | 'signup';
|
|
11
11
|
client?: typeof authClient;
|
|
12
|
-
onSuccess?: () => void;
|
|
12
|
+
onSuccess?: (data?: any) => void;
|
|
13
13
|
className?: string;
|
|
14
14
|
socialProviders?: string[];
|
|
15
15
|
socialLayout?: 'row' | 'column';
|
package/dist/frontend/index.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
getInvitationLink,
|
|
7
7
|
getSessionToken,
|
|
8
8
|
schema_exports
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-N5OK3XPK.js";
|
|
10
10
|
import {
|
|
11
11
|
AuthForm,
|
|
12
12
|
CreateOrganizationForm,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
InviteMemberForm,
|
|
15
15
|
OrganizationSwitcher,
|
|
16
16
|
ResetPasswordForm
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-YXUGDZZK.js";
|
|
18
18
|
import {
|
|
19
19
|
authClient,
|
|
20
20
|
createClient
|