@strapi/plugin-users-permissions 4.0.2 → 4.0.3
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.0.
|
|
3
|
+
"version": "4.0.3",
|
|
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.
|
|
32
|
-
"@strapi/utils": "4.0.
|
|
31
|
+
"@strapi/helper-plugin": "4.0.3",
|
|
32
|
+
"@strapi/utils": "4.0.3",
|
|
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.
|
|
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": "
|
|
64
|
+
"gitHead": "48893ae3fc951b618fd8c4fdc6970e623d2c92db"
|
|
65
65
|
}
|
|
@@ -386,7 +386,7 @@ module.exports = {
|
|
|
386
386
|
throw new ValidationError('token.invalid');
|
|
387
387
|
}
|
|
388
388
|
|
|
389
|
-
await userService.edit(
|
|
389
|
+
await userService.edit(user.id, { confirmed: true, confirmationToken: null });
|
|
390
390
|
|
|
391
391
|
if (returnUser) {
|
|
392
392
|
ctx.send({
|
|
@@ -123,7 +123,7 @@ module.exports = {
|
|
|
123
123
|
...ctx.request.body,
|
|
124
124
|
};
|
|
125
125
|
|
|
126
|
-
const data = await getService('user').edit(
|
|
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);
|
package/server/services/user.js
CHANGED
|
@@ -45,16 +45,23 @@ module.exports = ({ strapi }) => ({
|
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* Promise to edit a/an user.
|
|
48
|
+
* @param {string} userId
|
|
49
|
+
* @param {object} params
|
|
48
50
|
* @return {Promise}
|
|
49
51
|
*/
|
|
50
|
-
async edit(
|
|
51
|
-
if (
|
|
52
|
-
|
|
52
|
+
async edit(userId, params = {}) {
|
|
53
|
+
if (params.password) {
|
|
54
|
+
params.password = await getService('user').hashPassword(params);
|
|
53
55
|
}
|
|
54
56
|
|
|
55
|
-
return strapi
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
return strapi.entityService.update(
|
|
58
|
+
'plugin::users-permissions.user',
|
|
59
|
+
userId,
|
|
60
|
+
{
|
|
61
|
+
data: params,
|
|
62
|
+
populate: ['role']
|
|
63
|
+
}
|
|
64
|
+
);
|
|
58
65
|
},
|
|
59
66
|
|
|
60
67
|
/**
|
|
@@ -132,7 +139,7 @@ module.exports = ({ strapi }) => ({
|
|
|
132
139
|
|
|
133
140
|
const confirmationToken = crypto.randomBytes(20).toString('hex');
|
|
134
141
|
|
|
135
|
-
await this.edit(
|
|
142
|
+
await this.edit(user.id, { confirmationToken });
|
|
136
143
|
|
|
137
144
|
settings.message = await userPermissionService.template(settings.message, {
|
|
138
145
|
URL: `${getAbsoluteServerUrl(strapi.config)}/auth/email-confirmation`,
|