@strapi/plugin-users-permissions 4.1.5 → 4.1.6-alpha.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/plugin-users-permissions",
3
- "version": "4.1.5",
3
+ "version": "4.1.6-alpha.0",
4
4
  "description": "Protect your API with a full-authentication process based on JWT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -28,8 +28,8 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@purest/providers": "^1.0.2",
31
- "@strapi/helper-plugin": "4.1.5",
32
- "@strapi/utils": "4.1.5",
31
+ "@strapi/helper-plugin": "4.1.6-alpha.0",
32
+ "@strapi/utils": "4.1.6-alpha.0",
33
33
  "bcryptjs": "2.4.3",
34
34
  "grant-koa": "5.4.8",
35
35
  "jsonwebtoken": "^8.1.0",
@@ -61,5 +61,5 @@
61
61
  "required": true,
62
62
  "kind": "plugin"
63
63
  },
64
- "gitHead": "f1859f03756a5feb888583dba85bcec7745ce21f"
64
+ "gitHead": "c52f42c80df62e95876235db368f84a7eda09c97"
65
65
  }
@@ -17,7 +17,7 @@ const {
17
17
  validateSendEmailConfirmationBody,
18
18
  } = require('./validation/auth');
19
19
 
20
- const { sanitize } = utils;
20
+ const { getAbsoluteAdminUrl, getAbsoluteServerUrl, sanitize } = utils;
21
21
  const { ApplicationError, ValidationError } = utils.errors;
22
22
 
23
23
  const emailRegExp = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
@@ -243,6 +243,8 @@ module.exports = {
243
243
 
244
244
  settings.message = await getService('users-permissions').template(settings.message, {
245
245
  URL: advanced.email_reset_password,
246
+ SERVER_URL: getAbsoluteServerUrl(strapi.config),
247
+ ADMIN_URL: getAbsoluteAdminUrl(strapi.config),
246
248
  USER: userInfo,
247
249
  TOKEN: resetPasswordToken,
248
250
  });
@@ -3,7 +3,16 @@
3
3
  const _ = require('lodash');
4
4
 
5
5
  const invalidPatternsRegexes = [/<%[^=]([^<>%]*)%>/m, /\${([^{}]*)}/m];
6
- const authorizedKeys = ['URL', 'CODE', 'USER', 'USER.email', 'USER.username', 'TOKEN'];
6
+ const authorizedKeys = [
7
+ 'URL',
8
+ 'ADMIN_URL',
9
+ 'SERVER_URL',
10
+ 'CODE',
11
+ 'USER',
12
+ 'USER.email',
13
+ 'USER.username',
14
+ 'TOKEN',
15
+ ];
7
16
 
8
17
  const matchAll = (pattern, src) => {
9
18
  const matches = [];
@@ -10,7 +10,7 @@ const crypto = require('crypto');
10
10
  const bcrypt = require('bcryptjs');
11
11
  const urlJoin = require('url-join');
12
12
 
13
- const { getAbsoluteServerUrl, sanitize } = require('@strapi/utils');
13
+ const { getAbsoluteAdminUrl, getAbsoluteServerUrl, sanitize } = require('@strapi/utils');
14
14
  const { getService } = require('../utils');
15
15
 
16
16
  module.exports = ({ strapi }) => ({
@@ -118,6 +118,8 @@ module.exports = ({ strapi }) => ({
118
118
  const apiPrefix = strapi.config.get('api.rest.prefix');
119
119
  settings.message = await userPermissionService.template(settings.message, {
120
120
  URL: urlJoin(getAbsoluteServerUrl(strapi.config), apiPrefix, '/auth/email-confirmation'),
121
+ SERVER_URL: getAbsoluteServerUrl(strapi.config),
122
+ ADMIN_URL: getAbsoluteAdminUrl(strapi.config),
121
123
  USER: sanitizedUserInfo,
122
124
  CODE: confirmationToken,
123
125
  });