accountService.changePassword() requires old and new password

This commit is contained in:
woodser 2023-02-21 10:55:28 -05:00
parent 6719324d9e
commit 5a7ec350ca
2 changed files with 19 additions and 7 deletions

View file

@ -301,9 +301,12 @@ export default class HavenoClient {
*
* @param {string} password - the new account password
*/
async changePassword(password: string): Promise<void> {
async changePassword(oldPassword: string, newPassword: string): Promise<void> {
try {
await this._accountClient.changePassword(new ChangePasswordRequest().setPassword(password), {password: this._password});
const request = new ChangePasswordRequest()
.setOldPassword(oldPassword)
.setNewPassword(newPassword);
await this._accountClient.changePassword(request, {password: this._password});
} catch (e: any) {
throw new HavenoError(e.message, e.code);
}