no message

This commit is contained in:
kittapath 2025-02-21 11:49:04 +07:00
parent 6c67e490ae
commit c5e0fcc4f7
4 changed files with 54 additions and 1 deletions

View file

@ -31,6 +31,7 @@ import {
getUserCount,
enableStatus,
getUserByUsername,
changeUserPassword,
} from "../keycloak";
import { AppDataSource } from "../database/data-source";
import { Profile } from "../entities/Profile";
@ -812,4 +813,19 @@ export class KeycloakController extends Controller {
}
return result;
}
@Post("user/change-password")
async changeUserPassword(
@Request() request: { user: { sub: string; preferred_username: string } },
@Body()
body: {
password: string;
},
) {
const result = await changeUserPassword(request.user.sub, body.password);
if (!result) {
throw new Error("Failed. Cannot change password.");
}
return result;
}
}