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