mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Support HashedPassword workflow for logins (#4469)
* Support HashedPassword workflow for logins * Address comments in PR
This commit is contained in:
parent
45d86e7ab7
commit
43eee6b32e
8 changed files with 93 additions and 7 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue