@solidstarters/solid-core 1.2.170 → 1.2.171

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.
Files changed (83) hide show
  1. package/dist/config/iam.config.d.ts +2 -0
  2. package/dist/config/iam.config.d.ts.map +1 -1
  3. package/dist/config/iam.config.js +2 -1
  4. package/dist/config/iam.config.js.map +1 -1
  5. package/dist/controllers/authentication.controller.d.ts.map +1 -1
  6. package/dist/controllers/authentication.controller.js +0 -8
  7. package/dist/controllers/authentication.controller.js.map +1 -1
  8. package/dist/controllers/email-template.controller.d.ts +1 -1
  9. package/dist/controllers/email-template.controller.d.ts.map +1 -1
  10. package/dist/controllers/email-template.controller.js +3 -6
  11. package/dist/controllers/email-template.controller.js.map +1 -1
  12. package/dist/controllers/google-authentication.controller.d.ts +3 -3
  13. package/dist/controllers/google-authentication.controller.d.ts.map +1 -1
  14. package/dist/controllers/google-authentication.controller.js +5 -8
  15. package/dist/controllers/google-authentication.controller.js.map +1 -1
  16. package/dist/controllers/media.controller.d.ts +1 -1
  17. package/dist/controllers/media.controller.d.ts.map +1 -1
  18. package/dist/controllers/media.controller.js +1 -5
  19. package/dist/controllers/media.controller.js.map +1 -1
  20. package/dist/controllers/model-metadata.controller.d.ts.map +1 -1
  21. package/dist/controllers/model-metadata.controller.js +0 -5
  22. package/dist/controllers/model-metadata.controller.js.map +1 -1
  23. package/dist/controllers/otp-authentication.controller.js +0 -3
  24. package/dist/controllers/otp-authentication.controller.js.map +1 -1
  25. package/dist/controllers/service.controller.d.ts +2 -2
  26. package/dist/controllers/service.controller.d.ts.map +1 -1
  27. package/dist/controllers/service.controller.js +3 -7
  28. package/dist/controllers/service.controller.js.map +1 -1
  29. package/dist/controllers/sms-template.controller.d.ts.map +1 -1
  30. package/dist/controllers/sms-template.controller.js +0 -3
  31. package/dist/controllers/sms-template.controller.js.map +1 -1
  32. package/dist/entities/user.entity.d.ts +3 -0
  33. package/dist/entities/user.entity.d.ts.map +1 -1
  34. package/dist/entities/user.entity.js +13 -1
  35. package/dist/entities/user.entity.js.map +1 -1
  36. package/dist/helpers/field-crud-managers/PasswordFieldCrudManager.d.ts +2 -1
  37. package/dist/helpers/field-crud-managers/PasswordFieldCrudManager.d.ts.map +1 -1
  38. package/dist/helpers/field-crud-managers/PasswordFieldCrudManager.js +3 -3
  39. package/dist/helpers/field-crud-managers/PasswordFieldCrudManager.js.map +1 -1
  40. package/dist/passport-strategies/local.strategy.js +1 -1
  41. package/dist/passport-strategies/local.strategy.js.map +1 -1
  42. package/dist/seeders/seed-data/solid-core-metadata.json +43 -0
  43. package/dist/services/authentication.service.d.ts +2 -1
  44. package/dist/services/authentication.service.d.ts.map +1 -1
  45. package/dist/services/authentication.service.js +28 -5
  46. package/dist/services/authentication.service.js.map +1 -1
  47. package/dist/services/bcrypt.service.d.ts +11 -1
  48. package/dist/services/bcrypt.service.d.ts.map +1 -1
  49. package/dist/services/bcrypt.service.js +35 -5
  50. package/dist/services/bcrypt.service.js.map +1 -1
  51. package/dist/services/crud.service.d.ts.map +1 -1
  52. package/dist/services/crud.service.js +2 -1
  53. package/dist/services/crud.service.js.map +1 -1
  54. package/dist/services/hashing.service.d.ts +4 -1
  55. package/dist/services/hashing.service.d.ts.map +1 -1
  56. package/dist/services/hashing.service.js.map +1 -1
  57. package/dist/solid-core.module.d.ts.map +1 -1
  58. package/dist/solid-core.module.js +46 -61
  59. package/dist/solid-core.module.js.map +1 -1
  60. package/dist/subscribers/audit.subscriber.d.ts.map +1 -1
  61. package/dist/subscribers/audit.subscriber.js +1 -1
  62. package/dist/subscribers/audit.subscriber.js.map +1 -1
  63. package/dist/tsconfig.tsbuildinfo +1 -1
  64. package/package.json +1 -1
  65. package/src/config/iam.config.ts +2 -1
  66. package/src/controllers/authentication.controller.ts +8 -10
  67. package/src/controllers/email-template.controller.ts +7 -10
  68. package/src/controllers/google-authentication.controller.ts +9 -10
  69. package/src/controllers/media.controller.ts +5 -6
  70. package/src/controllers/model-metadata.controller.ts +5 -6
  71. package/src/controllers/otp-authentication.controller.ts +2 -2
  72. package/src/controllers/service.controller.ts +8 -9
  73. package/src/controllers/sms-template.controller.ts +3 -4
  74. package/src/entities/user.entity.ts +9 -0
  75. package/src/helpers/field-crud-managers/PasswordFieldCrudManager.ts +4 -3
  76. package/src/passport-strategies/local.strategy.ts +1 -1
  77. package/src/seeders/seed-data/solid-core-metadata.json +43 -0
  78. package/src/services/authentication.service.ts +32 -3
  79. package/src/services/bcrypt.service.ts +45 -7
  80. package/src/services/crud.service.ts +2 -1
  81. package/src/services/hashing.service.ts +5 -2
  82. package/src/solid-core.module.ts +59 -61
  83. package/src/subscribers/audit.subscriber.ts +6 -1
@@ -16,14 +16,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.ServiceController = void 0;
17
17
  const openapi = require("@nestjs/swagger");
18
18
  const common_1 = require("@nestjs/common");
19
- const public_decorator_1 = require("../decorators/public.decorator");
20
- const solid_registry_1 = require("../helpers/solid-registry");
21
19
  const swagger_1 = require("@nestjs/swagger");
22
- const throttler_1 = require("@nestjs/throttler");
23
20
  const active_user_decorator_1 = require("../decorators/active-user.decorator");
21
+ const public_decorator_1 = require("../decorators/public.decorator");
22
+ const error_mapper_service_1 = require("../helpers/error-mapper.service");
24
23
  const ai_interaction_service_1 = require("../services/ai-interaction.service");
25
24
  const mq_message_service_1 = require("../services/mq-message.service");
26
- const error_mapper_service_1 = require("../helpers/error-mapper.service");
25
+ const solid_registry_1 = require("../helpers/solid-registry");
27
26
  let ServiceController = ServiceController_1 = class ServiceController {
28
27
  constructor(solidRegistry, aiInteractionService, mqMessageService, errorMapper) {
29
28
  this.solidRegistry = solidRegistry;
@@ -104,7 +103,6 @@ __decorate([
104
103
  ], ServiceController.prototype, "mcpPingPong", null);
105
104
  __decorate([
106
105
  (0, public_decorator_1.Public)(),
107
- (0, throttler_1.SkipThrottle)({ short: false, login: true, burst: true, sustained: true }),
108
106
  (0, common_1.Post)('seed'),
109
107
  openapi.ApiResponse({ status: 201 }),
110
108
  __param(0, (0, common_1.Body)()),
@@ -115,8 +113,6 @@ __decorate([
115
113
  exports.ServiceController = ServiceController = ServiceController_1 = __decorate([
116
114
  (0, common_1.Controller)(''),
117
115
  (0, swagger_1.ApiTags)("Common"),
118
- (0, common_1.UseGuards)(throttler_1.ThrottlerGuard),
119
- (0, throttler_1.SkipThrottle)({ short: true, login: true, burst: true, sustained: true }),
120
116
  __metadata("design:paramtypes", [solid_registry_1.SolidRegistry,
121
117
  ai_interaction_service_1.AiInteractionService,
122
118
  mq_message_service_1.MqMessageService,
@@ -1 +1 @@
1
- {"version":3,"file":"service.controller.js","sourceRoot":"","sources":["../../src/controllers/service.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAgF;AAChF,qEAAyD;AACzD,8DAA0D;AAC1D,6CAAyD;AACzD,iDAAiE;AAEjE,+EAAkE;AAClE,+EAA2E;AAC3E,uEAAmE;AACnE,0EAAsE;AAO/D,IAAM,iBAAiB,yBAAvB,MAAM,iBAAiB;IAG1B,YACqB,aAA4B,EAC5B,oBAA0C,EAC1C,gBAAkC,EAClC,WAA+B;QAH/B,kBAAa,GAAb,aAAa,CAAe;QAC5B,yBAAoB,GAApB,oBAAoB,CAAsB;QAC1C,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,gBAAW,GAAX,WAAW,CAAoB;QANnC,WAAM,GAAG,IAAI,eAAM,CAAC,mBAAiB,CAAC,IAAI,CAAC,CAAC;IAOzD,CAAC;IAIL,QAAQ;QACJ,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IAC9B,CAAC;IAIK,AAAN,KAAK,CAAC,WAAW,CAAe,UAA0B;QAItD,MAAM,QAAQ,GAAG,eAAe,UAAU,CAAC,GAAG,EAAE,CAAC;QAEjD,MAAM,EAAE,cAAc,EAAE,eAAe,EAAE,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,mBAAmB,CAC3F,kBAAkB,EA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E,IAAA,aAAI,EAAC,MAAM,CAAC;;IACG,WAAA,IAAA,aAAI,GAAE,CAAA;;;;iDAarB;4BAxFQ,iBAAiB;IAJ7B,IAAA,mBAAU,EAAC,EAAE,CAAC;IACd,IAAA,iBAAO,EAAC,QAAQ,CAAC;IACjB,IAAA,kBAAS,EAAC,0BAAc,CAAC;IACzB,IAAA,wBAAY,EAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;qCAKjC,8BAAa;QACN,6CAAoB;QACxB,qCAAgB;QACrB,yCAAkB;GAP3C,iBAAiB,CA4G7B","sourcesContent":["import { Body, Controller, Get, Logger, Post, UseGuards } from '@nestjs/common';\nimport { Public } from 'src/decorators/public.decorator';\nimport { SolidRegistry } from '../helpers/solid-registry';\nimport { ApiBearerAuth, ApiTags } from '@nestjs/swagger';\nimport { ThrottlerGuard, SkipThrottle } from '@nestjs/throttler';\nimport { ActiveUserData } from 'src/interfaces/active-user-data.interface';\nimport { ActiveUser } from 'src/decorators/active-user.decorator';\nimport { AiInteractionService } from 'src/services/ai-interaction.service';\nimport { MqMessageService } from 'src/services/mq-message.service';\nimport { ErrorMapperService } from 'src/helpers/error-mapper.service';\n\n\n@Controller('')\n@ApiTags(\"Common\")\n@UseGuards(ThrottlerGuard)\n@SkipThrottle({ short: true, login: true, burst: true, sustained: true }) // Skip all\nexport class ServiceController {\n private readonly logger = new Logger(ServiceController.name);\n\n constructor(\n private readonly solidRegistry: SolidRegistry,\n private readonly aiInteractionService: AiInteractionService,\n private readonly mqMessageService: MqMessageService,\n private readonly errorMapper: ErrorMapperService\n ) { }\n\n @Public()\n @Get('ping')\n pingPong() {\n return { pong: 'v1.0.2' };\n }\n\n @ApiBearerAuth(\"jwt\")\n @Get('mcp/ping')\n async mcpPingPong(@ActiveUser() activeUser: ActiveUserData) {\n // TODO: do a MCP client invocation, wait for response and return.\n // If failure then decide shape to return.\n\n const threadId = `pingPongTxn-${activeUser.sub}`;\n\n const { queueMessageId, aiInteractionId } = await this.aiInteractionService.triggerMcpClientJob(\n `Can you do 1 + 1`,\n activeUser.sub,\n true,\n threadId\n );\n\n this.logger.debug(`mcp ping pong job triggered: queueMessageId=${queueMessageId}, aiInteractionId=${aiInteractionId}`);\n\n // Wait up to 2 minutes, start at 500ms poll, back off to max 2s, throw if failed:\n const result = await this.mqMessageService.waitForTerminalStatus(queueMessageId, {\n timeoutMs: 2 * 60 * 1000,\n intervalMs: 500,\n maxIntervalMs: 2000,\n throwOnFailure: false,\n });\n\n this.logger.debug(`mcp ping pong job finished with stage=${result.stage}`)\n\n this.logger.debug(`mcp ping pong trying to find genai (child) interaction for aiInteraction for id=${aiInteractionId}`)\n\n // @ts-ignore\n const genAiInteractions = await this.aiInteractionService.find({\n filters: {\n parentInteraction: {\n id: {\n $eq: aiInteractionId\n }\n }\n }\n });\n\n const genAiInteraction = genAiInteractions['records'][0];\n this.logger.debug(genAiInteraction.message);\n\n this.logger.debug(`identified gen-ai interaction with id=${genAiInteraction.id}`);\n this.logger.debug(`proceeding with applying the gen-ai interaction`)\n\n return {\n mcpPong: 'v1.0.2',\n genAiInteraction: {\n status: genAiInteraction.status,\n errorCode: genAiInteraction.status === 'failed' ? this.errorMapper.mapMessage(genAiInteraction.errorMessage, genAiInteraction.metadata) : '',\n errorMessage: genAiInteraction.errorMessage,\n }\n };\n }\n\n @Public()\n @SkipThrottle({ short: false, login: true, burst: true, sustained: true }) //Enable the short throttle only\n @Post('seed')\n async seedData(@Body() seedData: any) {\n const seeder = this.solidRegistry\n .getSeeders()\n .filter((seeder) => seeder.name === seedData.seeder)\n .map((seeder) => seeder.instance)\n .pop();\n if (!seeder) {\n this.logger.error(`Seeder service ${seedData.seeder} not found. Does your service have a seed() method?`);\n return;\n }\n this.logger.log(`Running the seed() method for seeder :${seeder.constructor.name}`);\n await seeder.seed();\n return { message: `seed data for ${seedData.seeder}` };\n }\n\n // @Public()\n // @Get('play')\n // play() {\n // return this.solidRegistry.getControllers();\n // }\n\n // //This method identifies a provider as a seeder if it has a seed method i.e duck typing\n // private isSeeder(provider: InstanceWrapper) {\n // const { instance } = provider;\n // if (!instance) return false;\n\n // const seedMethod = this.metadataScanner\n // .getAllMethodNames(Object.getPrototypeOf(instance))\n // .find((methodName) => methodName === 'seed');\n // if (!seedMethod) return false;\n // return true;\n // }\n\n}\n"]}
1
+ {"version":3,"file":"service.controller.js","sourceRoot":"","sources":["../../src/controllers/service.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAqE;AACrE,6CAAyD;AACzD,+EAAkE;AAClE,qEAAyD;AACzD,0EAAsE;AAEtE,+EAA2E;AAC3E,uEAAmE;AACnE,8DAA0D;AAOnD,IAAM,iBAAiB,yBAAvB,MAAM,iBAAiB;IAG1B,YACqB,aAA4B,EAC5B,oBAA0C,EAC1C,gBAAkC,EAClC,WAA+B;QAH/B,kBAAa,GAAb,aAAa,CAAe;QAC5B,yBAAoB,GAApB,oBAAoB,CAAsB;QAC1C,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,gBAAW,GAAX,WAAW,CAAoB;QANnC,WAAM,GAAG,IAAI,eAAM,CAAC,mBAAiB,CAAC,IAAI,CAAC,CAAC;IAOzD,CAAC;IAIL,QAAQ;QACJ,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IAC9B,CAAC;IAIK,AAAN,KAAK,CAAC,WAAW,CAAe,UAA0B;QAItD,MAAM,QAAQ,GAAG,eAAe,UAAU,CAAC,GAAG,EAAE,CAAC;QAEjD,MAAM,EAAE,cAAc,EAAE,eAAe,EAAE,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,mBAAmB,CAC3F,kBAAkB,EAClB,UAAU,CAAC,GAAG,EACd,IAAI,EACJ,QAAQ,CACX,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,+CAA+C,cAAc,qBAAqB,eAAe,EAA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["import { Body, Controller, Get, Logger, Post } from '@nestjs/common';\nimport { ApiBearerAuth, ApiTags } from '@nestjs/swagger';\nimport { ActiveUser } from 'src/decorators/active-user.decorator';\nimport { Public } from 'src/decorators/public.decorator';\nimport { ErrorMapperService } from 'src/helpers/error-mapper.service';\nimport { ActiveUserData } from 'src/interfaces/active-user-data.interface';\nimport { AiInteractionService } from 'src/services/ai-interaction.service';\nimport { MqMessageService } from 'src/services/mq-message.service';\nimport { SolidRegistry } from '../helpers/solid-registry';\n\n\n@Controller('')\n@ApiTags(\"Common\")\n// @UseGuards(ThrottlerGuard)\n// @SkipThrottle({ short: true, login: true, burst: true, sustained: true }) // Skip all\nexport class ServiceController {\n private readonly logger = new Logger(ServiceController.name);\n\n constructor(\n private readonly solidRegistry: SolidRegistry,\n private readonly aiInteractionService: AiInteractionService,\n private readonly mqMessageService: MqMessageService,\n private readonly errorMapper: ErrorMapperService\n ) { }\n\n @Public()\n @Get('ping')\n pingPong() {\n return { pong: 'v1.0.2' };\n }\n\n @ApiBearerAuth(\"jwt\")\n @Get('mcp/ping')\n async mcpPingPong(@ActiveUser() activeUser: ActiveUserData) {\n // TODO: do a MCP client invocation, wait for response and return.\n // If failure then decide shape to return.\n\n const threadId = `pingPongTxn-${activeUser.sub}`;\n\n const { queueMessageId, aiInteractionId } = await this.aiInteractionService.triggerMcpClientJob(\n `Can you do 1 + 1`,\n activeUser.sub,\n true,\n threadId\n );\n\n this.logger.debug(`mcp ping pong job triggered: queueMessageId=${queueMessageId}, aiInteractionId=${aiInteractionId}`);\n\n // Wait up to 2 minutes, start at 500ms poll, back off to max 2s, throw if failed:\n const result = await this.mqMessageService.waitForTerminalStatus(queueMessageId, {\n timeoutMs: 2 * 60 * 1000,\n intervalMs: 500,\n maxIntervalMs: 2000,\n throwOnFailure: false,\n });\n\n this.logger.debug(`mcp ping pong job finished with stage=${result.stage}`)\n\n this.logger.debug(`mcp ping pong trying to find genai (child) interaction for aiInteraction for id=${aiInteractionId}`)\n\n // @ts-ignore\n const genAiInteractions = await this.aiInteractionService.find({\n filters: {\n parentInteraction: {\n id: {\n $eq: aiInteractionId\n }\n }\n }\n });\n\n const genAiInteraction = genAiInteractions['records'][0];\n this.logger.debug(genAiInteraction.message);\n\n this.logger.debug(`identified gen-ai interaction with id=${genAiInteraction.id}`);\n this.logger.debug(`proceeding with applying the gen-ai interaction`)\n\n return {\n mcpPong: 'v1.0.2',\n genAiInteraction: {\n status: genAiInteraction.status,\n errorCode: genAiInteraction.status === 'failed' ? this.errorMapper.mapMessage(genAiInteraction.errorMessage, genAiInteraction.metadata) : '',\n errorMessage: genAiInteraction.errorMessage,\n }\n };\n }\n\n @Public()\n // @SkipThrottle({ short: false, login: true, burst: true, sustained: true }) //Enable the short throttle only\n @Post('seed')\n async seedData(@Body() seedData: any) {\n const seeder = this.solidRegistry\n .getSeeders()\n .filter((seeder) => seeder.name === seedData.seeder)\n .map((seeder) => seeder.instance)\n .pop();\n if (!seeder) {\n this.logger.error(`Seeder service ${seedData.seeder} not found. Does your service have a seed() method?`);\n return;\n }\n this.logger.log(`Running the seed() method for seeder :${seeder.constructor.name}`);\n await seeder.seed();\n return { message: `seed data for ${seedData.seeder}` };\n }\n\n // @Public()\n // @Get('play')\n // play() {\n // return this.solidRegistry.getControllers();\n // }\n\n // //This method identifies a provider as a seeder if it has a seed method i.e duck typing\n // private isSeeder(provider: InstanceWrapper) {\n // const { instance } = provider;\n // if (!instance) return false;\n\n // const seedMethod = this.metadataScanner\n // .getAllMethodNames(Object.getPrototypeOf(instance))\n // .find((methodName) => methodName === 'seed');\n // if (!seedMethod) return false;\n // return true;\n // }\n\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sms-template.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/sms-template.controller.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAA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AAO;IAOhH,MAAM,CAAc,EAAE,EAAE,MAAM,EAAU,SAAS,EAAE,oBAAoB,EAAmB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;IAgBrH,QAAQ,CAAU,KAAK,EAAE,GAAG;;;;;;;;;;;;;;;;;;;;IAM5B,OAAO,CAAc,EAAE,EAAE,MAAM,EAAW,KAAK,EAAE,GAAG;IAKpD,UAAU,CAAS,GAAG,EAAE,MAAM,EAAE;IAMhC,MAAM,CAAc,EAAE,EAAE,MAAM;CAGvC"}
@@ -17,7 +17,6 @@ const openapi = require("@nestjs/swagger");
17
17
  const common_1 = require("@nestjs/common");
18
18
  const platform_express_1 = require("@nestjs/platform-express");
19
19
  const swagger_1 = require("@nestjs/swagger");
20
- const throttler_1 = require("@nestjs/throttler");
21
20
  const public_decorator_1 = require("../decorators/public.decorator");
22
21
  const create_sms_template_dto_1 = require("../dtos/create-sms-template.dto");
23
22
  const update_sms_template_dto_1 = require("../dtos/update-sms-template.dto");
@@ -132,8 +131,6 @@ __decorate([
132
131
  exports.SmsTemplateController = SmsTemplateController = __decorate([
133
132
  (0, common_1.Controller)('sms-template'),
134
133
  (0, swagger_1.ApiTags)("Common"),
135
- (0, common_1.UseGuards)(throttler_1.ThrottlerGuard),
136
- (0, throttler_1.SkipThrottle)({ short: false, login: true, burst: true, sustained: true }),
137
134
  __metadata("design:paramtypes", [sms_template_service_1.SmsTemplateService])
138
135
  ], SmsTemplateController);
139
136
  //# sourceMappingURL=sms-template.controller.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sms-template.controller.js","sourceRoot":"","sources":["../../src/controllers/sms-template.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAmI;AACnI,+DAA+D;AAC/D,6CAAoD;AACpD,iDAAiE;AACjE,qEAAyD;AACzD,6EAAuE;AACvE,6EAAuE;AACvE,2EAAsE;AAO/D,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAChC,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query, UploadedFiles, UseGuards, UseInterceptors } from '@nestjs/common';\nimport { AnyFilesInterceptor } from '@nestjs/platform-express';\nimport { ApiQuery, ApiTags } from '@nestjs/swagger';\nimport { SkipThrottle, ThrottlerGuard } from '@nestjs/throttler';\nimport { Public } from 'src/decorators/public.decorator';\nimport { CreateSmsTemplateDto } from '../dtos/create-sms-template.dto';\nimport { UpdateSmsTemplateDto } from '../dtos/update-sms-template.dto';\nimport { SmsTemplateService } from '../services/sms-template.service';\n\n\n@Controller('sms-template')\n@ApiTags(\"Common\")\n@UseGuards(ThrottlerGuard)\n@SkipThrottle({ short: false, login: true, burst: true, sustained: true }) //Enable the short throttle only\nexport class SmsTemplateController {\n constructor(private readonly service: SmsTemplateService) { }\n\n @Public()\n @Post()\n @UseInterceptors(AnyFilesInterceptor())\n create(@Body() createDto: CreateSmsTemplateDto, @UploadedFiles() files: Array<Express.Multer.File>) {\n return this.service.create(createDto, files);\n }\n \n @Public()\n @Post('/bulk')\n @UseInterceptors(AnyFilesInterceptor())\n insertMany(@Body() createDtos: CreateSmsTemplateDto[], @UploadedFiles() filesArray: Express.Multer.File[][] = []) {\n return this.service.insertMany(createDtos, filesArray);\n }\n \n @Public()\n @Put(':id')\n @UseInterceptors(AnyFilesInterceptor())\n update(@Param('id') id: number, @Body() updateDto: UpdateSmsTemplateDto, @UploadedFiles() files: Array<Express.Multer.File>) {\n return this.service.update(id, updateDto, files);\n }\n \n @Public()\n @ApiQuery({ name: 'showSoftDeleted', required: false, type: Boolean })\n @ApiQuery({ name: 'showOnlySoftDeleted', required: false, type: Boolean })\n @ApiQuery({ name: 'limit', required: false, type: Number })\n @ApiQuery({ name: 'offset', required: false, type: Number })\n @ApiQuery({ name: 'fields', required: false, type: Array })\n @ApiQuery({ name: 'sort', required: false, type: Array })\n @ApiQuery({ name: 'groupBy', required: false, type: Array })\n @ApiQuery({ name: 'populate', required: false, type: Array })\n @ApiQuery({ name: 'populateMedia', required: false, type: Array })\n @ApiQuery({ name: 'filters', required: false, type: Array })\n @Get()\n async findMany(@Query() query: any) {\n return this.service.find(query);\n }\n \n @Public()\n @Get(':id')\n async findOne(@Param('id') id: string, @Query() query: any) {\n return this.service.findOne(+id, query);\n }\n \n @Delete('/bulk')\n async deleteMany(@Body() ids: number[]) {\n return this.service.deleteMany(ids);\n }\n \n @Public()\n @Delete(':id')\n async delete(@Param('id') id: number) {\n return this.service.delete(id);\n }\n}\n"]}
1
+ {"version":3,"file":"sms-template.controller.js","sourceRoot":"","sources":["../../src/controllers/sms-template.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwH;AACxH,+DAA+D;AAC/D,6CAAoD;AACpD,qEAAyD;AACzD,6EAAuE;AACvE,6EAAuE;AACvE,2EAAsE;AAO/D,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAChC,YAA6B,OAA2B;QAA3B,YAAO,GAAP,OAAO,CAAoB;IAAI,CAAC;IAK3D,MAAM,CAAS,SAA+B,EAAmB,KAAiC;QAChG,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAC/C,CAAC;IAKD,UAAU,CAAS,UAAkC,EAAmB,aAAsC,EAAE;QAC9G,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACzD,CAAC;IAKD,MAAM,CAAc,EAAU,EAAU,SAA+B,EAAmB,KAAiC;QACzH,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IACnD,CAAC;IAcK,AAAN,KAAK,CAAC,QAAQ,CAAU,KAAU;QAChC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAIK,AAAN,KAAK,CAAC,OAAO,CAAc,EAAU,EAAW,KAAU;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,EA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,WAAA,IAAA,aAAI,GAAE,CAAA;;;;uDAEvB;AAIK;IAFL,IAAA,yBAAM,GAAE;IACR,IAAA,eAAM,EAAC,KAAK,CAAC;;IACA,WAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;;;;mDAExB;gCAvDQ,qBAAqB;IAJjC,IAAA,mBAAU,EAAC,cAAc,CAAC;IAC1B,IAAA,iBAAO,EAAC,QAAQ,CAAC;qCAIsB,yCAAkB;GAD7C,qBAAqB,CAwDjC","sourcesContent":["import { Body, Controller, Delete, Get, Param, Post, Put, Query, UploadedFiles, UseInterceptors } from '@nestjs/common';\nimport { AnyFilesInterceptor } from '@nestjs/platform-express';\nimport { ApiQuery, ApiTags } from '@nestjs/swagger';\nimport { Public } from 'src/decorators/public.decorator';\nimport { CreateSmsTemplateDto } from '../dtos/create-sms-template.dto';\nimport { UpdateSmsTemplateDto } from '../dtos/update-sms-template.dto';\nimport { SmsTemplateService } from '../services/sms-template.service';\n\n\n@Controller('sms-template')\n@ApiTags(\"Common\")\n// @UseGuards(ThrottlerGuard)\n// @SkipThrottle({ short: false, login: true, burst: true, sustained: true }) //Enable the short throttle only\nexport class SmsTemplateController {\n constructor(private readonly service: SmsTemplateService) { }\n\n @Public()\n @Post()\n @UseInterceptors(AnyFilesInterceptor())\n create(@Body() createDto: CreateSmsTemplateDto, @UploadedFiles() files: Array<Express.Multer.File>) {\n return this.service.create(createDto, files);\n }\n \n @Public()\n @Post('/bulk')\n @UseInterceptors(AnyFilesInterceptor())\n insertMany(@Body() createDtos: CreateSmsTemplateDto[], @UploadedFiles() filesArray: Express.Multer.File[][] = []) {\n return this.service.insertMany(createDtos, filesArray);\n }\n \n @Public()\n @Put(':id')\n @UseInterceptors(AnyFilesInterceptor())\n update(@Param('id') id: number, @Body() updateDto: UpdateSmsTemplateDto, @UploadedFiles() files: Array<Express.Multer.File>) {\n return this.service.update(id, updateDto, files);\n }\n \n @Public()\n @ApiQuery({ name: 'showSoftDeleted', required: false, type: Boolean })\n @ApiQuery({ name: 'showOnlySoftDeleted', required: false, type: Boolean })\n @ApiQuery({ name: 'limit', required: false, type: Number })\n @ApiQuery({ name: 'offset', required: false, type: Number })\n @ApiQuery({ name: 'fields', required: false, type: Array })\n @ApiQuery({ name: 'sort', required: false, type: Array })\n @ApiQuery({ name: 'groupBy', required: false, type: Array })\n @ApiQuery({ name: 'populate', required: false, type: Array })\n @ApiQuery({ name: 'populateMedia', required: false, type: Array })\n @ApiQuery({ name: 'filters', required: false, type: Array })\n @Get()\n async findMany(@Query() query: any) {\n return this.service.find(query);\n }\n \n @Public()\n @Get(':id')\n async findOne(@Param('id') id: string, @Query() query: any) {\n return this.service.findOne(+id, query);\n }\n \n @Delete('/bulk')\n async deleteMany(@Body() ids: number[]) {\n return this.service.deleteMany(ids);\n }\n \n @Public()\n @Delete(':id')\n async delete(@Param('id') id: number) {\n return this.service.delete(id);\n }\n}\n"]}
@@ -32,5 +32,8 @@ export declare class User extends CommonEntity {
32
32
  customPayload: string;
33
33
  roles: RoleMetadata[];
34
34
  userViewMetadata: UserViewMetadata[];
35
+ passwordScheme: string;
36
+ passwordSchemeVersion: number;
37
+ rehashedAt: Date;
35
38
  }
36
39
  //# sourceMappingURL=user.entity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"user.entity.d.ts","sourceRoot":"","sources":["../../src/entities/user.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAEzD,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAA;AAGzE,qBAGa,IAAK,SAAQ,YAAY;IAGlC,QAAQ,EAAE,MAAM,CAAC;IAIjB,QAAQ,EAAE,MAAM,CAAC;IAIjB,KAAK,EAAE,MAAM,CAAC;IAId,MAAM,EAAE,MAAM,CAAC;IAGf,QAAQ,EAAE,MAAM,CAAC;IAGjB,mBAAmB,EAAE,OAAO,C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AAE,MAAM,CAAC;IAGjB,mBAAmB,EAAE,OAAO,CAAQ;IAGpC,iBAAiB,EAAE,MAAM,CAAW;IAGpC,UAAU,EAAE,MAAM,CAAC;IAGnB,iBAAiB,EAAE,MAAM,CAAC;IAG1B,QAAQ,EAAE,MAAM,CAAC;IAGjB,oBAAoB,EAAE,MAAM,CAAC;IAG7B,MAAM,EAAE,OAAO,CAAQ;IAGvB,yBAAyB,EAAE,IAAI,CAAC;IAGhC,iCAAiC,EAAE,MAAM,CAAC;IAG1C,0CAA0C,EAAE,IAAI,CAAC;IAGjD,6BAA6B,EAAE,IAAI,CAAC;IAGpC,oCAAoC,EAAE,MAAM,CAAC;IAG7C,6CAA6C,EAAE,IAAI,CAAC;IAGpD,8BAA8B,EAAE,IAAI,CAAC;IAGrC,qCAAqC,EAAE,MAAM,CAAC;IAG9C,8CAA8C,EAAE,IAAI,CAAC;IAGrD,sBAAsB,EAAE,IAAI,CAAC;IAG7B,6BAA6B,EAAE,MAAM,CAAC;IAGtC,sCAAsC,EAAE,IAAI,CAAC;IAG7C,uBAAuB,EAAE,IAAI,CAAC;IAG9B,8BAA8B,EAAE,MAAM,CAAC;IAGvC,uCAAuC,EAAE,IAAI,CAAC;IAG9C,aAAa,EAAE,MAAM,CAAC;IAItB,KAAK,EAAE,YAAY,EAAE,CAAC;IAGtB,gBAAgB,EAAE,gBAAgB,EAAE,CAAC;IAGrC,cAAc,EAAE,MAAM,CAAC;IAGvB,qBAAqB,EAAE,MAAM,CAAC;IAG9B,UAAU,EAAE,IAAI,CAAC;CACpB"}
@@ -24,7 +24,7 @@ let User = class User extends common_entity_1.CommonEntity {
24
24
  this.active = true;
25
25
  }
26
26
  static _OPENAPI_METADATA_FACTORY() {
27
- return { fullName: { required: true, type: () => String }, username: { required: true, type: () => String }, email: { required: true, type: () => String }, mobile: { required: true, type: () => String }, password: { required: true, type: () => String }, forcePasswordChange: { required: true, type: () => Boolean, default: true }, lastLoginProvider: { required: true, type: () => String, default: "local" }, accessCode: { required: true, type: () => String }, googleAccessToken: { required: true, type: () => String }, googleId: { required: true, type: () => String }, googleProfilePicture: { required: true, type: () => String }, active: { required: true, type: () => Boolean, default: true }, forgotPasswordConfirmedAt: { required: true, type: () => Date }, verificationTokenOnForgotPassword: { required: true, type: () => String }, verificationTokenOnForgotPasswordExpiresAt: { required: true, type: () => Date }, emailVerifiedOnRegistrationAt: { required: true, type: () => Date }, emailVerificationTokenOnRegistration: { required: true, type: () => String }, emailVerificationTokenOnRegistrationExpiresAt: { required: true, type: () => Date }, mobileVerifiedOnRegistrationAt: { required: true, type: () => Date }, mobileVerificationTokenOnRegistration: { required: true, type: () => String }, mobileVerificationTokenOnRegistrationExpiresAt: { required: true, type: () => Date }, emailVerifiedOnLoginAt: { required: true, type: () => Date }, emailVerificationTokenOnLogin: { required: true, type: () => String }, emailVerificationTokenOnLoginExpiresAt: { required: true, type: () => Date }, mobileVerifiedOnLoginAt: { required: true, type: () => Date }, mobileVerificationTokenOnLogin: { required: true, type: () => String }, mobileVerificationTokenOnLoginExpiresAt: { required: true, type: () => Date }, customPayload: { required: true, type: () => String }, roles: { required: true, type: () => [require("./role-metadata.entity").RoleMetadata] }, userViewMetadata: { required: true, type: () => [require("./user-view-metadata.entity").UserViewMetadata] } };
27
+ return { fullName: { required: true, type: () => String }, username: { required: true, type: () => String }, email: { required: true, type: () => String }, mobile: { required: true, type: () => String }, password: { required: true, type: () => String }, forcePasswordChange: { required: true, type: () => Boolean, default: true }, lastLoginProvider: { required: true, type: () => String, default: "local" }, accessCode: { required: true, type: () => String }, googleAccessToken: { required: true, type: () => String }, googleId: { required: true, type: () => String }, googleProfilePicture: { required: true, type: () => String }, active: { required: true, type: () => Boolean, default: true }, forgotPasswordConfirmedAt: { required: true, type: () => Date }, verificationTokenOnForgotPassword: { required: true, type: () => String }, verificationTokenOnForgotPasswordExpiresAt: { required: true, type: () => Date }, emailVerifiedOnRegistrationAt: { required: true, type: () => Date }, emailVerificationTokenOnRegistration: { required: true, type: () => String }, emailVerificationTokenOnRegistrationExpiresAt: { required: true, type: () => Date }, mobileVerifiedOnRegistrationAt: { required: true, type: () => Date }, mobileVerificationTokenOnRegistration: { required: true, type: () => String }, mobileVerificationTokenOnRegistrationExpiresAt: { required: true, type: () => Date }, emailVerifiedOnLoginAt: { required: true, type: () => Date }, emailVerificationTokenOnLogin: { required: true, type: () => String }, emailVerificationTokenOnLoginExpiresAt: { required: true, type: () => Date }, mobileVerifiedOnLoginAt: { required: true, type: () => Date }, mobileVerificationTokenOnLogin: { required: true, type: () => String }, mobileVerificationTokenOnLoginExpiresAt: { required: true, type: () => Date }, customPayload: { required: true, type: () => String }, roles: { required: true, type: () => [require("./role-metadata.entity").RoleMetadata] }, userViewMetadata: { required: true, type: () => [require("./user-view-metadata.entity").UserViewMetadata] }, passwordScheme: { required: true, type: () => String }, passwordSchemeVersion: { required: true, type: () => Number }, rehashedAt: { required: true, type: () => Date } };
28
28
  }
29
29
  };
30
30
  exports.User = User;
@@ -160,6 +160,18 @@ __decorate([
160
160
  (0, typeorm_1.OneToMany)(() => user_view_metadata_entity_1.UserViewMetadata, userViewMetadata => userViewMetadata.user, { cascade: true }),
161
161
  __metadata("design:type", Array)
162
162
  ], User.prototype, "userViewMetadata", void 0);
163
+ __decorate([
164
+ (0, typeorm_1.Column)({ type: "varchar", default: "bcrypt" }),
165
+ __metadata("design:type", String)
166
+ ], User.prototype, "passwordScheme", void 0);
167
+ __decorate([
168
+ (0, typeorm_1.Column)({ type: "int", default: 1 }),
169
+ __metadata("design:type", Number)
170
+ ], User.prototype, "passwordSchemeVersion", void 0);
171
+ __decorate([
172
+ (0, typeorm_1.Column)({ type: "timestamp", nullable: true }),
173
+ __metadata("design:type", Date)
174
+ ], User.prototype, "rehashedAt", void 0);
163
175
  exports.User = User = __decorate([
164
176
  (0, typeorm_1.Entity)("ss_user"),
165
177
  (0, typeorm_1.TableInheritance)({ column: { type: "varchar", name: "type", default: "User" } }),
@@ -1 +1 @@
1
- {"version":3,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AA,0BAAM,GAAE;;2CACa;AAItB;IAHC,IAAA,oBAAU,EAAC,GAAG,EAAE,CAAC,mCAAY,EAAE,YAAY,CAAC,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IACrF,IAAA,mBAAS,GAAE;IACX,IAAA,0BAAM,GAAE;;mCACa;AAGtB;IAFC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,4CAAgB,EAAE,gBAAgB,CAAC,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;8CAE3D;eA9F5B,IAAI;IAHhB,IAAA,gBAAM,EAAC,SAAS,CAAC;IACjB,IAAA,0BAAgB,EAAC,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC;IAChF,IAAA,2BAAO,GAAE;GACG,IAAI,CA+FhB","sourcesContent":["import { CommonEntity } from \"src/entities/common.entity\"\nimport { Entity, Column, Index, JoinTable, ManyToMany, OneToMany, TableInheritance } from \"typeorm\";\nimport { RoleMetadata } from 'src/entities/role-metadata.entity';\nimport { UserViewMetadata } from 'src/entities/user-view-metadata.entity'\nimport { Exclude, Expose } from \"class-transformer\";\n\n@Entity(\"ss_user\")\n@TableInheritance({ column: { type: \"varchar\", name: \"type\", default: \"User\" } })\n@Exclude()\nexport class User extends CommonEntity {\n @Column({ type: \"varchar\", nullable: true })\n @Expose()\n fullName: string; \n @Index({ unique: true })\n @Column({ type: \"varchar\" })\n @Expose()\n username: string;\n @Index({ unique: true })\n @Column({ type: \"varchar\", nullable: true })\n @Expose()\n email: string;\n @Index({ unique: true })\n @Column({ type: \"varchar\", nullable: true })\n @Expose()\n mobile: string;\n @Column({ type: \"varchar\", nullable: true })\n // don't send to client\n password: string;\n @Column({ type: \"boolean\", nullable: true, default: true })\n @Expose()\n forcePasswordChange: boolean = true;\n @Column({ type: \"varchar\", default: \"local\" })\n // don't send to client\n lastLoginProvider: string = \"local\";\n @Column({ type: \"varchar\", nullable: true })\n // don't send to client (test)\n accessCode: string;\n @Column({ type: \"varchar\", nullable: true })\n // don't send to client\n googleAccessToken: string;\n @Column({ type: \"varchar\", nullable: true })\n // don't send to client\n googleId: string;\n @Column({ type: \"varchar\", nullable: true })\n // don't send to client\n googleProfilePicture: string;\n @Column({ type: \"boolean\", default: true })\n @Expose()\n active: boolean = true;\n @Column({ type: \"timestamp\", nullable: true })\n // don't send to client\n forgotPasswordConfirmedAt: Date;\n @Column({ type: \"varchar\", nullable: true })\n // don't send to client\n verificationTokenOnForgotPassword: string;\n @Column({ type: \"timestamp\", nullable: true })\n // don't send to client\n verificationTokenOnForgotPasswordExpiresAt: Date;\n @Column({ type: \"timestamp\", nullable: true })\n // don't send to client\n emailVerifiedOnRegistrationAt: Date;\n @Column({ type: \"varchar\", nullable: true })\n // don't send to client\n emailVerificationTokenOnRegistration: string;\n @Column({ type: \"timestamp\", nullable: true })\n // don't send to client\n emailVerificationTokenOnRegistrationExpiresAt: Date;\n @Column({ type: \"timestamp\", nullable: true })\n // don't send to client\n mobileVerifiedOnRegistrationAt: Date;\n @Column({ type: \"varchar\", nullable: true })\n // don't send to client\n mobileVerificationTokenOnRegistration: string;\n @Column({ type: \"timestamp\", nullable: true })\n // don't send to client\n mobileVerificationTokenOnRegistrationExpiresAt: Date;\n @Column({ type: \"timestamp\", nullable: true })\n // don't send to client\n emailVerifiedOnLoginAt: Date;\n @Column({ type: \"varchar\", nullable: true })\n // don't send to client\n emailVerificationTokenOnLogin: string;\n @Column({ type: \"timestamp\", nullable: true })\n // don't send to client\n emailVerificationTokenOnLoginExpiresAt: Date;\n @Column({ type: \"timestamp\", nullable: true })\n // don't send to client\n mobileVerifiedOnLoginAt: Date;\n @Column({ type: \"varchar\", nullable: true })\n // don't send to client\n mobileVerificationTokenOnLogin: string;\n @Column({ type: \"timestamp\", nullable: true })\n // don't send to client\n mobileVerificationTokenOnLoginExpiresAt: Date;\n @Column({ type: \"varchar\", nullable: true })\n @Expose()\n customPayload: string;\n @ManyToMany(() => RoleMetadata, roleMetadata => roleMetadata.users, { cascade: true })\n @JoinTable()\n @Expose()\n roles: RoleMetadata[];\n @OneToMany(() => UserViewMetadata, userViewMetadata => userViewMetadata.user, { cascade: true })\n // don't send to client\n userViewMetadata: UserViewMetadata[];\n}"]}
1
+ {"version":3,"file":"user.entity.js","sourceRoot":"","sources":["../../src/entities/user.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mDAAyD;AACzD,qCAAoG;AACpG,iEAAiE;AACjE,2EAAyE;AACzE,yDAAoD;AAK7C,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,4BAAY;IAA/B;;QAqBH,wBAAmB,GAAY,IAAI,CAAC;QAGpC,sBAAiB,GAAW,OAAO,CAAC;QAepC,WAAM,GAAY,IAAI,CAAC;KAiE1B;;2UAnFkC,IAAI,wWAkBjB,IAAI;;CAiEzB,CAAA;AAxGY,oBAAI;AAGb;IAFC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,0BAAM,GAAE;;sCACQ;AAIjB;IAHC,IAAA,eAAK,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACvB,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IAC3B,IAAA,0BAAM,GAAE;;sCACQ;AAIjB;IAHC,IAAA,eAAK,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACvB,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,0BAAM,GAAE;;mCACK;AAId;IAHC,IAAA,eAAK,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACvB,IAAA,gBAAM,EAAC,EAAE,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ntity } from \"src/entities/common.entity\"\nimport { Entity, Column, Index, JoinTable, ManyToMany, OneToMany, TableInheritance } from \"typeorm\";\nimport { RoleMetadata } from 'src/entities/role-metadata.entity';\nimport { UserViewMetadata } from 'src/entities/user-view-metadata.entity'\nimport { Exclude, Expose } from \"class-transformer\";\n\n@Entity(\"ss_user\")\n@TableInheritance({ column: { type: \"varchar\", name: \"type\", default: \"User\" } })\n@Exclude()\nexport class User extends CommonEntity {\n @Column({ type: \"varchar\", nullable: true })\n @Expose()\n fullName: string; \n @Index({ unique: true })\n @Column({ type: \"varchar\" })\n @Expose()\n username: string;\n @Index({ unique: true })\n @Column({ type: \"varchar\", nullable: true })\n @Expose()\n email: string;\n @Index({ unique: true })\n @Column({ type: \"varchar\", nullable: true })\n @Expose()\n mobile: string;\n @Column({ type: \"varchar\", nullable: true })\n // don't send to client\n password: string;\n @Column({ type: \"boolean\", nullable: true, default: true })\n @Expose()\n forcePasswordChange: boolean = true;\n @Column({ type: \"varchar\", default: \"local\" })\n // don't send to client\n lastLoginProvider: string = \"local\";\n @Column({ type: \"varchar\", nullable: true })\n // don't send to client (test)\n accessCode: string;\n @Column({ type: \"varchar\", nullable: true })\n // don't send to client\n googleAccessToken: string;\n @Column({ type: \"varchar\", nullable: true })\n // don't send to client\n googleId: string;\n @Column({ type: \"varchar\", nullable: true })\n // don't send to client\n googleProfilePicture: string;\n @Column({ type: \"boolean\", default: true })\n @Expose()\n active: boolean = true;\n @Column({ type: \"timestamp\", nullable: true })\n // don't send to client\n forgotPasswordConfirmedAt: Date;\n @Column({ type: \"varchar\", nullable: true })\n // don't send to client\n verificationTokenOnForgotPassword: string;\n @Column({ type: \"timestamp\", nullable: true })\n // don't send to client\n verificationTokenOnForgotPasswordExpiresAt: Date;\n @Column({ type: \"timestamp\", nullable: true })\n // don't send to client\n emailVerifiedOnRegistrationAt: Date;\n @Column({ type: \"varchar\", nullable: true })\n // don't send to client\n emailVerificationTokenOnRegistration: string;\n @Column({ type: \"timestamp\", nullable: true })\n // don't send to client\n emailVerificationTokenOnRegistrationExpiresAt: Date;\n @Column({ type: \"timestamp\", nullable: true })\n // don't send to client\n mobileVerifiedOnRegistrationAt: Date;\n @Column({ type: \"varchar\", nullable: true })\n // don't send to client\n mobileVerificationTokenOnRegistration: string;\n @Column({ type: \"timestamp\", nullable: true })\n // don't send to client\n mobileVerificationTokenOnRegistrationExpiresAt: Date;\n @Column({ type: \"timestamp\", nullable: true })\n // don't send to client\n emailVerifiedOnLoginAt: Date;\n @Column({ type: \"varchar\", nullable: true })\n // don't send to client\n emailVerificationTokenOnLogin: string;\n @Column({ type: \"timestamp\", nullable: true })\n // don't send to client\n emailVerificationTokenOnLoginExpiresAt: Date;\n @Column({ type: \"timestamp\", nullable: true })\n // don't send to client\n mobileVerifiedOnLoginAt: Date;\n @Column({ type: \"varchar\", nullable: true })\n // don't send to client\n mobileVerificationTokenOnLogin: string;\n @Column({ type: \"timestamp\", nullable: true })\n // don't send to client\n mobileVerificationTokenOnLoginExpiresAt: Date;\n @Column({ type: \"varchar\", nullable: true })\n @Expose()\n customPayload: string;\n @ManyToMany(() => RoleMetadata, roleMetadata => roleMetadata.users, { cascade: true })\n @JoinTable()\n @Expose()\n roles: RoleMetadata[];\n @OneToMany(() => UserViewMetadata, userViewMetadata => userViewMetadata.user, { cascade: true })\n // don't send to client\n userViewMetadata: UserViewMetadata[];\n // dont send to client\n @Column({ type: \"varchar\", default: \"bcrypt\" })\n passwordScheme: string;\n // dont send to client\n @Column({ type: \"int\", default: 1 })\n passwordSchemeVersion: number;\n // dont send to client\n @Column({ type: \"timestamp\", nullable: true })\n rehashedAt: Date;\n}"]}
@@ -1,4 +1,5 @@
1
1
  import { FieldCrudManager, ValidationError } from "src/interfaces";
2
+ import { HashingService } from "src/services/hashing.service";
2
3
  export interface PasswordFieldOptions {
3
4
  min: number | undefined | null;
4
5
  max: number | undefined | null;
@@ -6,10 +7,10 @@ export interface PasswordFieldOptions {
6
7
  regexPattern: string | undefined | null;
7
8
  fieldName: string | undefined | null;
8
9
  isUpdate: Boolean;
10
+ hashingService: HashingService | undefined | null;
9
11
  }
10
12
  export declare class PasswordFieldCrudManager implements FieldCrudManager {
11
13
  private readonly options;
12
- private hashingService;
13
14
  constructor(options: PasswordFieldOptions);
14
15
  validate(dto: any): ValidationError[];
15
16
  private applyValidations;
@@ -1 +1 @@
1
- {"version":3,"file":"PasswordFieldCrudManager.d.ts","sourceRoot":"","sources":["../../../src/helpers/field-crud-managers/PasswordFieldCrudManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAInE,MAAM,WAAW,oBAAoB;IACjC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAC/B,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAC/B,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC;IACrC,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IACxC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IACrC,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED,qBAAa,wBAAyB,YAAW,gBAAgB;IAGjD,OAAO,CAAC,QAAQ,CAAC,OAAO;IAFpC,OAAO,CAAC,cAAc,CAAuC;gBAEhC,OAAO,EAAE,oBAAoB;IAG1D,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,eAAe,EAAE;IAKrC,OAAO,CAAC,gBAAgB;IAYxB,OAAO,CAAC,sBAAsB;IAUxB,kBAAkB,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAQhD,OAAO,CAAC,oBAAoB;IAG5B,OAAO,CAAC,oBAAoB;IAG5B,OAAO,CAAC,eAAe;IAGvB,OAAO,CAAC,sBAAsB;IAM9B,OAAO,CAAC,yBAAyB;CAGpC"}
1
+ {"version":3,"file":"PasswordFieldCrudManager.d.ts","sourceRoot":"","sources":["../../../src/helpers/field-crud-managers/PasswordFieldCrudManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEnE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,MAAM,WAAW,oBAAoB;IACjC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAC/B,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAC/B,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC;IACrC,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IACxC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IACrC,QAAQ,EAAE,OAAO,CAAC;IAClB,cAAc,EAAE,cAAc,GAAG,SAAS,GAAG,IAAI,CAAC;CACrD;AAED,qBAAa,wBAAyB,YAAW,gBAAgB;IACjD,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,oBAAoB;IAG1D,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,eAAe,EAAE;IAKrC,OAAO,CAAC,gBAAgB;IAYxB,OAAO,CAAC,sBAAsB;IAUxB,kBAAkB,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAUhD,OAAO,CAAC,oBAAoB;IAG5B,OAAO,CAAC,oBAAoB;IAG5B,OAAO,CAAC,eAAe;IAGvB,OAAO,CAAC,sBAAsB;IAM9B,OAAO,CAAC,yBAAyB;CAGpC"}
@@ -2,11 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PasswordFieldCrudManager = void 0;
4
4
  const class_validator_1 = require("class-validator");
5
- const bcrypt_service_1 = require("../../services/bcrypt.service");
6
5
  class PasswordFieldCrudManager {
7
6
  constructor(options) {
8
7
  this.options = options;
9
- this.hashingService = new bcrypt_service_1.BcryptService();
10
8
  }
11
9
  validate(dto) {
12
10
  const fieldValue = dto[this.options.fieldName];
@@ -33,7 +31,9 @@ class PasswordFieldCrudManager {
33
31
  }
34
32
  async transformForCreate(dto) {
35
33
  if (dto[this.options.fieldName]) {
36
- dto[this.options.fieldName] = await this.hashingService.hash(dto[this.options.fieldName]);
34
+ dto[this.options.fieldName] = await this.options.hashingService.hash(dto[this.options.fieldName]);
35
+ dto['passwordScheme'] = this.options.hashingService.name();
36
+ dto['passwordHashVersion'] = this.options.hashingService.currentVersion();
37
37
  }
38
38
  return dto;
39
39
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PasswordFieldCrudManager.js","sourceRoot":"","sources":["../../../src/helpers/field-crud-managers/PasswordFieldCrudManager.ts"],"names":[],"mappings":";;;AAAA,qDAAmF;AAEnF,kEAA4D;AAY5D,MAAa,wBAAwB;IAGjC,YAA6B,OAA6B;QAA7B,YAAO,GAAP,OAAO,CAAsB;QAFlD,mBAAc,GAAmB,IAAI,8BAAa,EAAE,CAAC;IAG7D,CAAC;IAED,QAAQ,CAAC,GAAQ;QACb,MAAM,UAAU,GAAQ,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACpD,OAAO,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;IAClD,CAAC;IAEO,gBAAgB,CAAC,UAAe,EAAE,GAAQ;QAC9C,MAAM,MAAM,GAAsB,EAAE,CAAC;QACrC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,IAAI,IAAI,CAAC,yBAAyB,EAAE,IAAI,IAAA,yBAAO,EAAC,UAAU,CAAC,EAAE,CAAC;YACrF,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,EAAE,UAAU,IAAI,CAAC,OAAO,CAAC,SAAS,cAAc,EAAE,CAAC,CAAC;QAC1G,CAAC;QAED,IAAI,IAAA,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2DC","sourcesContent":["import { isEmpty, isNotEmpty, isString, matches, max, min } from \"class-validator\";\nimport { FieldCrudManager, ValidationError } from \"src/interfaces\";\nimport { BcryptService } from \"src/services/bcrypt.service\";\nimport { HashingService } from \"src/services/hashing.service\";\n\nexport interface PasswordFieldOptions {\n min: number | undefined | null;\n max: number | undefined | null;\n required: boolean | undefined | null;\n regexPattern: string | undefined | null;\n fieldName: string | undefined | null;\n isUpdate: Boolean;\n}\n\nexport class PasswordFieldCrudManager implements FieldCrudManager {\n private hashingService: HashingService = new BcryptService(); //FIXME: The bcrypt service injected here probably can be optimized to be a singleton\n\n constructor(private readonly options: PasswordFieldOptions) {\n }\n\n validate(dto: any): ValidationError[] {\n const fieldValue: any = dto[this.options.fieldName];\n return this.applyValidations(fieldValue, dto);\n }\n\n private applyValidations(fieldValue: any, dto: any): ValidationError[] {\n const errors: ValidationError[] = [];\n if (!this.options?.isUpdate && this.isApplyRequiredValidation() && isEmpty(fieldValue)) {\n errors.push({ field: this.options.fieldName, error: `Field: ${this.options.fieldName} is required` });\n }\n // this.isApplyRequiredValidation() && isEmpty(fieldValue) ? errors.push({ field: this.options.fieldName, error: `Field: ${this.options.fieldName} is required` }): \"no errors\";\n if (isNotEmpty(fieldValue)) {\n errors.push(...this.applyFormatValidations(fieldValue, dto));\n }\n return errors;\n }\n\n private applyFormatValidations(fieldValue: any, dto:any): ValidationError[] {\n const errors: ValidationError[] = [];\n !isString(fieldValue) ? errors.push({ field: this.options.fieldName, error: 'Field is not a string' }) : \"no errors\";\n !this.isPasswordValid(fieldValue) ? errors.push({ field: this.options.fieldName, error: 'Password regex pattern is invalid' }) : \"no errors\";\n this.isApplyMinValidation() && !min(fieldValue, this.options.min) ? errors.push({ field: this.options.fieldName, error: 'Field value is lesser than minimum required' }) : \"no errors\";\n this.isApplyMaxValidation() && !max(fieldValue, this.options.max) ? errors.push({ field: this.options.fieldName, error: 'Field value is greater than maximum required' }) : \"no errors\";\n !this.isConfirmPasswordValid(dto) ? errors.push({ field: this.options.fieldName, error: 'Password and confirm password do not match' }) : \"no errors\";\n return errors;\n }\n\n async transformForCreate(dto: any): Promise<any> {\n if(dto[this.options.fieldName]){\n dto[this.options.fieldName] = await this.hashingService.hash(dto[this.options.fieldName]);\n }\n return dto;\n }\n\n // Validation to be applied\n private isApplyMinValidation(): boolean {\n return this.options.min > 0;\n }\n private isApplyMaxValidation(): boolean {\n return this.options.max > 0;\n }\n private isPasswordValid(password: string): boolean {\n return matches(password, new RegExp(this.options.regexPattern ?? String.raw`^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[^\\da-zA-Z]).*$`)); \n }\n private isConfirmPasswordValid(dto: any): boolean {\n const passwordFieldName = this.options.fieldName;\n const confirmPasswordFieldName = `${passwordFieldName}Confirm`;\n return dto[passwordFieldName] === dto[confirmPasswordFieldName];\n }\n\n private isApplyRequiredValidation(): boolean {\n return this.options.required;\n }\n}"]}
1
+ {"version":3,"file":"PasswordFieldCrudManager.js","sourceRoot":"","sources":["../../../src/helpers/field-crud-managers/PasswordFieldCrudManager.ts"],"names":[],"mappings":";;;AAAA,qDAAmF;AAenF,MAAa,wBAAwB;IACjC,YAA6B,OAA6B;QAA7B,YAAO,GAAP,OAAO,CAAsB;IAC1D,CAAC;IAED,QAAQ,CAAC,GAAQ;QACb,MAAM,UAAU,GAAQ,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACpD,OAAO,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;IAClD,CAAC;IAEO,gBAAgB,CAAC,UAAe,EAAE,GAAQ;QAC9C,MAAM,MAAM,GAAsB,EAAE,CAAC;QACrC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,IAAI,IAAI,CAAC,yBAAyB,EAAE,IAAI,IAAA,yBAAO,EAAC,UAAU,CAAC,EAAE,CAAC;YACrF,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,CA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C;IACO,sBAAsB,CAAC,GAAQ;QACnC,MAAM,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;QACjD,MAAM,wBAAwB,GAAG,GAAG,iBAAiB,SAAS,CAAC;QAC/D,OAAO,GAAG,CAAC,iBAAiB,CAAC,KAAK,GAAG,CAAC,wBAAwB,CAAC,CAAC;IACpE,CAAC;IAEO,yBAAyB;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;IACjC,CAAC;CACJ;AA3DD,4DA2DC","sourcesContent":["import { isEmpty, isNotEmpty, isString, matches, max, min } from \"class-validator\";\nimport { FieldCrudManager, ValidationError } from \"src/interfaces\";\nimport { BcryptService } from \"src/services/bcrypt.service\";\nimport { HashingService } from \"src/services/hashing.service\";\n\nexport interface PasswordFieldOptions {\n min: number | undefined | null;\n max: number | undefined | null;\n required: boolean | undefined | null;\n regexPattern: string | undefined | null;\n fieldName: string | undefined | null;\n isUpdate: Boolean;\n hashingService: HashingService | undefined | null;\n}\n\nexport class PasswordFieldCrudManager implements FieldCrudManager {\n constructor(private readonly options: PasswordFieldOptions) {\n }\n\n validate(dto: any): ValidationError[] {\n const fieldValue: any = dto[this.options.fieldName];\n return this.applyValidations(fieldValue, dto);\n }\n\n private applyValidations(fieldValue: any, dto: any): ValidationError[] {\n const errors: ValidationError[] = [];\n if (!this.options?.isUpdate && this.isApplyRequiredValidation() && isEmpty(fieldValue)) {\n errors.push({ field: this.options.fieldName, error: `Field: ${this.options.fieldName} is required` });\n }\n // this.isApplyRequiredValidation() && isEmpty(fieldValue) ? errors.push({ field: this.options.fieldName, error: `Field: ${this.options.fieldName} is required` }): \"no errors\";\n if (isNotEmpty(fieldValue)) {\n errors.push(...this.applyFormatValidations(fieldValue, dto));\n }\n return errors;\n }\n\n private applyFormatValidations(fieldValue: any, dto:any): ValidationError[] {\n const errors: ValidationError[] = [];\n !isString(fieldValue) ? errors.push({ field: this.options.fieldName, error: 'Field is not a string' }) : \"no errors\";\n !this.isPasswordValid(fieldValue) ? errors.push({ field: this.options.fieldName, error: 'Password regex pattern is invalid' }) : \"no errors\";\n this.isApplyMinValidation() && !min(fieldValue, this.options.min) ? errors.push({ field: this.options.fieldName, error: 'Field value is lesser than minimum required' }) : \"no errors\";\n this.isApplyMaxValidation() && !max(fieldValue, this.options.max) ? errors.push({ field: this.options.fieldName, error: 'Field value is greater than maximum required' }) : \"no errors\";\n !this.isConfirmPasswordValid(dto) ? errors.push({ field: this.options.fieldName, error: 'Password and confirm password do not match' }) : \"no errors\";\n return errors;\n }\n\n async transformForCreate(dto: any): Promise<any> {\n if(dto[this.options.fieldName]){\n dto[this.options.fieldName] = await this.options.hashingService.hash(dto[this.options.fieldName]);\n dto['passwordScheme'] = this.options.hashingService.name(); //Don't want to expose this in dto // e.g., 'bcrypt'\n dto['passwordHashVersion'] = this.options.hashingService.currentVersion(); //Don't want to expose this in dto // e.g., 1, 2, ...\n }\n return dto;\n }\n\n // Validation to be applied\n private isApplyMinValidation(): boolean {\n return this.options.min > 0;\n }\n private isApplyMaxValidation(): boolean {\n return this.options.max > 0;\n }\n private isPasswordValid(password: string): boolean {\n return matches(password, new RegExp(this.options.regexPattern ?? String.raw`^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[^\\da-zA-Z]).*$`)); \n }\n private isConfirmPasswordValid(dto: any): boolean {\n const passwordFieldName = this.options.fieldName;\n const confirmPasswordFieldName = `${passwordFieldName}Confirm`;\n return dto[passwordFieldName] === dto[confirmPasswordFieldName];\n }\n\n private isApplyRequiredValidation(): boolean {\n return this.options.required;\n }\n}"]}
@@ -22,7 +22,7 @@ let LocalStrategy = class LocalStrategy extends (0, passport_1.PassportStrategy)
22
22
  this.userService = userService;
23
23
  }
24
24
  async validate(username, password) {
25
- const user = await this.authService.validateUser({ username, password, email: null });
25
+ const user = await this.authService.validateUserAndRehashPasswordIfRequired({ username, password, email: null });
26
26
  if (!user) {
27
27
  throw new common_1.UnauthorizedException();
28
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"local.strategy.js","sourceRoot":"","sources":["../../src/passport-strategies/local.strategy.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mDAA0C;AAC1C,+CAA+D;AAC/D,2CAAmE;AACnE,+EAA2E;AAC3E,2DAAuD;AAIhD,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,IAAA,2BAAgB,EAAC,yBAAQ,CAAC;IACzD,YACY,WAAkC,EAClC,WAAwB;QAEhC,KAAK,EAAE,CAAC;QAHA,gBAAW,GAAX,WAAW,CAAuB;QAClC,gBAAW,GAAX,WAAW,CAAa;IAGpC,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,QAAgB,EAAE,QAAgB;QAC7C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACtF,IAAI,CAAC,IAAI,EAAE,CAAC;YACR,MAAM,IAAI,8BAAqB,EAAE,CAAC;QACtC,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ,CAAA;AAfY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;qCAGgB,8CAAqB;QACrB,0BAAW;GAH3B,aAAa,CAezB;AAIM,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,IAAA,oBAAS,EAAC,OAAO,CAAC;CAAI,CAAA;AAA7C,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;GACA,cAAc,CAA+B","sourcesContent":["import { Strategy } from 'passport-local';\nimport { AuthGuard, PassportStrategy } from '@nestjs/passport';\nimport { Injectable, UnauthorizedException } from '@nestjs/common';\nimport { AuthenticationService } from '../services/authentication.service';\nimport { UserService } from '../services/user.service';\n\n\n@Injectable()\nexport class LocalStrategy extends PassportStrategy(Strategy) {\n constructor(\n private authService: AuthenticationService,\n private userService: UserService,\n ) {\n super();\n }\n\n async validate(username: string, password: string): Promise<any> {\n const user = await this.authService.validateUser({ username, password, email: null });\n if (!user) {\n throw new UnauthorizedException();\n }\n return user;\n }\n}\n\n\n@Injectable()\nexport class LocalAuthGuard extends AuthGuard('local') { }\n"]}
1
+ {"version":3,"file":"local.strategy.js","sourceRoot":"","sources":["../../src/passport-strategies/local.strategy.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mDAA0C;AAC1C,+CAA+D;AAC/D,2CAAmE;AACnE,+EAA2E;AAC3E,2DAAuD;AAIhD,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,IAAA,2BAAgB,EAAC,yBAAQ,CAAC;IACzD,YACY,WAAkC,EAClC,WAAwB;QAEhC,KAAK,EAAE,CAAC;QAHA,gBAAW,GAAX,WAAW,CAAuB;QAClC,gBAAW,GAAX,WAAW,CAAa;IAGpC,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,QAAgB,EAAE,QAAgB;QAC7C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,uCAAuC,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACjH,IAAI,CAAC,IAAI,EAAE,CAAC;YACR,MAAM,IAAI,8BAAqB,EAAE,CAAC;QACtC,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ,CAAA;AAfY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;qCAGgB,8CAAqB;QACrB,0BAAW;GAH3B,aAAa,CAezB;AAIM,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,IAAA,oBAAS,EAAC,OAAO,CAAC;CAAI,CAAA;AAA7C,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;GACA,cAAc,CAA+B","sourcesContent":["import { Strategy } from 'passport-local';\nimport { AuthGuard, PassportStrategy } from '@nestjs/passport';\nimport { Injectable, UnauthorizedException } from '@nestjs/common';\nimport { AuthenticationService } from '../services/authentication.service';\nimport { UserService } from '../services/user.service';\n\n\n@Injectable()\nexport class LocalStrategy extends PassportStrategy(Strategy) {\n constructor(\n private authService: AuthenticationService,\n private userService: UserService,\n ) {\n super();\n }\n\n async validate(username: string, password: string): Promise<any> {\n const user = await this.authService.validateUserAndRehashPasswordIfRequired({ username, password, email: null });\n if (!user) {\n throw new UnauthorizedException();\n }\n return user;\n }\n}\n\n\n@Injectable()\nexport class LocalAuthGuard extends AuthGuard('local') { }\n"]}
@@ -2115,6 +2115,49 @@
2115
2115
  "relationCreateInverse": true,
2116
2116
  "relationModelModuleName": "solid-core",
2117
2117
  "isSystem": true
2118
+ },
2119
+ {
2120
+ "name": "passwordScheme",
2121
+ "displayName": "Password Scheme",
2122
+ "type": "selectionStatic",
2123
+ "ormType": "varchar",
2124
+ "length": 256,
2125
+ "required": true,
2126
+ "index": false,
2127
+ "isSystem": true,
2128
+ "columnName": "password_scheme",
2129
+ "defaultValue": "bcrypt",
2130
+ "selectionValueType": "string",
2131
+ "selectionStaticValues": [
2132
+ "bcrypt:bcrypt"
2133
+ ]
2134
+ },
2135
+ {
2136
+ "name": "passwordSchemeVersion",
2137
+ "displayName": "Password Scheme Version",
2138
+ "type": "int",
2139
+ "ormType": "integer",
2140
+ "length": 512,
2141
+ "required": true,
2142
+ "defaultValue": 1,
2143
+ "unique": false,
2144
+ "index": false,
2145
+ "private": false,
2146
+ "encrypt": false,
2147
+ "isSystem": true
2148
+ },
2149
+ {
2150
+ "name": "rehashedAt",
2151
+ "displayName": "Password Rehashed At",
2152
+ "type": "datetime",
2153
+ "ormType": "timestamp",
2154
+ "length": 512,
2155
+ "required": false,
2156
+ "unique": false,
2157
+ "index": false,
2158
+ "private": false,
2159
+ "encrypt": false,
2160
+ "isSystem": true
2118
2161
  }
2119
2162
  ]
2120
2163
  },
@@ -49,8 +49,9 @@ export declare class AuthenticationService {
49
49
  private getConfig;
50
50
  private getCompanyLogo;
51
51
  resolveUser(username: string, email: string): Promise<User>;
52
+ updatePasswordDetails(user: User, newPassword: string): Promise<User>;
52
53
  resolveUserByVerificationToken(token: string): Promise<User>;
53
- validateUser(signInDto: SignInDto): Promise<User>;
54
+ validateUserAndRehashPasswordIfRequired(signInDto: SignInDto): Promise<User>;
54
55
  signUp(signUpDto: SignUpDto, activeUser?: ActiveUserData): Promise<User>;
55
56
  signupForExtensionUser<T extends User, U extends CreateUserDto>(signUpDto: SignUpDto, extensionUserDto: U, extensionUserRepo: Repository<T>): Promise<T>;
56
57
  private populateForSignup;
@@ -1 +1 @@
1
- {"version":3,"file":"authentication.service.d.ts","sourceRoot":"","sources":["../../src/services/authentication.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAW5C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAKzC,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE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CrC,eAAe,CAAC,gBAAgB,EAAE,gBAAgB;;;;;;;;;;;;IA+DlD,cAAc,CAAC,iBAAiB,EAAE,iBAAiB,EAAE,UAAU,EAAE,cAAc;IAqDrF,OAAO,CAAC,2BAA2B;IAY7B,sBAAsB,CAAC,yBAAyB,EAAE,yBAAyB;;;;;;;;;;;YAkDnE,0BAA0B;IA0ClC,qBAAqB,CAAC,wBAAwB,EAAE,wBAAwB;;;;;;;YA8ChE,2BAA2B;IA2CnC,cAAc,CAAC,IAAI,EAAE,IAAI;;;;IAazB,mBAAmB,CAAC,IAAI,EAAE,IAAI;IAc9B,oBAAoB,CAAC,IAAI,EAAE,IAAI;IAa/B,aAAa,CAAC,eAAe,EAAE,eAAe;;;;YA+CtC,SAAS;IAgBjB,uBAAuB,CAAC,IAAI,EAAE,IAAI;IAkBlC,iBAAiB,CAAC,UAAU,EAAE,MAAM;;;;;;;;;;;YA8B5B,iCAAiC;IAWzC,MAAM;;;IAyBN,YAAY,CAAC,MAAM,EAAE,MAAM;IAS3B,EAAE,CAAC,UAAU,EAAE,cAAc;;;;;;;;;;;CAyBtC"}
@@ -86,13 +86,26 @@ let AuthenticationService = AuthenticationService_1 = class AuthenticationServic
86
86
  }
87
87
  });
88
88
  }
89
+ async updatePasswordDetails(user, newPassword) {
90
+ user.password = await this.hashingService.hash(newPassword);
91
+ user.passwordScheme = this.hashingService.name();
92
+ user.passwordSchemeVersion = this.hashingService.currentVersion();
93
+ user.rehashedAt = new Date();
94
+ await this.userRepository.update(user.id, {
95
+ password: user.password,
96
+ passwordScheme: user.passwordScheme,
97
+ passwordSchemeVersion: user.passwordSchemeVersion,
98
+ rehashedAt: user.rehashedAt
99
+ });
100
+ return user;
101
+ }
89
102
  async resolveUserByVerificationToken(token) {
90
103
  return await this.userRepository.findOne({
91
104
  where: { verificationTokenOnForgotPassword: token },
92
105
  relations: { roles: true }
93
106
  });
94
107
  }
95
- async validateUser(signInDto) {
108
+ async validateUserAndRehashPasswordIfRequired(signInDto) {
96
109
  const user = await this.resolveUser(signInDto.username, signInDto.email);
97
110
  if (!user) {
98
111
  throw new common_1.UnauthorizedException(error_messages_1.ERROR_MESSAGES.INVALID_CREDENTIALS);
@@ -100,10 +113,14 @@ let AuthenticationService = AuthenticationService_1 = class AuthenticationServic
100
113
  if (!user.active) {
101
114
  throw new common_1.UnauthorizedException(error_messages_1.ERROR_MESSAGES.USER_NOT_ACTIVE);
102
115
  }
103
- const isEqual = await this.hashingService.compare(signInDto.password, user.password);
116
+ const isEqual = await this.hashingService.compare(signInDto.password, user.password, user.passwordSchemeVersion);
104
117
  if (!isEqual) {
105
118
  throw new common_1.UnauthorizedException(error_messages_1.ERROR_MESSAGES.INVALID_CREDENTIALS);
106
119
  }
120
+ if (this.hashingService.needsRehash(user.password, user.passwordSchemeVersion)) {
121
+ const rehashedUser = await this.updatePasswordDetails(user, signInDto.password);
122
+ return rehashedUser;
123
+ }
107
124
  return user;
108
125
  }
109
126
  async signUp(signUpDto, activeUser = null) {
@@ -181,6 +198,8 @@ let AuthenticationService = AuthenticationService_1 = class AuthenticationServic
181
198
  }
182
199
  }
183
200
  user.password = pwd;
201
+ user.passwordScheme = this.hashingService.name();
202
+ user.passwordSchemeVersion = this.hashingService.currentVersion();
184
203
  user.active = isUserActive;
185
204
  return { user, pwd, autoGeneratedPwd };
186
205
  }
@@ -408,7 +427,7 @@ let AuthenticationService = AuthenticationService_1 = class AuthenticationServic
408
427
  };
409
428
  }
410
429
  async signIn(signInDto) {
411
- const user = await this.validateUser(signInDto);
430
+ const user = await this.validateUserAndRehashPasswordIfRequired(signInDto);
412
431
  const tokens = await this.generateTokens(user);
413
432
  await this.userActivityHistoryService.logEvent('login', user);
414
433
  return {
@@ -572,12 +591,14 @@ let AuthenticationService = AuthenticationService_1 = class AuthenticationServic
572
591
  if (!(user.username === activeUser.username)) {
573
592
  throw new common_1.BadRequestException(error_messages_1.ERROR_MESSAGES.USERNAME_MISMATCH);
574
593
  }
575
- const isEqual = await this.hashingService.compare(changePasswordDto.currentPassword, user.password);
594
+ const isEqual = await this.hashingService.compare(changePasswordDto.currentPassword, user.password, user.passwordSchemeVersion);
576
595
  if (!isEqual) {
577
596
  throw new common_1.UnauthorizedException(error_messages_1.ERROR_MESSAGES.INCORRECT_CURRENT_PASSWORD);
578
597
  }
579
598
  const newPwd = await this.hashingService.hash(changePasswordDto.newPassword);
580
599
  user.password = changePasswordDto.newPassword;
600
+ user.passwordScheme = this.hashingService.name();
601
+ user.passwordSchemeVersion = this.hashingService.currentVersion();
581
602
  user.forcePasswordChange = false;
582
603
  user.password = newPwd;
583
604
  await this.userRepository.save(user);
@@ -673,7 +694,9 @@ let AuthenticationService = AuthenticationService_1 = class AuthenticationServic
673
694
  throw new common_1.UnauthorizedException(error_messages_1.ERROR_MESSAGES.INVALID_CREDENTIALS);
674
695
  }
675
696
  const pwdHash = await this.hashingService.hash(confirmForgotPasswordDto.password);
676
- await m.getRepository(user_entity_1.User).update({ id: user.id }, { password: pwdHash });
697
+ const pwdScheme = this.hashingService.name();
698
+ const pwdSchemeVersion = this.hashingService.currentVersion();
699
+ await m.getRepository(user_entity_1.User).update({ id: user.id }, { password: pwdHash, passwordScheme: pwdScheme, passwordSchemeVersion: pwdSchemeVersion });
677
700
  this.notifyUserOnPasswordChanged(user);
678
701
  return {
679
702
  status: 'success',