From 8203a2fdeb8733b1b815e5b8470ec001f7b4c1d3 Mon Sep 17 00:00:00 2001 From: Jeremy Letto Date: Mon, 31 Jan 2022 21:03:31 -0600 Subject: [PATCH] fix failed saltRequest (#4554) * fix failed saltRequest * improve requestSalt error handling Co-authored-by: Jeremy Letto --- .../src/websocket/commands/SessionCommands.ts | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/webclient/src/websocket/commands/SessionCommands.ts b/webclient/src/websocket/commands/SessionCommands.ts index 9ad77f61..742d8d27 100644 --- a/webclient/src/websocket/commands/SessionCommands.ts +++ b/webclient/src/websocket/commands/SessionCommands.ts @@ -162,18 +162,40 @@ export class SessionCommands { } } - break; + return; } case webClient.protobuf.controller.Response.ResponseCode.RespRegistrationRequired: { - SessionCommands.updateStatus(StatusEnum.DISCONNECTED, 'Login failed: incorrect username or password'); - SessionCommands.disconnect(); + SessionCommands.updateStatus(StatusEnum.DISCONNECTED, 'Login failed: registration required'); break; } default: { SessionCommands.updateStatus(StatusEnum.DISCONNECTED, 'Login failed: Unknown Reason'); - SessionCommands.disconnect(); } } + + switch (webClient.options.reason) { + case WebSocketConnectReason.REGISTER: { + SessionPersistence.registrationFailed('Failed to retrieve password salt'); + break; + } + + case WebSocketConnectReason.ACTIVATE_ACCOUNT: { + SessionPersistence.accountActivationFailed(); + break; + } + + case WebSocketConnectReason.PASSWORD_RESET: { + SessionPersistence.resetPasswordFailed(); + break; + } + + case WebSocketConnectReason.LOGIN: + default: { + SessionPersistence.loginFailed(); + } + } + + SessionCommands.disconnect(); }); }