@skroz/profile-api 1.0.17 → 1.0.18
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.
|
@@ -56,9 +56,11 @@ function createProfileResolver(deps) {
|
|
|
56
56
|
if (!user)
|
|
57
57
|
throw new type_graphql_1.UnauthorizedError();
|
|
58
58
|
const service = getAuthService(ctx);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
if (!user.isTempPassword) {
|
|
60
|
+
const isOldPasswordOk = yield service.verifyPassword(user.password, input.oldPassword);
|
|
61
|
+
if (!isOldPasswordOk)
|
|
62
|
+
throw new Error(t('validation:updatePassword.wrongPassword'));
|
|
63
|
+
}
|
|
62
64
|
user.password = yield service.hashPassword(input.password);
|
|
63
65
|
user.isTempPassword = false;
|
|
64
66
|
yield user.save();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skroz/profile-api",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.18",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": "git@gitlab.com:skroz/libs/utils.git",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"type-graphql": "^1.1.1",
|
|
45
45
|
"typeorm": "^0.2.45"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "a074f427f040b742ba51a9a23942893a3c3b2cf6"
|
|
48
48
|
}
|
|
@@ -80,12 +80,14 @@ export function createProfileResolver<
|
|
|
80
80
|
if (!user) throw new UnauthorizedError();
|
|
81
81
|
|
|
82
82
|
const service = getAuthService(ctx);
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
83
|
+
if (!user.isTempPassword) {
|
|
84
|
+
const isOldPasswordOk = await service.verifyPassword(
|
|
85
|
+
user.password!,
|
|
86
|
+
input.oldPassword
|
|
87
|
+
);
|
|
88
|
+
if (!isOldPasswordOk)
|
|
89
|
+
throw new Error(t('validation:updatePassword.wrongPassword'));
|
|
90
|
+
}
|
|
89
91
|
|
|
90
92
|
user.password = await service.hashPassword(input.password);
|
|
91
93
|
user.isTempPassword = false;
|