Cockatrice/webclient/src/websocket/commands/session/accountPassword.ts
Zach H c4bf9eb61c
Cleanup (#5057)
* Add Types

* Add Types
2024-06-17 00:32:36 -04:00

19 lines
781 B
TypeScript

import webClient from '../../WebClient';
import { SessionPersistence } from '../../persistence';
export function accountPassword(oldPassword: string, newPassword: string, hashedNewPassword: string): void {
const command = webClient.protobuf.controller.Command_AccountPassword.create({ oldPassword, newPassword, hashedNewPassword });
const sc = webClient.protobuf.controller.SessionCommand.create({ '.Command_AccountPassword.ext': command });
webClient.protobuf.sendSessionCommand(sc, raw => {
const { responseCode } = raw;
switch (responseCode) {
case webClient.protobuf.controller.Response.ResponseCode.RespOk:
SessionPersistence.accountPasswordChange();
break;
default:
console.log('Failed to change password');
}
});
}