@adminforth/open-signup 1.3.0 → 1.3.1
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/index.js +5 -9
- package/index.ts +5 -7
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import AdminForth, { AdminForthPlugin,
|
|
10
|
+
import AdminForth, { AdminForthPlugin, Filters, suggestIfTypo, AdminForthDataTypes } from "adminforth";
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
const completeVerifiedSignupBodySchema = z.object({
|
|
13
13
|
token: z.string(),
|
|
@@ -159,11 +159,9 @@ export default class OpenSignupPlugin extends AdminForthPlugin {
|
|
|
159
159
|
method: 'POST',
|
|
160
160
|
path: `/plugin/${this.pluginInstanceId}/complete-verified-signup`,
|
|
161
161
|
noAuth: true,
|
|
162
|
+
request_schema: completeVerifiedSignupBodySchema,
|
|
162
163
|
handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, response, headers, query, cookies, tr, requestUrl }) {
|
|
163
|
-
const
|
|
164
|
-
if ('error' in parsed)
|
|
165
|
-
return parsed.error;
|
|
166
|
-
const data = parsed.data;
|
|
164
|
+
const data = body;
|
|
167
165
|
const { token, password } = data;
|
|
168
166
|
if (!token) {
|
|
169
167
|
return { error: yield tr('Invalid token', 'opensignup'), ok: false };
|
|
@@ -194,12 +192,10 @@ export default class OpenSignupPlugin extends AdminForthPlugin {
|
|
|
194
192
|
method: 'POST',
|
|
195
193
|
path: `/plugin/${this.pluginInstanceId}/signup`,
|
|
196
194
|
noAuth: true,
|
|
195
|
+
request_schema: signupBodySchema,
|
|
197
196
|
handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, response, headers, query, cookies, tr, requestUrl }) {
|
|
198
197
|
var _b, _c;
|
|
199
|
-
const
|
|
200
|
-
if ('error' in parsed)
|
|
201
|
-
return parsed.error;
|
|
202
|
-
const data = parsed.data;
|
|
198
|
+
const data = body;
|
|
203
199
|
const { email, url, password } = data;
|
|
204
200
|
if (!email || typeof email !== 'string') {
|
|
205
201
|
return { error: yield tr('Email is required', 'opensignup'), ok: false };
|
package/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import AdminForth, { AdminForthPlugin,
|
|
1
|
+
import AdminForth, { AdminForthPlugin, Filters, suggestIfTypo, AdminForthDataTypes } from "adminforth";
|
|
2
2
|
import type { IAdminForth, IHttpServer, AdminForthComponentDeclaration, AdminForthResourceColumn, AdminForthResource, BeforeLoginConfirmationFunction, HttpExtra } from "adminforth";
|
|
3
3
|
import type { PluginOptions } from './types.js';
|
|
4
4
|
import { z } from "zod";
|
|
@@ -185,10 +185,9 @@ export default class OpenSignupPlugin extends AdminForthPlugin {
|
|
|
185
185
|
method: 'POST',
|
|
186
186
|
path: `/plugin/${this.pluginInstanceId}/complete-verified-signup`,
|
|
187
187
|
noAuth: true,
|
|
188
|
+
request_schema: completeVerifiedSignupBodySchema,
|
|
188
189
|
handler: async ({ body, response, headers, query, cookies, tr, requestUrl }) => {
|
|
189
|
-
const
|
|
190
|
-
if ('error' in parsed) return parsed.error;
|
|
191
|
-
const data = parsed.data;
|
|
190
|
+
const data = body as z.infer<typeof completeVerifiedSignupBodySchema>;
|
|
192
191
|
const { token, password } = data;
|
|
193
192
|
if (!token) {
|
|
194
193
|
return { error: await tr('Invalid token', 'opensignup'), ok: false };
|
|
@@ -223,10 +222,9 @@ export default class OpenSignupPlugin extends AdminForthPlugin {
|
|
|
223
222
|
method: 'POST',
|
|
224
223
|
path: `/plugin/${this.pluginInstanceId}/signup`,
|
|
225
224
|
noAuth: true,
|
|
225
|
+
request_schema: signupBodySchema,
|
|
226
226
|
handler: async ({ body, response, headers, query, cookies, tr, requestUrl }) => {
|
|
227
|
-
const
|
|
228
|
-
if ('error' in parsed) return parsed.error;
|
|
229
|
-
const data = parsed.data;
|
|
227
|
+
const data = body as z.infer<typeof signupBodySchema>;
|
|
230
228
|
const { email, url, password } = data;
|
|
231
229
|
if (!email || typeof email !== 'string') {
|
|
232
230
|
return { error: await tr('Email is required', 'opensignup'), ok: false };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adminforth/open-signup",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"zod": "^4.3.6"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"adminforth": "^3.
|
|
30
|
+
"adminforth": "^3.8.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "^22.10.7",
|
|
34
|
-
"adminforth": "^3.
|
|
34
|
+
"adminforth": "^3.8.2",
|
|
35
35
|
"semantic-release": "^24.2.1",
|
|
36
36
|
"semantic-release-slack-bot": "^4.0.2",
|
|
37
37
|
"typescript": "^5.7.3"
|