@strapi/plugin-users-permissions 4.0.2 → 4.0.6

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.
@@ -28,12 +28,12 @@ const Input = ({
28
28
 
29
29
  const label = formatMessage(
30
30
  { id: intlLabel.id, defaultMessage: intlLabel.defaultMessage },
31
- { ...intlLabel.values }
31
+ { provider: providerToEditName, ...intlLabel.values }
32
32
  );
33
33
  const hint = description
34
34
  ? formatMessage(
35
35
  { id: description.id, defaultMessage: description.defaultMessage },
36
- { ...description.values }
36
+ { provider: providerToEditName, ...description.values }
37
37
  )
38
38
  : '';
39
39
 
@@ -23,9 +23,6 @@ const keyLabel = { id: getTrad('PopUpForm.Providers.key.label'), defaultMessage:
23
23
  const hintLabel = {
24
24
  id: getTrad('PopUpForm.Providers.redirectURL.label'),
25
25
  defaultMessage: 'The redirect URL to add in your {provider} application configurations',
26
- values: {
27
- provider: 'VK',
28
- },
29
26
  };
30
27
  const textPlaceholder = {
31
28
  id: getTrad('PopUpForm.Providers.key.placeholder'),
@@ -44,5 +44,51 @@
44
44
  "notification.success.submit": "Indstillingerne er blevet opdateret",
45
45
  "plugin.description.long": "Beskyt din API med fuld godkendelse med JWT. Dette plugin kommer også med en ACL strategi som tillader dig at håndtere rettigeheder mellem grupper af brugere.",
46
46
  "plugin.description.short": "Beskyt din API med fuld godkendelse med JWT",
47
- "plugin.name": "Roller & rettigheder"
47
+ "plugin.name": "Roller & rettigheder",
48
+ "EditForm.inputToggle.placeholder.email-confirmation-redirection": "f.eks. https://hjemmeside.dk/nulstil-kodeord",
49
+ "EditForm.inputToggle.placeholder.email-reset-password": "f.eks. https://hjemmeside.dk/nulstil-kodeord",
50
+ "EditPage.form.roles": "Rolle detaljer",
51
+ "Email.template.data.loaded": "E-mail skabeloner er hentet",
52
+ "Email.template.form.edit.label": "Redigér en skabelon",
53
+ "Email.template.table.action.label": "handling",
54
+ "Email.template.table.icon.label": "ikon",
55
+ "Email.template.table.name.label": "navn",
56
+ "Form.advancedSettings.data.loaded": "Avancerede indstillinger hentet",
57
+ "Form.save": "Gem",
58
+ "Form.title.advancedSettings": "Indstillinger",
59
+ "PopUpForm.Email.options.object.placeholder": "Bekræft venligst din e-mail adresse for %APP_NAME%",
60
+ "PopUpForm.Providers.redirectURL.front-end.label": "Omstillings URL til din font-end app",
61
+ "PopUpForm.Providers.redirectURL.label": "Omstillings URL som tilføjes til din {provider} applikation konfigurationer",
62
+ "PopUpForm.Providers.subdomain.label": "Host URI (Subdomain)",
63
+ "PopUpForm.Providers.subdomain.placeholder": "mit.subdomain.dk",
64
+ "Providers.data.loaded": "Providers hentet",
65
+ "Providers.disabled": "Deaktiveret",
66
+ "Providers.enabled": "Aktiveret",
67
+ "Providers.image": "Billede",
68
+ "Providers.name": "Navn",
69
+ "Providers.settings": "Indstillinger",
70
+ "Providers.status": "Status",
71
+ "Roles.description": "Beskrivelse",
72
+ "Roles.empty": "Du har endnu ingen roller.",
73
+ "Roles.empty.search": "Ingen roller matcher søgningen.",
74
+ "Roles.name": "Navn",
75
+ "Roles.users": "Brugere",
76
+ "Settings.roles.deleted": "Rolle slettet",
77
+ "Settings.roles.edited": "Rolle redigeret",
78
+ "Settings.section-label": "Brugere & Tilladelser plugin",
79
+ "components.Input.error.validation.email": "Dette er en ugyldig e.mail",
80
+ "components.Input.error.validation.json": "Dette stemmer ikke med JSON formatet",
81
+ "components.Input.error.validation.max": "Værdien er for høj.",
82
+ "components.Input.error.validation.maxLength": "Værdien er for lang.",
83
+ "components.Input.error.validation.min": "Værdien er for lav.",
84
+ "components.Input.error.validation.minLength": "Værdien er for kort.",
85
+ "components.Input.error.validation.minSupMax": "Kan ikke være overlegen",
86
+ "components.Input.error.validation.regex": "Værdien stemmer ikke overens med regex.",
87
+ "components.Input.error.validation.required": "Værdien er påkrævet.",
88
+ "components.Input.error.validation.unique": "Værdien er allerede brugt.",
89
+ "page.title": "Indstillinger - Roller",
90
+ "popUpWarning.button.cancel": "Annuller",
91
+ "popUpWarning.button.confirm": "Bekræft",
92
+ "popUpWarning.title": "Bekræft venligst",
93
+ "popUpWarning.warning.cancel": "Er du sikker på at du vil annullere dine ændringer?"
48
94
  }
@@ -12,8 +12,19 @@
12
12
  "EditForm.inputToggle.label.email-confirmation-redirection": "URL de redirección",
13
13
  "EditForm.inputToggle.label.email-reset-password": "Página de reestablecer la contraseña",
14
14
  "EditForm.inputToggle.label.sign-up": "Habilitar inscripciones",
15
+ "EditForm.inputToggle.placeholder.email-confirmation-redirection": "ej: https://tufrontend.com/restablecer-contrasena",
16
+ "EditForm.inputToggle.placeholder.email-reset-password": "ej: https://tufrontend.com/restablecer-contrasena",
17
+ "EditPage.form.roles": "Detalles del rol",
18
+ "Email.template.data.loaded": "Se han cargado las plantillas de correo electrónico",
15
19
  "Email.template.email_confirmation": "Confirmación de dirección de correo electrónico",
20
+ "Email.template.form.edit.label": "Editar una plantilla",
16
21
  "Email.template.reset_password": "Restablecer la contraseña",
22
+ "Email.template.table.action.label": "acción",
23
+ "Email.template.table.icon.label": "icono",
24
+ "Email.template.table.name.label": "nombre",
25
+ "Form.advancedSettings.data.loaded": "Se han cargado los datos de configuración avanzada",
26
+ "Form.save": "Guardar",
27
+ "Form.title.advancedSettings": "Ajustes",
17
28
  "HeaderNav.link.advancedSettings": "Ajustes avanzados",
18
29
  "HeaderNav.link.emailTemplates": "Plantillas de email",
19
30
  "HeaderNav.link.providers": "Proveedores",
@@ -42,14 +53,37 @@
42
53
  "PopUpForm.Providers.redirectURL.label": "La URL de redireccionamiento para agregar en las configuraciones de su aplicación de {proveedor}",
43
54
  "PopUpForm.Providers.secret.label": "Secreto Cliente",
44
55
  "PopUpForm.Providers.secret.placeholder": "TEXTO",
45
- "PopUpForm.Providers.subdomain.label": "Host URI (Subdomain)",
46
- "PopUpForm.Providers.subdomain.placeholder": "my.subdomain.com",
56
+ "PopUpForm.Providers.subdomain.label": "URI de host (subdominio)",
57
+ "PopUpForm.Providers.subdomain.placeholder": "mi.subdominio.com",
47
58
  "PopUpForm.header.edit.email-templates": "Editar Plantillas de Email",
48
59
  "PopUpForm.header.edit.providers": "Editar proveedor",
60
+ "Providers.data.loaded": "Los proveedores se han cargado",
61
+ "Providers.disabled": "Deshabilitado",
62
+ "Providers.enabled": "Habilitado",
63
+ "Providers.image": "Imagen",
64
+ "Providers.name": "Nombre",
65
+ "Providers.settings": "Ajustes",
66
+ "Providers.status": "Estado",
67
+ "Roles.description": "Descripción",
68
+ "Roles.empty": "Aún no tienes ningún rol.",
69
+ "Roles.empty.search": "Ningún rol coincide con la búsqueda.",
70
+ "Roles.name": "Nombre",
71
+ "Roles.users": "Usuarios",
49
72
  "Settings.roles.deleted": "Rol eliminado",
50
73
  "Settings.roles.edited": "Rol editado",
51
74
  "Settings.section-label": "Plugin de Usuarios y Permisos",
75
+ "components.Input.error.validation.email": "El correo electrónico inválido",
76
+ "components.Input.error.validation.json": "No coincide con el formato JSON",
77
+ "components.Input.error.validation.max": "El valor es demasiado alto.",
78
+ "components.Input.error.validation.maxLength": "El valor es demasiado largo.",
79
+ "components.Input.error.validation.min": "El valor es demasiado bajo.",
80
+ "components.Input.error.validation.minLength": "El valor es demasiado corto.",
81
+ "components.Input.error.validation.minSupMax": "No puede ser superior",
82
+ "components.Input.error.validation.regex": "El valor no coincide con la expresión regular.",
83
+ "components.Input.error.validation.required": "Este valor es obligatorio.",
84
+ "components.Input.error.validation.unique": "Este valor ya se utiliza.",
52
85
  "notification.success.submit": "Los ajustes se han actualizado",
86
+ "page.title": "Configuración - Roles",
53
87
  "plugin.description.long": "Proteja su API con un proceso de autenticación completo basado en JWT. Este plugin viene también con una estrategia ACL que le permite administrar los permisos entre los grupos de usuarios.",
54
88
  "plugin.description.short": "Proteja su API con un proceso de autenticación completo basado en JWT",
55
89
  "plugin.name": "Roles y Permisos",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/plugin-users-permissions",
3
- "version": "4.0.2",
3
+ "version": "4.0.6",
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.0.2",
32
- "@strapi/utils": "4.0.2",
31
+ "@strapi/helper-plugin": "4.0.6",
32
+ "@strapi/utils": "4.0.6",
33
33
  "bcryptjs": "2.4.3",
34
34
  "grant-koa": "5.4.8",
35
35
  "jsonwebtoken": "^8.1.0",
@@ -51,7 +51,7 @@
51
51
  "koa": "^2.13.1"
52
52
  },
53
53
  "engines": {
54
- "node": ">=12.x.x <=16.x.x",
54
+ "node": ">=12.22.0 <=16.x.x",
55
55
  "npm": ">=6.0.0"
56
56
  },
57
57
  "strapi": {
@@ -61,5 +61,5 @@
61
61
  "required": true,
62
62
  "kind": "plugin"
63
63
  },
64
- "gitHead": "fd656a47698e0a33aae42abd4330410c8cba1d08"
64
+ "gitHead": "5b48053946aacfb564ff423342fe70d79cd6d66d"
65
65
  }
@@ -31,7 +31,10 @@ module.exports = async ({ strapi }) => {
31
31
  strapi.config.set('plugin.users-permissions.jwtSecret', jwtSecret);
32
32
 
33
33
  if (!process.env.JWT_SECRET) {
34
- strapi.fs.appendFile('.env', `JWT_SECRET=${jwtSecret}\n`);
34
+ strapi.fs.appendFile(process.env.ENV_PATH || '.env', `JWT_SECRET=${jwtSecret}\n`);
35
+ strapi.log.info(
36
+ 'The Users & Permissions plugin automatically generated a jwt secret and stored it in your .env file under the name JWT_SECRET.'
37
+ );
35
38
  }
36
39
  }
37
40
  };
@@ -188,7 +188,10 @@ module.exports = {
188
188
  }
189
189
 
190
190
  // Ability to pass OAuth callback dynamically
191
- grantConfig[provider].callback = _.get(ctx, 'query.callback') || grantConfig[provider].callback;
191
+ grantConfig[provider].callback =
192
+ _.get(ctx, 'query.callback') ||
193
+ _.get(ctx, 'session.grant.dynamic.callback') ||
194
+ grantConfig[provider].callback;
192
195
  grantConfig[provider].redirect_uri = getService('providers').buildRedirectUri(provider);
193
196
 
194
197
  return grant(grantConfig)(ctx, next);
@@ -386,7 +389,7 @@ module.exports = {
386
389
  throw new ValidationError('token.invalid');
387
390
  }
388
391
 
389
- await userService.edit({ id: user.id }, { confirmed: true, confirmationToken: null });
392
+ await userService.edit(user.id, { confirmed: true, confirmationToken: null });
390
393
 
391
394
  if (returnUser) {
392
395
  ctx.send({
@@ -123,7 +123,7 @@ module.exports = {
123
123
  ...ctx.request.body,
124
124
  };
125
125
 
126
- const data = await getService('user').edit({ id }, updateData);
126
+ const data = await getService('user').edit(user.id, updateData);
127
127
  const sanitizedData = await sanitizeOutput(data, ctx);
128
128
 
129
129
  ctx.send(sanitizedData);
@@ -21,8 +21,6 @@ module.exports = ({ strapi }) => ({
21
21
  }
22
22
 
23
23
  token = parts[1];
24
- } else if (ctx.query.access_token) {
25
- token = ctx.query.access_token;
26
24
  } else {
27
25
  return null;
28
26
  }
@@ -8,6 +8,7 @@
8
8
 
9
9
  const crypto = require('crypto');
10
10
  const bcrypt = require('bcryptjs');
11
+ const urlJoin = require('url-join');
11
12
 
12
13
  const { getAbsoluteServerUrl, sanitize } = require('@strapi/utils');
13
14
  const { getService } = require('../utils');
@@ -45,16 +46,19 @@ module.exports = ({ strapi }) => ({
45
46
 
46
47
  /**
47
48
  * Promise to edit a/an user.
49
+ * @param {string} userId
50
+ * @param {object} params
48
51
  * @return {Promise}
49
52
  */
50
- async edit(params, values) {
51
- if (values.password) {
52
- values.password = await getService('user').hashPassword(values);
53
+ async edit(userId, params = {}) {
54
+ if (params.password) {
55
+ params.password = await getService('user').hashPassword(params);
53
56
  }
54
57
 
55
- return strapi
56
- .query('plugin::users-permissions.user')
57
- .update({ where: params, data: values, populate: ['role'] });
58
+ return strapi.entityService.update('plugin::users-permissions.user', userId, {
59
+ data: params,
60
+ populate: ['role'],
61
+ });
58
62
  },
59
63
 
60
64
  /**
@@ -132,10 +136,11 @@ module.exports = ({ strapi }) => ({
132
136
 
133
137
  const confirmationToken = crypto.randomBytes(20).toString('hex');
134
138
 
135
- await this.edit({ id: user.id }, { confirmationToken });
139
+ await this.edit(user.id, { confirmationToken });
136
140
 
141
+ const apiPrefix = strapi.config.get('api.rest.prefix');
137
142
  settings.message = await userPermissionService.template(settings.message, {
138
- URL: `${getAbsoluteServerUrl(strapi.config)}/auth/email-confirmation`,
143
+ URL: urlJoin(getAbsoluteServerUrl(strapi.config), apiPrefix, '/auth/email-confirmation'),
139
144
  USER: sanitizedUserInfo,
140
145
  CODE: confirmationToken,
141
146
  });
@@ -2,6 +2,7 @@
2
2
 
3
3
  const _ = require('lodash');
4
4
  const { filter, map, pipe, prop } = require('lodash/fp');
5
+ const urlJoin = require('url-join');
5
6
 
6
7
  const { getService } = require('../utils');
7
8
 
@@ -112,9 +113,10 @@ module.exports = ({ strapi }) => ({
112
113
  return;
113
114
  }
114
115
 
116
+ const apiPrefix = strapi.config.get('api.rest.prefix');
115
117
  routesMap[`api::${apiName}`] = routes.map(route => ({
116
118
  ...route,
117
- path: `/api${route.path}`,
119
+ path: urlJoin(apiPrefix, route.path),
118
120
  }));
119
121
  });
120
122
 
@@ -133,9 +135,10 @@ module.exports = ({ strapi }) => ({
133
135
  return;
134
136
  }
135
137
 
138
+ const apiPrefix = strapi.config.get('api.rest.prefix');
136
139
  routesMap[`plugin::${pluginName}`] = routes.map(route => ({
137
140
  ...route,
138
- path: `/api${route.path}`,
141
+ path: urlJoin(apiPrefix, route.path),
139
142
  }));
140
143
  });
141
144