@loomcore/api 0.1.145 → 0.1.147
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/dist/controllers/auth.controller.js +1 -1
- package/dist/databases/migrations/migration-runner.js +2 -1
- package/dist/models/database-config.interface.d.ts +1 -0
- package/dist/services/auth.service.js +1 -1
- package/dist/services/generic-api-service/generic-api.service.js +2 -4
- package/package.json +2 -2
|
@@ -67,7 +67,7 @@ export class AuthController {
|
|
|
67
67
|
async changePassword(req, res) {
|
|
68
68
|
const userContext = req.userContext;
|
|
69
69
|
const body = req.body;
|
|
70
|
-
const validationErrors = entityUtils.validate(
|
|
70
|
+
const validationErrors = entityUtils.validate(UserSpec, { password: body.password }, true, passwordValidator);
|
|
71
71
|
entityUtils.handleValidationResult(validationErrors, 'AuthController.changePassword');
|
|
72
72
|
const updateResult = await this.authService.changeLoggedInUsersPassword(userContext, body);
|
|
73
73
|
apiUtils.apiResponse(res, 200, { data: updateResult });
|
|
@@ -57,7 +57,8 @@ export class MigrationRunner {
|
|
|
57
57
|
user: this.dbMigrationConfig.database.username,
|
|
58
58
|
password: this.dbMigrationConfig.database.password,
|
|
59
59
|
port: this.dbMigrationConfig.database.port,
|
|
60
|
-
database: this.dbMigrationConfig.database.name
|
|
60
|
+
database: this.dbMigrationConfig.database.name,
|
|
61
|
+
ssl: typeof this.dbMigrationConfig.database.ssl === 'boolean' ? this.dbMigrationConfig.database.ssl : undefined
|
|
61
62
|
});
|
|
62
63
|
this.dbConnection = pool;
|
|
63
64
|
return new Umzug({
|
|
@@ -212,7 +212,7 @@ export class AuthService extends MultiTenantApiService {
|
|
|
212
212
|
if (retrievedPasswordResetToken.token !== passwordResetToken || retrievedPasswordResetToken.expiresOn < Date.now()) {
|
|
213
213
|
throw new BadRequestError('Invalid password reset token');
|
|
214
214
|
}
|
|
215
|
-
const validationErrors = entityUtils.validate(
|
|
215
|
+
const validationErrors = entityUtils.validate(UserSpec, { password: password }, true, passwordValidator);
|
|
216
216
|
entityUtils.handleValidationResult(validationErrors, 'AuthService.resetPassword');
|
|
217
217
|
const result = await this.changePassword(getSystemUserContext(), { email: lowerCaseEmail }, password);
|
|
218
218
|
console.log(`password changed using forgot-password for email: ${lowerCaseEmail}`);
|
|
@@ -37,14 +37,12 @@ export class GenericApiService {
|
|
|
37
37
|
return { queryObject, operations };
|
|
38
38
|
}
|
|
39
39
|
validate(doc, isPartial = false) {
|
|
40
|
-
|
|
41
|
-
return entityUtils.validate(validator, doc);
|
|
40
|
+
return entityUtils.validate(this.modelSpec, doc, isPartial);
|
|
42
41
|
}
|
|
43
42
|
validateMany(docs, isPartial = false) {
|
|
44
|
-
const validator = isPartial ? this.modelSpec.partialValidator : this.modelSpec.validator;
|
|
45
43
|
let allErrors = [];
|
|
46
44
|
for (const doc of docs) {
|
|
47
|
-
const errors = entityUtils.validate(
|
|
45
|
+
const errors = entityUtils.validate(this.modelSpec, doc, isPartial);
|
|
48
46
|
if (errors && errors.length > 0) {
|
|
49
47
|
allErrors.push(...errors);
|
|
50
48
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loomcore/api",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.147",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Loom Core Api - An opinionated Node.js api using Typescript, Express, and MongoDb or PostgreSQL",
|
|
6
6
|
"scripts": {
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"qs": "^6.15.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@loomcore/common": "^0.0.
|
|
61
|
+
"@loomcore/common": "^0.0.70",
|
|
62
62
|
"@sinclair/typebox": "0.34.33",
|
|
63
63
|
"cookie-parser": "^1.4.6",
|
|
64
64
|
"cors": "^2.8.5",
|