reset password change profileId to keycloak
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m12s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m12s
This commit is contained in:
parent
58afa49fcd
commit
3163b701c9
1 changed files with 3 additions and 3 deletions
|
|
@ -816,20 +816,20 @@ export class KeycloakController extends Controller {
|
|||
|
||||
@Post("user/reset-password")
|
||||
@Security("bearerAuth", ["admin"])
|
||||
async resetUserPassword(@Request() req: RequestWithUser, @Body() body: { profileId: string }) {
|
||||
async resetUserPassword(@Request() req: RequestWithUser, @Body() body: { keycloak: string }) {
|
||||
if (!req.user.role.includes("ADMIN") && !req.user.role.includes("SUPER_ADMIN")) {
|
||||
throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ดำเนินการ");
|
||||
}
|
||||
|
||||
let profile: Profile | ProfileEmployee | null = await this.profileRepo.findOne({
|
||||
where: { id: body.profileId },
|
||||
where: { keycloak: body.keycloak },
|
||||
select: ["id", "keycloak", "birthDate", "firstName", "lastName", "citizenId"],
|
||||
});
|
||||
|
||||
let isEmployee = false;
|
||||
if (!profile) {
|
||||
profile = await this.profileEmpRepo.findOne({
|
||||
where: { id: body.profileId, employeeClass: "PERM" },
|
||||
where: { keycloak: body.keycloak, employeeClass: "PERM" },
|
||||
select: ["id", "keycloak", "birthDate", "firstName", "lastName", "citizenId"],
|
||||
});
|
||||
isEmployee = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue