Support HashedPassword workflow for logins (#4469)

* Support HashedPassword workflow for logins

* Address comments in PR
This commit is contained in:
Zach H 2021-11-13 11:37:13 -05:00 committed by GitHub
parent 45d86e7ab7
commit 43eee6b32e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 93 additions and 7 deletions

View file

@ -113,7 +113,7 @@ function removeFromList({ listName, userName }: RemoveFromListData) {
}
function serverIdentification(info: ServerIdentificationData) {
const { serverName, serverVersion, protocolVersion } = info;
const { serverName, serverVersion, protocolVersion, serverOptions } = info;
if (protocolVersion !== webClient.protocolVersion) {
SessionCommands.updateStatus(StatusEnum.DISCONNECTED, `Protocol version mismatch: ${protocolVersion}`);
@ -124,7 +124,12 @@ function serverIdentification(info: ServerIdentificationData) {
switch (webClient.options.reason) {
case WebSocketConnectReason.LOGIN:
SessionCommands.updateStatus(StatusEnum.LOGGING_IN, 'Logging In...');
SessionCommands.login();
// Intentional use of Bitwise operator b/c of how Servatrice Enums work
if (serverOptions & webClient.protobuf.controller.Event_ServerIdentification.ServerOptions.SupportsPasswordHash) {
SessionCommands.requestPasswordSalt();
} else {
SessionCommands.login();
}
break;
case WebSocketConnectReason.REGISTER:
SessionCommands.register();
@ -198,6 +203,7 @@ export interface ServerIdentificationData {
protocolVersion: number;
serverName: string;
serverVersion: string;
serverOptions: number;
}
export interface ServerMessageData {