@xk2800/nextjs-template 0.6.1-beta.0 → 0.6.1-beta.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.
Files changed (78) hide show
  1. package/components/auth/forgotPasswordForm.tsx +1 -1
  2. package/components/dashboard/twoFactorCard.tsx +2 -1
  3. package/dist/activity/logger.js +5 -1
  4. package/dist/activity/logger.js.map +1 -1
  5. package/dist/activity/logger.mjs +4 -4
  6. package/dist/activity/queries.d.mts +1 -1
  7. package/dist/activity/queries.d.ts +1 -1
  8. package/dist/activity/queries.js +5 -1
  9. package/dist/activity/queries.js.map +1 -1
  10. package/dist/activity/queries.mjs +3 -3
  11. package/dist/admin/queries.js +5 -1
  12. package/dist/admin/queries.js.map +1 -1
  13. package/dist/admin/queries.mjs +3 -3
  14. package/dist/auth/helpers.d.mts +3 -3
  15. package/dist/auth/helpers.d.ts +3 -3
  16. package/dist/auth/helpers.js +183 -151
  17. package/dist/auth/helpers.js.map +1 -1
  18. package/dist/auth/helpers.mjs +6 -6
  19. package/dist/auth/index.d.mts +3313 -5326
  20. package/dist/auth/index.d.ts +3313 -5326
  21. package/dist/auth/index.js +183 -151
  22. package/dist/auth/index.js.map +1 -1
  23. package/dist/auth/index.mjs +6 -6
  24. package/dist/auth-client/index.d.mts +5052 -4718
  25. package/dist/auth-client/index.d.ts +5052 -4718
  26. package/dist/auth-client/index.js +3 -9
  27. package/dist/auth-client/index.js.map +1 -1
  28. package/dist/auth-client/index.mjs +4 -10
  29. package/dist/auth-client/index.mjs.map +1 -1
  30. package/dist/{chunk-YN4436PK.mjs → chunk-3465SI5N.mjs} +3 -9
  31. package/dist/{chunk-YN4436PK.mjs.map → chunk-3465SI5N.mjs.map} +1 -1
  32. package/dist/{chunk-YZPJ54QG.mjs → chunk-4B7MJOLH.mjs} +8 -4
  33. package/dist/chunk-4B7MJOLH.mjs.map +1 -0
  34. package/dist/{chunk-SJE6A43W.mjs → chunk-5PYDAD4P.mjs} +3 -3
  35. package/dist/{chunk-SJE6A43W.mjs.map → chunk-5PYDAD4P.mjs.map} +1 -1
  36. package/dist/{chunk-HJ62TBEK.mjs → chunk-IF3JZRSZ.mjs} +5 -5
  37. package/dist/{chunk-HJ62TBEK.mjs.map → chunk-IF3JZRSZ.mjs.map} +1 -1
  38. package/dist/{chunk-AJRWDR65.mjs → chunk-OHAUKE2Q.mjs} +4 -4
  39. package/dist/{chunk-AJRWDR65.mjs.map → chunk-OHAUKE2Q.mjs.map} +1 -1
  40. package/dist/{chunk-WYQDMN26.mjs → chunk-V72CFFU2.mjs} +29 -147
  41. package/dist/chunk-V72CFFU2.mjs.map +1 -0
  42. package/dist/config/env.mjs +1 -1
  43. package/dist/db/index.d.mts +1 -1
  44. package/dist/db/index.d.ts +1 -1
  45. package/dist/db/index.js +5 -1
  46. package/dist/db/index.js.map +1 -1
  47. package/dist/db/index.mjs +3 -3
  48. package/dist/db/schema.d.mts +1 -1
  49. package/dist/db/schema.d.ts +1 -1
  50. package/dist/db/schema.js +5 -1
  51. package/dist/db/schema.js.map +1 -1
  52. package/dist/db/schema.mjs +2 -2
  53. package/dist/email-template-passkey-change-F5Q2SXHD.mjs +66 -0
  54. package/dist/email-template-passkey-change-F5Q2SXHD.mjs.map +1 -0
  55. package/dist/email-template-reset-password-QTCQNXOD.mjs +42 -0
  56. package/dist/email-template-reset-password-QTCQNXOD.mjs.map +1 -0
  57. package/dist/email-template-verify-email-WZDCCAKK.mjs +34 -0
  58. package/dist/email-template-verify-email-WZDCCAKK.mjs.map +1 -0
  59. package/dist/{schema-B2bpUUth.d.mts → schema-BrBmQFkn.d.mts} +52 -1
  60. package/dist/{schema-B2bpUUth.d.ts → schema-BrBmQFkn.d.ts} +52 -1
  61. package/dist/sessions/queries.js +5 -1
  62. package/dist/sessions/queries.js.map +1 -1
  63. package/dist/sessions/queries.mjs +3 -3
  64. package/dist/settings/queries.d.mts +1 -1
  65. package/dist/settings/queries.d.ts +1 -1
  66. package/dist/settings/queries.js +5 -1
  67. package/dist/settings/queries.js.map +1 -1
  68. package/dist/settings/queries.mjs +4 -4
  69. package/dist/types/auth/loginSchema.mjs +1 -1
  70. package/dist/types/auth/signupSchema.mjs +1 -1
  71. package/dist/users/queries.js +5 -1
  72. package/dist/users/queries.js.map +1 -1
  73. package/dist/users/queries.mjs +3 -3
  74. package/lib/auth-client.ts +4 -22
  75. package/lib/cookie-consent.ts +54 -0
  76. package/package.json +5 -3
  77. package/dist/chunk-WYQDMN26.mjs.map +0 -1
  78. package/dist/chunk-YZPJ54QG.mjs.map +0 -1
@@ -1,34 +1,32 @@
1
1
  'use strict';
2
2
 
3
+ var components = require('@react-email/components');
4
+ var jsxRuntime = require('react/jsx-runtime');
3
5
  require('server-only');
4
6
  var betterAuth = require('better-auth');
5
7
  var drizzle = require('better-auth/adapters/drizzle');
8
+ var cuid2 = require('@paralleldrive/cuid2');
6
9
  var drizzleOrm = require('drizzle-orm');
7
10
  var serverless = require('@neondatabase/serverless');
8
11
  var neonHttp = require('drizzle-orm/neon-http');
9
12
  var nodePostgres = require('drizzle-orm/node-postgres');
10
13
  var pg = require('pg');
11
14
  var pgCore = require('drizzle-orm/pg-core');
12
- var cuid2 = require('@paralleldrive/cuid2');
13
15
  var zod = require('zod');
14
- var bcrypt = require('bcrypt');
15
16
  var plugins = require('better-auth/plugins');
16
- var passkey = require('better-auth/plugins/passkey');
17
+ var passkey = require('@better-auth/passkey');
17
18
  var api = require('better-auth/api');
18
19
  var uaParserJs = require('ua-parser-js');
19
20
  var geoip = require('geoip-lite');
20
- var resend$1 = require('resend');
21
- var components = require('@react-email/components');
22
- var jsxRuntime = require('react/jsx-runtime');
23
21
 
24
22
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
25
23
 
26
- var bcrypt__default = /*#__PURE__*/_interopDefault(bcrypt);
27
24
  var geoip__default = /*#__PURE__*/_interopDefault(geoip);
28
25
 
29
26
  var __defProp = Object.defineProperty;
30
27
  var __defProps = Object.defineProperties;
31
28
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
29
+ var __getOwnPropNames = Object.getOwnPropertyNames;
32
30
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
33
31
  var __hasOwnProp = Object.prototype.hasOwnProperty;
34
32
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
@@ -45,17 +43,162 @@ var __spreadValues = (a, b) => {
45
43
  return a;
46
44
  };
47
45
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
48
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
49
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
50
- }) : x)(function(x) {
51
- if (typeof require !== "undefined") return require.apply(this, arguments);
52
- throw Error('Dynamic require of "' + x + '" is not supported');
53
- });
46
+ var __esm = (fn, res) => function __init() {
47
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
48
+ };
54
49
  var __export = (target, all) => {
55
50
  for (var name in all)
56
51
  __defProp(target, name, { get: all[name], enumerable: true });
57
52
  };
58
53
 
54
+ // components/email/email-template-passkey-change.tsx
55
+ var email_template_passkey_change_exports = {};
56
+ __export(email_template_passkey_change_exports, {
57
+ EmailTemplatePasskeyChange: () => EmailTemplatePasskeyChange
58
+ });
59
+ function EmailTemplatePasskeyChange({
60
+ firstName,
61
+ action,
62
+ device,
63
+ location,
64
+ ipAddress,
65
+ when,
66
+ manageUrl
67
+ }) {
68
+ const verb = action === "added" ? "added to" : "removed from";
69
+ return /* @__PURE__ */ jsxRuntime.jsxs(components.Html, { children: [
70
+ /* @__PURE__ */ jsxRuntime.jsx(components.Head, {}),
71
+ /* @__PURE__ */ jsxRuntime.jsx(components.Tailwind, { children: /* @__PURE__ */ jsxRuntime.jsx(components.Body, { className: "bg-white font-sans", children: /* @__PURE__ */ jsxRuntime.jsx(components.Container, { className: "mx-auto max-w-[560px] px-0 pt-5 pb-12", children: /* @__PURE__ */ jsxRuntime.jsxs(components.Section, { className: "rounded-xl bg-[#f8f9fa] p-10", children: [
72
+ /* @__PURE__ */ jsxRuntime.jsxs(components.Heading, { className: "mb-3 text-center text-2xl font-bold text-[#1a1a1a]", children: [
73
+ "A passkey was ",
74
+ action
75
+ ] }),
76
+ /* @__PURE__ */ jsxRuntime.jsxs(components.Text, { className: "mb-6 text-base leading-6 text-[#666666]", children: [
77
+ "Hi ",
78
+ firstName,
79
+ ", a passkey was just ",
80
+ verb,
81
+ " your account."
82
+ ] }),
83
+ /* @__PURE__ */ jsxRuntime.jsxs(components.Section, { className: "mb-6 rounded-lg bg-white p-5", children: [
84
+ /* @__PURE__ */ jsxRuntime.jsxs(components.Text, { className: "m-0 mb-2 text-sm leading-5 text-[#1a1a1a]", children: [
85
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Device:" }),
86
+ " ",
87
+ device
88
+ ] }),
89
+ /* @__PURE__ */ jsxRuntime.jsxs(components.Text, { className: "m-0 mb-2 text-sm leading-5 text-[#1a1a1a]", children: [
90
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Approx. location:" }),
91
+ " ",
92
+ location
93
+ ] }),
94
+ /* @__PURE__ */ jsxRuntime.jsxs(components.Text, { className: "m-0 mb-2 text-sm leading-5 text-[#1a1a1a]", children: [
95
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "IP address:" }),
96
+ " ",
97
+ ipAddress
98
+ ] }),
99
+ /* @__PURE__ */ jsxRuntime.jsxs(components.Text, { className: "m-0 text-sm leading-5 text-[#1a1a1a]", children: [
100
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "When:" }),
101
+ " ",
102
+ when
103
+ ] })
104
+ ] }),
105
+ manageUrl && /* @__PURE__ */ jsxRuntime.jsx(components.Section, { className: "mb-6 text-center", children: /* @__PURE__ */ jsxRuntime.jsx(
106
+ components.Button,
107
+ {
108
+ href: manageUrl,
109
+ className: "rounded-lg bg-[#1a1a1a] px-6 py-3 text-sm font-bold text-white no-underline",
110
+ children: "Review your passkeys"
111
+ }
112
+ ) }),
113
+ /* @__PURE__ */ jsxRuntime.jsx(components.Text, { className: "text-sm leading-[22px] text-[#666666]", children: "If this was you, no action is needed. If you don't recognize it, change your password now and review your passkeys and active sessions." })
114
+ ] }) }) }) })
115
+ ] });
116
+ }
117
+ var init_email_template_passkey_change = __esm({
118
+ "components/email/email-template-passkey-change.tsx"() {
119
+ }
120
+ });
121
+
122
+ // components/email/email-template-reset-password.tsx
123
+ var email_template_reset_password_exports = {};
124
+ __export(email_template_reset_password_exports, {
125
+ EmailTemplateResetPassword: () => EmailTemplateResetPassword
126
+ });
127
+ function EmailTemplateResetPassword({ firstName, url }) {
128
+ return /* @__PURE__ */ jsxRuntime.jsxs(components.Html, { children: [
129
+ /* @__PURE__ */ jsxRuntime.jsx(components.Head, {}),
130
+ /* @__PURE__ */ jsxRuntime.jsx(components.Body, { style: { backgroundColor: "#ffffff", fontFamily: "Arial, sans-serif" }, children: /* @__PURE__ */ jsxRuntime.jsx(components.Container, { style: { margin: "0 auto", padding: "20px 0 48px", maxWidth: "560px" }, children: /* @__PURE__ */ jsxRuntime.jsxs(components.Section, { style: { backgroundColor: "#f8f9fa", borderRadius: "12px", padding: "40px", textAlign: "center" }, children: [
131
+ /* @__PURE__ */ jsxRuntime.jsx(components.Heading, { style: { fontSize: "28px", fontWeight: "bold", marginBottom: "12px", color: "#1a1a1a" }, children: "Reset your password" }),
132
+ /* @__PURE__ */ jsxRuntime.jsxs(components.Text, { style: { fontSize: "16px", color: "#666666", marginBottom: "32px", lineHeight: "24px" }, children: [
133
+ "Hi ",
134
+ firstName,
135
+ ", we got a request to reset your password. This link expires in an hour \u2014 if you didn't ask for this, you can safely ignore this email."
136
+ ] }),
137
+ /* @__PURE__ */ jsxRuntime.jsx(components.Section, { style: { marginBottom: "32px" }, children: /* @__PURE__ */ jsxRuntime.jsx(
138
+ components.Button,
139
+ {
140
+ href: url,
141
+ style: {
142
+ backgroundColor: "#000000",
143
+ color: "#ffffff",
144
+ padding: "12px 32px",
145
+ borderRadius: "6px",
146
+ textDecoration: "none",
147
+ fontSize: "16px",
148
+ fontWeight: "bold"
149
+ },
150
+ children: "Reset password"
151
+ }
152
+ ) }),
153
+ /* @__PURE__ */ jsxRuntime.jsxs(components.Text, { style: { fontSize: "13px", color: "#999999", lineHeight: "20px", wordBreak: "break-all" }, children: [
154
+ "Or paste this link into your browser:",
155
+ /* @__PURE__ */ jsxRuntime.jsx("br", {}),
156
+ /* @__PURE__ */ jsxRuntime.jsx("a", { href: url, style: { color: "#000000", textDecoration: "underline" }, children: url })
157
+ ] })
158
+ ] }) }) })
159
+ ] });
160
+ }
161
+ var init_email_template_reset_password = __esm({
162
+ "components/email/email-template-reset-password.tsx"() {
163
+ }
164
+ });
165
+
166
+ // components/email/email-template-verify-email.tsx
167
+ var email_template_verify_email_exports = {};
168
+ __export(email_template_verify_email_exports, {
169
+ EmailTemplateVerifyEmail: () => EmailTemplateVerifyEmail
170
+ });
171
+ function EmailTemplateVerifyEmail({ firstName, url }) {
172
+ return /* @__PURE__ */ jsxRuntime.jsxs(components.Html, { children: [
173
+ /* @__PURE__ */ jsxRuntime.jsx(components.Head, {}),
174
+ /* @__PURE__ */ jsxRuntime.jsx(components.Tailwind, { children: /* @__PURE__ */ jsxRuntime.jsx(components.Body, { className: "bg-white font-sans", children: /* @__PURE__ */ jsxRuntime.jsx(components.Container, { className: "mx-auto max-w-[560px] px-0 pt-5 pb-12", children: /* @__PURE__ */ jsxRuntime.jsxs(components.Section, { className: "rounded-xl bg-[#f8f9fa] p-10 text-center", children: [
175
+ /* @__PURE__ */ jsxRuntime.jsx(components.Heading, { className: "mb-3 text-[28px] font-bold text-[#1a1a1a]", children: "Confirm your email" }),
176
+ /* @__PURE__ */ jsxRuntime.jsxs(components.Text, { className: "mb-8 text-base leading-6 text-[#666666]", children: [
177
+ "Hi ",
178
+ firstName,
179
+ ", click the button below to verify this email address. If you didn't create an account, you can safely ignore this email."
180
+ ] }),
181
+ /* @__PURE__ */ jsxRuntime.jsx(components.Section, { className: "mb-8", children: /* @__PURE__ */ jsxRuntime.jsx(
182
+ components.Button,
183
+ {
184
+ href: url,
185
+ className: "rounded-md bg-black px-8 py-3 text-base font-bold text-white no-underline",
186
+ children: "Verify email"
187
+ }
188
+ ) }),
189
+ /* @__PURE__ */ jsxRuntime.jsxs(components.Text, { className: "text-[13px] leading-5 break-all text-[#999999]", children: [
190
+ "Or paste this link into your browser:",
191
+ /* @__PURE__ */ jsxRuntime.jsx("br", {}),
192
+ /* @__PURE__ */ jsxRuntime.jsx(components.Link, { href: url, className: "text-black underline", children: url })
193
+ ] })
194
+ ] }) }) }) })
195
+ ] });
196
+ }
197
+ var init_email_template_verify_email = __esm({
198
+ "components/email/email-template-verify-email.tsx"() {
199
+ }
200
+ });
201
+
59
202
  // server/db/schema.ts
60
203
  var schema_exports = {};
61
204
  __export(schema_exports, {
@@ -159,7 +302,11 @@ var twoFactors = pgCore.pgTable("twoFactor", {
159
302
  id: pgCore.text("id").notNull().primaryKey().$defaultFn(() => cuid2.createId()),
160
303
  secret: pgCore.text("secret").notNull(),
161
304
  backupCodes: pgCore.text("backupCodes").notNull(),
162
- userId: pgCore.text("userId").notNull().references(() => users.id, { onDelete: "cascade" })
305
+ userId: pgCore.text("userId").notNull().references(() => users.id, { onDelete: "cascade" }),
306
+ // Added in better-auth 1.7 (TOTP lockout). Defaults match the plugin's.
307
+ verified: pgCore.boolean("verified").default(true),
308
+ failedVerificationCount: pgCore.integer("failedVerificationCount").default(0),
309
+ lockedUntil: pgCore.timestamp("lockedUntil")
163
310
  });
164
311
  var passkeys = pgCore.pgTable("passkey", {
165
312
  id: pgCore.text("id").notNull().primaryKey().$defaultFn(() => cuid2.createId()),
@@ -487,128 +634,13 @@ async function getEffectiveAuthFlags() {
487
634
  }
488
635
  var EMAIL_FROM = "Acme <onboarding@xavierkhew.xyz>";
489
636
  var resend;
490
- function getResend() {
491
- if (!resend) resend = new resend$1.Resend(config.RESEND_API_KEY);
637
+ async function getResend() {
638
+ if (!resend) {
639
+ const { Resend } = await import('resend');
640
+ resend = new Resend(config.RESEND_API_KEY);
641
+ }
492
642
  return resend;
493
643
  }
494
- function EmailTemplateResetPassword({ firstName, url }) {
495
- return /* @__PURE__ */ jsxRuntime.jsxs(components.Html, { children: [
496
- /* @__PURE__ */ jsxRuntime.jsx(components.Head, {}),
497
- /* @__PURE__ */ jsxRuntime.jsx(components.Body, { style: { backgroundColor: "#ffffff", fontFamily: "Arial, sans-serif" }, children: /* @__PURE__ */ jsxRuntime.jsx(components.Container, { style: { margin: "0 auto", padding: "20px 0 48px", maxWidth: "560px" }, children: /* @__PURE__ */ jsxRuntime.jsxs(components.Section, { style: { backgroundColor: "#f8f9fa", borderRadius: "12px", padding: "40px", textAlign: "center" }, children: [
498
- /* @__PURE__ */ jsxRuntime.jsx(components.Heading, { style: { fontSize: "28px", fontWeight: "bold", marginBottom: "12px", color: "#1a1a1a" }, children: "Reset your password" }),
499
- /* @__PURE__ */ jsxRuntime.jsxs(components.Text, { style: { fontSize: "16px", color: "#666666", marginBottom: "32px", lineHeight: "24px" }, children: [
500
- "Hi ",
501
- firstName,
502
- ", we got a request to reset your password. This link expires in an hour \u2014 if you didn't ask for this, you can safely ignore this email."
503
- ] }),
504
- /* @__PURE__ */ jsxRuntime.jsx(components.Section, { style: { marginBottom: "32px" }, children: /* @__PURE__ */ jsxRuntime.jsx(
505
- components.Button,
506
- {
507
- href: url,
508
- style: {
509
- backgroundColor: "#000000",
510
- color: "#ffffff",
511
- padding: "12px 32px",
512
- borderRadius: "6px",
513
- textDecoration: "none",
514
- fontSize: "16px",
515
- fontWeight: "bold"
516
- },
517
- children: "Reset password"
518
- }
519
- ) }),
520
- /* @__PURE__ */ jsxRuntime.jsxs(components.Text, { style: { fontSize: "13px", color: "#999999", lineHeight: "20px", wordBreak: "break-all" }, children: [
521
- "Or paste this link into your browser:",
522
- /* @__PURE__ */ jsxRuntime.jsx("br", {}),
523
- /* @__PURE__ */ jsxRuntime.jsx("a", { href: url, style: { color: "#000000", textDecoration: "underline" }, children: url })
524
- ] })
525
- ] }) }) })
526
- ] });
527
- }
528
- function EmailTemplateVerifyEmail({ firstName, url }) {
529
- return /* @__PURE__ */ jsxRuntime.jsxs(components.Html, { children: [
530
- /* @__PURE__ */ jsxRuntime.jsx(components.Head, {}),
531
- /* @__PURE__ */ jsxRuntime.jsx(components.Tailwind, { children: /* @__PURE__ */ jsxRuntime.jsx(components.Body, { className: "bg-white font-sans", children: /* @__PURE__ */ jsxRuntime.jsx(components.Container, { className: "mx-auto max-w-[560px] px-0 pt-5 pb-12", children: /* @__PURE__ */ jsxRuntime.jsxs(components.Section, { className: "rounded-xl bg-[#f8f9fa] p-10 text-center", children: [
532
- /* @__PURE__ */ jsxRuntime.jsx(components.Heading, { className: "mb-3 text-[28px] font-bold text-[#1a1a1a]", children: "Confirm your email" }),
533
- /* @__PURE__ */ jsxRuntime.jsxs(components.Text, { className: "mb-8 text-base leading-6 text-[#666666]", children: [
534
- "Hi ",
535
- firstName,
536
- ", click the button below to verify this email address. If you didn't create an account, you can safely ignore this email."
537
- ] }),
538
- /* @__PURE__ */ jsxRuntime.jsx(components.Section, { className: "mb-8", children: /* @__PURE__ */ jsxRuntime.jsx(
539
- components.Button,
540
- {
541
- href: url,
542
- className: "rounded-md bg-black px-8 py-3 text-base font-bold text-white no-underline",
543
- children: "Verify email"
544
- }
545
- ) }),
546
- /* @__PURE__ */ jsxRuntime.jsxs(components.Text, { className: "text-[13px] leading-5 break-all text-[#999999]", children: [
547
- "Or paste this link into your browser:",
548
- /* @__PURE__ */ jsxRuntime.jsx("br", {}),
549
- /* @__PURE__ */ jsxRuntime.jsx(components.Link, { href: url, className: "text-black underline", children: url })
550
- ] })
551
- ] }) }) }) })
552
- ] });
553
- }
554
- function EmailTemplatePasskeyChange({
555
- firstName,
556
- action,
557
- device,
558
- location,
559
- ipAddress,
560
- when,
561
- manageUrl
562
- }) {
563
- const verb = action === "added" ? "added to" : "removed from";
564
- return /* @__PURE__ */ jsxRuntime.jsxs(components.Html, { children: [
565
- /* @__PURE__ */ jsxRuntime.jsx(components.Head, {}),
566
- /* @__PURE__ */ jsxRuntime.jsx(components.Tailwind, { children: /* @__PURE__ */ jsxRuntime.jsx(components.Body, { className: "bg-white font-sans", children: /* @__PURE__ */ jsxRuntime.jsx(components.Container, { className: "mx-auto max-w-[560px] px-0 pt-5 pb-12", children: /* @__PURE__ */ jsxRuntime.jsxs(components.Section, { className: "rounded-xl bg-[#f8f9fa] p-10", children: [
567
- /* @__PURE__ */ jsxRuntime.jsxs(components.Heading, { className: "mb-3 text-center text-2xl font-bold text-[#1a1a1a]", children: [
568
- "A passkey was ",
569
- action
570
- ] }),
571
- /* @__PURE__ */ jsxRuntime.jsxs(components.Text, { className: "mb-6 text-base leading-6 text-[#666666]", children: [
572
- "Hi ",
573
- firstName,
574
- ", a passkey was just ",
575
- verb,
576
- " your account."
577
- ] }),
578
- /* @__PURE__ */ jsxRuntime.jsxs(components.Section, { className: "mb-6 rounded-lg bg-white p-5", children: [
579
- /* @__PURE__ */ jsxRuntime.jsxs(components.Text, { className: "m-0 mb-2 text-sm leading-5 text-[#1a1a1a]", children: [
580
- /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Device:" }),
581
- " ",
582
- device
583
- ] }),
584
- /* @__PURE__ */ jsxRuntime.jsxs(components.Text, { className: "m-0 mb-2 text-sm leading-5 text-[#1a1a1a]", children: [
585
- /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Approx. location:" }),
586
- " ",
587
- location
588
- ] }),
589
- /* @__PURE__ */ jsxRuntime.jsxs(components.Text, { className: "m-0 mb-2 text-sm leading-5 text-[#1a1a1a]", children: [
590
- /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "IP address:" }),
591
- " ",
592
- ipAddress
593
- ] }),
594
- /* @__PURE__ */ jsxRuntime.jsxs(components.Text, { className: "m-0 text-sm leading-5 text-[#1a1a1a]", children: [
595
- /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "When:" }),
596
- " ",
597
- when
598
- ] })
599
- ] }),
600
- manageUrl && /* @__PURE__ */ jsxRuntime.jsx(components.Section, { className: "mb-6 text-center", children: /* @__PURE__ */ jsxRuntime.jsx(
601
- components.Button,
602
- {
603
- href: manageUrl,
604
- className: "rounded-lg bg-[#1a1a1a] px-6 py-3 text-sm font-bold text-white no-underline",
605
- children: "Review your passkeys"
606
- }
607
- ) }),
608
- /* @__PURE__ */ jsxRuntime.jsx(components.Text, { className: "text-sm leading-[22px] text-[#666666]", children: "If this was you, no action is needed. If you don't recognize it, change your password now and review your passkeys and active sessions." })
609
- ] }) }) }) })
610
- ] });
611
- }
612
644
 
613
645
  // server/auth.ts
614
646
  async function logFailedLogin(ctx) {
@@ -645,11 +677,12 @@ async function notifyPasskeyChange(ctx, action) {
645
677
  userAgent: (_b = (_a = ctx.headers) == null ? void 0 : _a.get("user-agent")) != null ? _b : null
646
678
  });
647
679
  if (!config.RESEND_API_KEY) return;
648
- await getResend().emails.send({
680
+ const { EmailTemplatePasskeyChange: EmailTemplatePasskeyChange2 } = await Promise.resolve().then(() => (init_email_template_passkey_change(), email_template_passkey_change_exports));
681
+ await (await getResend()).emails.send({
649
682
  from: EMAIL_FROM,
650
683
  to: [user.email],
651
684
  subject: action === "added" ? "A passkey was added to your account" : "A passkey was removed from your account",
652
- react: EmailTemplatePasskeyChange({
685
+ react: EmailTemplatePasskeyChange2({
653
686
  firstName: user.name || "there",
654
687
  action,
655
688
  device: formatDeviceInfo(parseUserAgent((_d = (_c = ctx.headers) == null ? void 0 : _c.get("user-agent")) != null ? _d : null)),
@@ -708,22 +741,16 @@ function createAuth(overrides = {}) {
708
741
  emailAndPassword: {
709
742
  enabled: emailAndPasswordEnabled,
710
743
  requireEmailVerification: false,
711
- // Use bcrypt to maintain compatibility with existing user passwords
712
- async hash(password) {
713
- return await bcrypt__default.default.hash(password, 10);
714
- },
715
- async verify({ hash, password }) {
716
- return await bcrypt__default.default.compare(password, hash);
717
- },
718
744
  // `url` is fully composed by better-auth (baseURL + verification token +
719
745
  // callbackURL) — see app/(auth)/forgot-password and reset-password for
720
746
  // the pages this points at.
721
747
  async sendResetPassword({ user, url }) {
722
- await getResend().emails.send({
748
+ const { EmailTemplateResetPassword: EmailTemplateResetPassword2 } = await Promise.resolve().then(() => (init_email_template_reset_password(), email_template_reset_password_exports));
749
+ await (await getResend()).emails.send({
723
750
  from: EMAIL_FROM,
724
751
  to: [user.email],
725
752
  subject: "Reset your password",
726
- react: EmailTemplateResetPassword({ firstName: user.name || "there", url })
753
+ react: EmailTemplateResetPassword2({ firstName: user.name || "there", url })
727
754
  });
728
755
  }
729
756
  },
@@ -735,11 +762,12 @@ function createAuth(overrides = {}) {
735
762
  emailVerification: {
736
763
  autoSignInAfterVerification: true,
737
764
  async sendVerificationEmail({ user, url }) {
738
- await getResend().emails.send({
765
+ const { EmailTemplateVerifyEmail: EmailTemplateVerifyEmail2 } = await Promise.resolve().then(() => (init_email_template_verify_email(), email_template_verify_email_exports));
766
+ await (await getResend()).emails.send({
739
767
  from: EMAIL_FROM,
740
768
  to: [user.email],
741
769
  subject: "Confirm your email",
742
- react: EmailTemplateVerifyEmail({ firstName: user.name || "there", url })
770
+ react: EmailTemplateVerifyEmail2({ firstName: user.name || "there", url })
743
771
  });
744
772
  }
745
773
  },
@@ -760,7 +788,9 @@ function createAuth(overrides = {}) {
760
788
  },
761
789
  // Advanced options
762
790
  advanced: {
763
- generateId: () => __require("@paralleldrive/cuid2").createId()
791
+ database: {
792
+ generateId: () => cuid2.createId()
793
+ }
764
794
  },
765
795
  // Every new session row corresponds to a sign-in (credential or OAuth) —
766
796
  // use that as the "last logged in" signal rather than session updates,
@@ -922,8 +952,6 @@ function createAuth(overrides = {}) {
922
952
  errorURL: "/login"
923
953
  },
924
954
  plugins: [
925
- // checks to see if oneTap is enabled and if google provider is available, then add the oneTap plugin
926
- ...config.AUTH_ENABLE_ONE_TAP && Boolean(socialProviders.google) ? [plugins.oneTap()] : [],
927
955
  // Registered for impersonation (auth.api.impersonateUser / stopImpersonating)
928
956
  // only — role/ban/delete stay on our own custom routes above. adminRoles
929
957
  // matches our existing role column so the plugin's own permission checks
@@ -949,7 +977,11 @@ function createAuth(overrides = {}) {
949
977
  rpID: new URL(baseURL).hostname,
950
978
  rpName: config.APP_NAME,
951
979
  origin: baseURL
952
- })
980
+ }),
981
+ // checks to see if oneTap is enabled and if google provider is available, then add the oneTap plugin.
982
+ // Keep this spread last: a leading spread turns `plugins` from a tuple into a plain
983
+ // array and better-auth 1.7 then drops plugin fields (e.g. session.impersonatedBy).
984
+ ...config.AUTH_ENABLE_ONE_TAP && Boolean(socialProviders.google) ? [plugins.oneTap()] : []
953
985
  ]
954
986
  });
955
987
  }