Add some sessions (#5052)

* Add AccountEdit

* Add PasswordChange

* Cleanup

* Add SessionService.accountImage

* Add SessionService.message

* Add SessionService.getUserInfo

* Lint
This commit is contained in:
Zach H 2024-06-14 23:06:50 -04:00 committed by GitHub
parent 34d70980e8
commit e2ab8db958
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 190 additions and 0 deletions

View file

@ -0,0 +1,22 @@
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');
}
});
}