set password form

This commit is contained in:
peintnermax
2024-10-15 17:27:08 +02:00
parent 7cb23f93cd
commit 20b3c6bfc2
5 changed files with 227 additions and 26 deletions

View File

@@ -107,3 +107,25 @@ export async function sendPassword(command: UpdateSessionCommand) {
authMethods,
};
}
export async function changePassword(command: {
userId: string;
password: string;
}) {
// check for init state
const users = await listUsers({
loginName: command.loginName,
organizationId: command.organization,
});
if (
!users.details ||
users.details.totalResult !== BigInt(1) ||
!users.result[0].userId
) {
return { error: "Could not send Password Reset Link" };
}
const userId = users.result[0].userId;
return passwordReset(userId);
}