@getstrata/starter 2.2.31 → 2.2.32
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/cli.js +20 -15
- package/dist/templates/package.json +3 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1373,6 +1373,21 @@ async function revokeUserSessions(userId: number) {
|
|
|
1373
1373
|
});
|
|
1374
1374
|
}
|
|
1375
1375
|
|
|
1376
|
+
${verify ? `
|
|
1377
|
+
async function completeSignedEmailVerification(request: Request): Promise<boolean> {
|
|
1378
|
+
return await runInTransaction(async () => {
|
|
1379
|
+
const userId = await consumeSignedAuthToken(request, AUTH_ONE_TIME_PURPOSES.emailVerify);
|
|
1380
|
+
if (!userId) return false;
|
|
1381
|
+
await runAuthWrite(userId, async () => {
|
|
1382
|
+
const user = await User.find(userId);
|
|
1383
|
+
if (!user) throw new Error("Verification account no longer exists.");
|
|
1384
|
+
await user.update({ email_verified_at: ${nowTimestampLiteral(layers.database)} });
|
|
1385
|
+
});
|
|
1386
|
+
return true;
|
|
1387
|
+
});
|
|
1388
|
+
}
|
|
1389
|
+
` : ""}
|
|
1390
|
+
|
|
1376
1391
|
async function completeSignedPasswordReset(request: Request, password: unknown): Promise<boolean> {
|
|
1377
1392
|
if (typeof password !== "string" || password.length < 8) return false;
|
|
1378
1393
|
return await runInTransaction(async () => {
|
|
@@ -1592,14 +1607,9 @@ async function completeBrowserSsoLogin(
|
|
|
1592
1607
|
const jsonVerify = jsonApi && verify ? `
|
|
1593
1608
|
"/api/v1/auth/verify-email": {
|
|
1594
1609
|
POST: kernel.wrap("api", kernel.wrapSigned(withErrorHandling(async (request) => {
|
|
1595
|
-
|
|
1596
|
-
if (!id) {
|
|
1610
|
+
if (!(await completeSignedEmailVerification(request))) {
|
|
1597
1611
|
return jsonResponse({ error: "Invalid or expired verification link." }, { status: 403 });
|
|
1598
1612
|
}
|
|
1599
|
-
await runAuthWrite(id, async () => {
|
|
1600
|
-
const user = await User.find(id);
|
|
1601
|
-
await user?.update({ email_verified_at: ${nowTimestampLiteral(layers.database)} });
|
|
1602
|
-
});
|
|
1603
1613
|
return jsonResponse({ ok: true });
|
|
1604
1614
|
}))),
|
|
1605
1615
|
},` : "";
|
|
@@ -1911,12 +1921,7 @@ async function completeBrowserSsoLogin(
|
|
|
1911
1921
|
const url = new URL(request.url);
|
|
1912
1922
|
if (url.searchParams.get("signature")) {
|
|
1913
1923
|
assertValidSignature(request);
|
|
1914
|
-
|
|
1915
|
-
if (id) {
|
|
1916
|
-
await runAuthWrite(id, async () => {
|
|
1917
|
-
const user = await User.find(id);
|
|
1918
|
-
await user?.update({ email_verified_at: ${nowTimestampLiteral(layers.database)} });
|
|
1919
|
-
});
|
|
1924
|
+
if (await completeSignedEmailVerification(request)) {
|
|
1920
1925
|
return flashResponse(
|
|
1921
1926
|
redirectTo("/login"),
|
|
1922
1927
|
{ level: "success", message: "Email verified. Sign in." },
|
|
@@ -3158,9 +3163,9 @@ function renderPackageJson(projectName, options = {}) {
|
|
|
3158
3163
|
"@getstrata/cli": "workspace:*",
|
|
3159
3164
|
"@getstrata/core": "workspace:*"
|
|
3160
3165
|
} : {
|
|
3161
|
-
"@getstrata/bootstrap": "^2.2.
|
|
3162
|
-
"@getstrata/cli": "^2.2.
|
|
3163
|
-
"@getstrata/core": "^2.2.
|
|
3166
|
+
"@getstrata/bootstrap": "^2.2.32",
|
|
3167
|
+
"@getstrata/cli": "^2.2.32",
|
|
3168
|
+
"@getstrata/core": "^2.2.32"
|
|
3164
3169
|
};
|
|
3165
3170
|
coreDeps.eta = "^4.6.0";
|
|
3166
3171
|
if (options.layers?.database === "mysql") {
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"check": "tsc --noEmit"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@getstrata/bootstrap": "^2.2.
|
|
16
|
-
"@getstrata/cli": "^2.2.
|
|
17
|
-
"@getstrata/core": "^2.2.
|
|
15
|
+
"@getstrata/bootstrap": "^2.2.32",
|
|
16
|
+
"@getstrata/cli": "^2.2.32",
|
|
17
|
+
"@getstrata/core": "^2.2.32",
|
|
18
18
|
"eta": "^4.6.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|