main
parent
11af12a806
commit
8135650344
@ -0,0 +1,22 @@ |
|||||||
|
{ |
||||||
|
// IntelliSense를 사용하여 가능한 특성에 대해 알아보세요. |
||||||
|
// 기존 특성에 대한 설명을 보려면 가리킵니다. |
||||||
|
// 자세한 내용을 보려면 https://go.microsoft.com/fwlink/?linkid=830387을(를) 방문하세요. |
||||||
|
"version": "0.2.0", |
||||||
|
"configurations": [ |
||||||
|
{ |
||||||
|
"type": "node", |
||||||
|
"request": "launch", |
||||||
|
"name": "Debug NestJS", // 디버깅 이름 |
||||||
|
"runtimeExecutable": "npm", // 실행 인터프리터 |
||||||
|
"runtimeArgs": [ |
||||||
|
// npm run start:debug |
||||||
|
"run", |
||||||
|
"start:debug", |
||||||
|
], |
||||||
|
"console": "integratedTerminal", // 터미널로 셋팅 |
||||||
|
"restart": true, |
||||||
|
"autoAttachChildProcesses": true |
||||||
|
} |
||||||
|
] |
||||||
|
} |
@ -1 +1 @@ |
|||||||
{"version":3,"file":"auth.controller.js","sourceRoot":"","sources":["../../src/auth/auth.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAwD;AACxD,iDAA6C;AAC7C,kEAA8D;AAC9D,yDAA2D;AAGpD,IAAM,cAAc,GAApB,MAAM,cAAc;IACM;IAA7B,YAA6B,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAAG,CAAC;IAGnD,AAAN,KAAK,CAAC,MAAM,CAAS,GAAkB;QACnC,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACxC,CAAC;IAGK,AAAN,KAAK,CAAC,KAAK,CAAS,GAAiB;QACjC,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACvC,CAAC;CACJ,CAAA;AAZY,wCAAc;AAIjB;IADL,IAAA,aAAI,EAAC,QAAQ,CAAC;IACD,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAM,+BAAa;;4CAEtC;AAGK;IADL,IAAA,aAAI,EAAC,OAAO,CAAC;IACD,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAM,6BAAY;;2CAEpC;yBAXQ,cAAc;IAD1B,IAAA,mBAAU,EAAC,MAAM,CAAC;qCAE2B,0BAAW;GAD5C,cAAc,CAY1B"} |
{"version":3,"file":"auth.controller.js","sourceRoot":"","sources":["../../src/auth/auth.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAwD;AACxD,iDAA6C;AAC7C,kEAA8D;AAC9D,yDAA2D;AAGpD,IAAM,cAAc,GAApB,MAAM,cAAc;IACM;IAA7B,YAA6B,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAAG,CAAC;IAGnD,AAAN,KAAK,CAAC,MAAM,CAAS,GAAkB;QACnC,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC9C,CAAC;IAGK,AAAN,KAAK,CAAC,KAAK,CAAS,GAAiB;QACjC,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC7C,CAAC;CACJ,CAAA;AAZY,wCAAc;AAIjB;IADL,IAAA,aAAI,EAAC,QAAQ,CAAC;IACD,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAM,+BAAa;;4CAEtC;AAGK;IADL,IAAA,aAAI,EAAC,OAAO,CAAC;IACD,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAM,6BAAY;;2CAEpC;yBAXQ,cAAc;IAD1B,IAAA,mBAAU,EAAC,MAAM,CAAC;qCAE2B,0BAAW;GAD5C,cAAc,CAY1B"} |
@ -1 +1 @@ |
|||||||
{"version":3,"file":"auth.module.js","sourceRoot":"","sources":["../../src/auth/auth.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,iDAA6C;AAC7C,uDAAmD;AACnD,wDAAqD;AACrD,qCAAwC;AACxC,2CAA6D;AAC7D,+CAAkD;AAqB3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AM,EAAE,CAAC,CAAC;IACrE,CAAC;CACJ,CAAA;AA7BY,kCAAW;sBAAX,WAAW;IADvB,IAAA,mBAAU,GAAE;qCAEwB,4BAAY,EAAsB,gBAAU;GADpE,WAAW,CA6BvB"} |
@ -0,0 +1,4 @@ |
|||||||
|
declare const JwtAuthGuard_base: import("@nestjs/passport").Type<import("@nestjs/passport").IAuthGuard>; |
||||||
|
export declare class JwtAuthGuard extends JwtAuthGuard_base { |
||||||
|
} |
||||||
|
export {}; |
@ -0,0 +1,18 @@ |
|||||||
|
"use strict"; |
||||||
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { |
||||||
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; |
||||||
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); |
||||||
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; |
||||||
|
return c > 3 && r && Object.defineProperty(target, key, r), r; |
||||||
|
}; |
||||||
|
Object.defineProperty(exports, "__esModule", { value: true }); |
||||||
|
exports.JwtAuthGuard = void 0; |
||||||
|
const common_1 = require("@nestjs/common"); |
||||||
|
const passport_1 = require("@nestjs/passport"); |
||||||
|
let JwtAuthGuard = class JwtAuthGuard extends (0, passport_1.AuthGuard)('jwt') { |
||||||
|
}; |
||||||
|
exports.JwtAuthGuard = JwtAuthGuard; |
||||||
|
exports.JwtAuthGuard = JwtAuthGuard = __decorate([ |
||||||
|
(0, common_1.Injectable)() |
||||||
|
], JwtAuthGuard); |
||||||
|
//# sourceMappingURL=jwt-auth.guard.js.map
|
@ -0,0 +1 @@ |
|||||||
|
{"version":3,"file":"jwt-auth.guard.js","sourceRoot":"","sources":["../../src/auth/jwt-auth.guard.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAC5C,+CAA6C;AAGtC,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,IAAA,oBAAS,EAAC,KAAK,CAAC;CAAG,CAAA;AAAxC,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;GACA,YAAY,CAA4B"} |
@ -0,0 +1,10 @@ |
|||||||
|
import { ConfigService } from '@nestjs/config'; |
||||||
|
declare const JwtStrategy_base: new (...args: any) => any; |
||||||
|
export declare class JwtStrategy extends JwtStrategy_base { |
||||||
|
constructor(config: ConfigService); |
||||||
|
validate(payload: any): Promise<{ |
||||||
|
userId: any; |
||||||
|
username: any; |
||||||
|
}>; |
||||||
|
} |
||||||
|
export {}; |
@ -0,0 +1,34 @@ |
|||||||
|
"use strict"; |
||||||
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { |
||||||
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; |
||||||
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); |
||||||
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; |
||||||
|
return c > 3 && r && Object.defineProperty(target, key, r), r; |
||||||
|
}; |
||||||
|
var __metadata = (this && this.__metadata) || function (k, v) { |
||||||
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); |
||||||
|
}; |
||||||
|
Object.defineProperty(exports, "__esModule", { value: true }); |
||||||
|
exports.JwtStrategy = void 0; |
||||||
|
const common_1 = require("@nestjs/common"); |
||||||
|
const passport_1 = require("@nestjs/passport"); |
||||||
|
const passport_jwt_1 = require("passport-jwt"); |
||||||
|
const config_1 = require("@nestjs/config"); |
||||||
|
let JwtStrategy = class JwtStrategy extends (0, passport_1.PassportStrategy)(passport_jwt_1.Strategy) { |
||||||
|
constructor(config) { |
||||||
|
super({ |
||||||
|
jwtFromRequest: passport_jwt_1.ExtractJwt.fromAuthHeaderAsBearerToken(), |
||||||
|
ignoreExpiration: false, |
||||||
|
secretOrKey: config.get('JWT_SECRET'), |
||||||
|
}); |
||||||
|
} |
||||||
|
async validate(payload) { |
||||||
|
return { userId: payload.sub, username: payload.username }; |
||||||
|
} |
||||||
|
}; |
||||||
|
exports.JwtStrategy = JwtStrategy; |
||||||
|
exports.JwtStrategy = JwtStrategy = __decorate([ |
||||||
|
(0, common_1.Injectable)(), |
||||||
|
__metadata("design:paramtypes", [config_1.ConfigService]) |
||||||
|
], JwtStrategy); |
||||||
|
//# sourceMappingURL=jwt.stratedy.js.map
|
@ -0,0 +1 @@ |
|||||||
|
{"version":3,"file":"jwt.stratedy.js","sourceRoot":"","sources":["../../src/auth/jwt.stratedy.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,+CAAoD;AACpD,+CAAoD;AACpD,2CAA+C;AAGxC,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,IAAA,2BAAgB,EAAC,uBAAQ,CAAC;IACzD,YAAY,MAAqB;QAC/B,KAAK,CAAC;YACJ,cAAc,EAAE,yBAAU,CAAC,2BAA2B,EAAE;YACxD,gBAAgB,EAAE,KAAK;YACvB,WAAW,EAAE,MAAM,CAAC,GAAG,CAAS,YAAY,CAAC;SAC9C,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,OAAY;QACzB,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC;IAC7D,CAAC;CACF,CAAA;AAZY,kCAAW;sBAAX,WAAW;IADvB,IAAA,mBAAU,GAAE;qCAES,sBAAa;GADtB,WAAW,CAYvB"} |
File diff suppressed because one or more lines are too long
@ -0,0 +1,4 @@ |
|||||||
|
export declare class ChangePasswordDto { |
||||||
|
readonly currentPassword: string; |
||||||
|
readonly newPassword: string; |
||||||
|
} |
@ -0,0 +1,28 @@ |
|||||||
|
"use strict"; |
||||||
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { |
||||||
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; |
||||||
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); |
||||||
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; |
||||||
|
return c > 3 && r && Object.defineProperty(target, key, r), r; |
||||||
|
}; |
||||||
|
var __metadata = (this && this.__metadata) || function (k, v) { |
||||||
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); |
||||||
|
}; |
||||||
|
Object.defineProperty(exports, "__esModule", { value: true }); |
||||||
|
exports.ChangePasswordDto = void 0; |
||||||
|
const class_validator_1 = require("class-validator"); |
||||||
|
class ChangePasswordDto { |
||||||
|
currentPassword; |
||||||
|
newPassword; |
||||||
|
} |
||||||
|
exports.ChangePasswordDto = ChangePasswordDto; |
||||||
|
__decorate([ |
||||||
|
(0, class_validator_1.IsString)(), |
||||||
|
__metadata("design:type", String) |
||||||
|
], ChangePasswordDto.prototype, "currentPassword", void 0); |
||||||
|
__decorate([ |
||||||
|
(0, class_validator_1.IsString)(), |
||||||
|
(0, class_validator_1.MinLength)(4), |
||||||
|
__metadata("design:type", String) |
||||||
|
], ChangePasswordDto.prototype, "newPassword", void 0); |
||||||
|
//# sourceMappingURL=change-password.dto.js.map
|
@ -0,0 +1 @@ |
|||||||
|
{"version":3,"file":"change-password.dto.js","sourceRoot":"","sources":["../../../src/users/dto/change-password.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA2E;AAE3E,MAAa,iBAAiB;IAEjB,eAAe,CAAS;IAIxB,WAAW,CAAS;CAChC;AAPD,8CAOC;AALY;IADR,IAAA,0BAAQ,GAAE;;0DACsB;AAIxB;IAFR,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,EAAC,CAAC,CAAC;;sDACgB"} |
@ -0,0 +1,7 @@ |
|||||||
|
import { UsersService } from './users.service'; |
||||||
|
import { ChangePasswordDto } from './dto/change-password.dto'; |
||||||
|
export declare class UsersController { |
||||||
|
private readonly userService; |
||||||
|
constructor(userService: UsersService); |
||||||
|
changePassword(req: any, dto: ChangePasswordDto): Promise<void>; |
||||||
|
} |
@ -0,0 +1,42 @@ |
|||||||
|
"use strict"; |
||||||
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { |
||||||
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; |
||||||
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); |
||||||
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; |
||||||
|
return c > 3 && r && Object.defineProperty(target, key, r), r; |
||||||
|
}; |
||||||
|
var __metadata = (this && this.__metadata) || function (k, v) { |
||||||
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); |
||||||
|
}; |
||||||
|
var __param = (this && this.__param) || function (paramIndex, decorator) { |
||||||
|
return function (target, key) { decorator(target, key, paramIndex); } |
||||||
|
}; |
||||||
|
Object.defineProperty(exports, "__esModule", { value: true }); |
||||||
|
exports.UsersController = void 0; |
||||||
|
const common_1 = require("@nestjs/common"); |
||||||
|
const users_service_1 = require("./users.service"); |
||||||
|
const change_password_dto_1 = require("./dto/change-password.dto"); |
||||||
|
let UsersController = class UsersController { |
||||||
|
userService; |
||||||
|
constructor(userService) { |
||||||
|
this.userService = userService; |
||||||
|
} |
||||||
|
async changePassword(req, dto) { |
||||||
|
console.log("dd"); |
||||||
|
return await this.userService.changePassword(req.user.userId, dto); |
||||||
|
} |
||||||
|
}; |
||||||
|
exports.UsersController = UsersController; |
||||||
|
__decorate([ |
||||||
|
(0, common_1.Patch)('password'), |
||||||
|
__param(0, (0, common_1.Request)()), |
||||||
|
__param(1, (0, common_1.Body)()), |
||||||
|
__metadata("design:type", Function), |
||||||
|
__metadata("design:paramtypes", [Object, change_password_dto_1.ChangePasswordDto]), |
||||||
|
__metadata("design:returntype", Promise) |
||||||
|
], UsersController.prototype, "changePassword", null); |
||||||
|
exports.UsersController = UsersController = __decorate([ |
||||||
|
(0, common_1.Controller)('users'), |
||||||
|
__metadata("design:paramtypes", [users_service_1.UsersService]) |
||||||
|
], UsersController); |
||||||
|
//# sourceMappingURL=users.controller.js.map
|
@ -0,0 +1 @@ |
|||||||
|
{"version":3,"file":"users.controller.js","sourceRoot":"","sources":["../../src/users/users.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAkE;AAClE,mDAA+C;AAC/C,mEAA8D;AAGvD,IAAM,eAAe,GAArB,MAAM,eAAe;IACK;IAA7B,YAA6B,WAAyB;QAAzB,gBAAW,GAAX,WAAW,CAAc;IAAG,CAAC;IAGpD,AAAN,KAAK,CAAC,cAAc,CAAY,GAAG,EAAU,GAAsB;QAC/D,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAClB,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACvE,CAAC;CACJ,CAAA;AARY,0CAAe;AAIlB;IADL,IAAA,cAAK,EAAC,UAAU,CAAC;IACI,WAAA,IAAA,gBAAO,GAAE,CAAA;IAAO,WAAA,IAAA,aAAI,GAAE,CAAA;;6CAAM,uCAAiB;;qDAGlE;0BAPQ,eAAe;IAD3B,IAAA,mBAAU,EAAC,OAAO,CAAC;qCAE0B,4BAAY;GAD7C,eAAe,CAQ3B"} |
@ -1 +1 @@ |
|||||||
{"version":3,"file":"users.module.js","sourceRoot":"","sources":["../../src/users/users.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,mDAA+C;AAC/C,6CAAgD;AAChD,+CAAqC;AAQ9B,IAAM,WAAW,GAAjB,MAAM,WAAW;CAAG,CAAA;AAAd,kCAAW;sBAAX,WAAW;IANvB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,uBAAa,CAAC,UAAU,CAAC,CAAC,kBAAI,CAAC,CAAC,CAAC;QAC3C,SAAS,EAAE,CAAC,4BAAY,CAAC;QACzB,WAAW,EAAE,EAAE;QACf,OAAO,EAAE,CAAC,4BAAY,CAAC;KACxB,CAAC;GACW,WAAW,CAAG"} |
{"version":3,"file":"users.module.js","sourceRoot":"","sources":["../../src/users/users.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,mDAA+C;AAC/C,6CAAgD;AAChD,+CAAqC;AACrC,yDAAqD;AAQ9C,IAAM,WAAW,GAAjB,MAAM,WAAW;CAAG,CAAA;AAAd,kCAAW;sBAAX,WAAW;IANvB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,uBAAa,CAAC,UAAU,CAAC,CAAC,kBAAI,CAAC,CAAC,CAAC;QAC3C,SAAS,EAAE,CAAC,4BAAY,CAAC;QACzB,WAAW,EAAE,CAAC,kCAAe,CAAC;QAC9B,OAAO,EAAE,CAAC,4BAAY,CAAC;KACxB,CAAC;GACW,WAAW,CAAG"} |
@ -1,10 +1,12 @@ |
|||||||
import { User } from './user.entity'; |
import { User } from './user.entity'; |
||||||
import { Repository } from 'typeorm'; |
import { Repository } from 'typeorm'; |
||||||
import { CreateUserDto } from './dto/create-user.dto'; |
import { CreateUserDto } from './dto/create-user.dto'; |
||||||
|
import { ChangePasswordDto } from './dto/change-password.dto'; |
||||||
export declare class UsersService { |
export declare class UsersService { |
||||||
private repo; |
private repo; |
||||||
constructor(repo: Repository<User>); |
constructor(repo: Repository<User>); |
||||||
findByName(name: string): Promise<User | null>; |
findByName(name: string): Promise<User | null>; |
||||||
findByEmail(email: string): Promise<User | null>; |
findByEmail(email: string): Promise<User | null>; |
||||||
create(dto: CreateUserDto): Promise<User>; |
create(dto: CreateUserDto): Promise<User>; |
||||||
|
changePassword(userId: number, dto: ChangePasswordDto): Promise<void>; |
||||||
} |
} |
||||||
|
@ -1 +1 @@ |
|||||||
{"version":3,"file":"users.service.js","sourceRoot":"","sources":["../../src/users/users.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAiE;AACjE,6CAAmD;AACnD,+CAAqC;AACrC,qCAAqC;AAI9B,IAAM,YAAY,GAAlB,MAAM,YAAY;IACuB;IAA5C,YAA4C,IAAsB;QAAtB,SAAI,GAAJ,IAAI,CAAkB;IAAG,CAAC;IAEtE,KAAK,CAAC,UAAU,CAAC,IAAY;QACzB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAC,CAAC,CAAC;IACjD,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,KAAa;QAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAC,CAAC,CAAC;IAClD,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAkB;QAC3B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACjD,IAAI,QAAQ;YAAE,MAAM,IAAI,4BAAmB,CAAC,oBAAoB,CAAC,CAAC;QAElE,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;CACJ,CAAA;AAlBY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;IAEI,WAAA,IAAA,0BAAgB,EAAC,kBAAI,CAAC,CAAA;qCAAe,oBAAU;GADnD,YAAY,CAkBxB"} |
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C,GAAG,CAAC,eAAe,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC/E,IAAI,CAAC,aAAa;YAAE,MAAM,IAAI,4BAAmB,CAAC,sBAAsB,CAAC,CAAC;QAE1E,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QACtD,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC;QAEvB,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;CACJ,CAAA;AA/BY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;IAEI,WAAA,IAAA,0BAAgB,EAAC,kBAAI,CAAC,CAAA;qCAAe,oBAAU;GADnD,YAAY,CA+BxB"} |
@ -0,0 +1,5 @@ |
|||||||
|
import { Injectable } from "@nestjs/common"; |
||||||
|
import { AuthGuard } from "@nestjs/passport"; |
||||||
|
|
||||||
|
@Injectable() |
||||||
|
export class JwtAuthGuard extends AuthGuard('jwt') {} |
@ -0,0 +1,19 @@ |
|||||||
|
import { Injectable } from '@nestjs/common'; |
||||||
|
import { PassportStrategy } from '@nestjs/passport'; |
||||||
|
import { ExtractJwt, Strategy } from 'passport-jwt'; |
||||||
|
import { ConfigService } from '@nestjs/config'; |
||||||
|
|
||||||
|
@Injectable() |
||||||
|
export class JwtStrategy extends PassportStrategy(Strategy) { |
||||||
|
constructor(config: ConfigService) { |
||||||
|
super({ |
||||||
|
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(), // Authorization: Bearer ...
|
||||||
|
ignoreExpiration: false, |
||||||
|
secretOrKey: config.get<string>('JWT_SECRET'), |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
async validate(payload: any) { |
||||||
|
return { userId: payload.sub, username: payload.username }; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,10 @@ |
|||||||
|
import { IsEmail, IsOptional, IsString, MinLength } from "class-validator"; |
||||||
|
|
||||||
|
export class ChangePasswordDto { |
||||||
|
@IsString() |
||||||
|
readonly currentPassword: string; |
||||||
|
|
||||||
|
@IsString() |
||||||
|
@MinLength(4) |
||||||
|
readonly newPassword: string; |
||||||
|
} |
@ -0,0 +1,18 @@ |
|||||||
|
import { Test, TestingModule } from '@nestjs/testing'; |
||||||
|
import { UsersController } from './users.controller'; |
||||||
|
|
||||||
|
describe('UsersController', () => { |
||||||
|
let controller: UsersController; |
||||||
|
|
||||||
|
beforeEach(async () => { |
||||||
|
const module: TestingModule = await Test.createTestingModule({ |
||||||
|
controllers: [UsersController], |
||||||
|
}).compile(); |
||||||
|
|
||||||
|
controller = module.get<UsersController>(UsersController); |
||||||
|
}); |
||||||
|
|
||||||
|
it('should be defined', () => { |
||||||
|
expect(controller).toBeDefined(); |
||||||
|
}); |
||||||
|
}); |
@ -0,0 +1,14 @@ |
|||||||
|
import { Body, Controller, Patch, Request } from '@nestjs/common'; |
||||||
|
import { UsersService } from './users.service'; |
||||||
|
import { ChangePasswordDto } from './dto/change-password.dto'; |
||||||
|
|
||||||
|
@Controller('users') |
||||||
|
export class UsersController { |
||||||
|
constructor(private readonly userService: UsersService) {} |
||||||
|
|
||||||
|
@Patch('password') |
||||||
|
async changePassword(@Request() req, @Body() dto: ChangePasswordDto) { |
||||||
|
console.log("dd"); |
||||||
|
return await this.userService.changePassword(req.user.userId, dto); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue