@adminforth/open-signup 1.2.24 → 1.2.26

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 (3) hide show
  1. package/dist/index.js +12 -2
  2. package/index.ts +12 -2
  3. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -142,10 +142,14 @@ export default class OpenSignupPlugin extends AdminForthPlugin {
142
142
  noAuth: true,
143
143
  handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, response, headers, query, cookies, tr, requestUrl }) {
144
144
  const { token, password } = body;
145
- const { email } = yield this.adminforth.auth.verify(token, 'tempVerifyEmailToken', false);
146
- if (!email) {
145
+ if (!token) {
147
146
  return { error: yield tr('Invalid token', 'opensignup'), ok: false };
148
147
  }
148
+ const decoded = yield this.adminforth.auth.verify(token, 'tempVerifyEmailToken', false);
149
+ if (!decoded || !decoded.email) {
150
+ return { error: yield tr('Invalid token', 'opensignup'), ok: false };
151
+ }
152
+ const { email } = decoded;
149
153
  if (!password) {
150
154
  return { error: yield tr('Password is required', 'opensignup'), ok: false };
151
155
  }
@@ -170,6 +174,12 @@ export default class OpenSignupPlugin extends AdminForthPlugin {
170
174
  handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, response, headers, query, cookies, tr, requestUrl }) {
171
175
  var _b, _c;
172
176
  const { email, url, password } = body;
177
+ if (!email || typeof email !== 'string') {
178
+ return { error: yield tr('Email is required', 'opensignup'), ok: false };
179
+ }
180
+ if (!this.options.confirmEmails && !password) {
181
+ return { error: yield tr('Password is required', 'opensignup'), ok: false };
182
+ }
173
183
  const extra = { body, headers, query, cookies, requestUrl: url };
174
184
  // validate email
175
185
  if (this.emailField.validation) {
package/index.ts CHANGED
@@ -165,10 +165,14 @@ export default class OpenSignupPlugin extends AdminForthPlugin {
165
165
  noAuth: true,
166
166
  handler: async ({ body, response, headers, query, cookies, tr, requestUrl }) => {
167
167
  const { token, password } = body;
168
- const { email } = await this.adminforth.auth.verify(token, 'tempVerifyEmailToken', false);
169
- if (!email) {
168
+ if (!token) {
170
169
  return { error: await tr('Invalid token', 'opensignup'), ok: false };
171
170
  }
171
+ const decoded = await this.adminforth.auth.verify(token, 'tempVerifyEmailToken', false);
172
+ if (!decoded || !decoded.email) {
173
+ return { error: await tr('Invalid token', 'opensignup'), ok: false };
174
+ }
175
+ const { email } = decoded;
172
176
 
173
177
  if(!password) {
174
178
  return { error: await tr('Password is required', 'opensignup'), ok: false };
@@ -196,6 +200,12 @@ export default class OpenSignupPlugin extends AdminForthPlugin {
196
200
  noAuth: true,
197
201
  handler: async ({ body, response, headers, query, cookies, tr, requestUrl }) => {
198
202
  const { email, url, password } = body;
203
+ if (!email || typeof email !== 'string') {
204
+ return { error: await tr('Email is required', 'opensignup'), ok: false };
205
+ }
206
+ if (!this.options.confirmEmails && !password) {
207
+ return { error: await tr('Password is required', 'opensignup'), ok: false };
208
+ }
199
209
  const extra = { body, headers, query, cookies, requestUrl: url };
200
210
  // validate email
201
211
  if (this.emailField.validation) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/open-signup",
3
- "version": "1.2.24",
3
+ "version": "1.2.26",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -26,11 +26,11 @@
26
26
  "@aws-sdk/client-ses": "^3.654.0"
27
27
  },
28
28
  "peerDependencies": {
29
- "adminforth": "^3.6.2"
29
+ "adminforth": "^3.6.21"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/node": "^22.10.7",
33
- "adminforth": "^3.6.2",
33
+ "adminforth": "^3.6.21",
34
34
  "semantic-release": "^24.2.1",
35
35
  "semantic-release-slack-bot": "^4.0.2",
36
36
  "typescript": "^5.7.3"