From b52e27a9534fbc74d97d8aee9ee6d2ce47e35d13 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Tue, 10 Sep 2019 18:26:33 -0700 Subject: [PATCH] Fix rate limit on signup fail. - Fixes #273 --- server/src/websocket/server.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/src/websocket/server.rs b/server/src/websocket/server.rs index ea9f8a8a..08714c30 100644 --- a/server/src/websocket/server.rs +++ b/server/src/websocket/server.rs @@ -305,10 +305,12 @@ fn parse_json_message(chat: &mut ChatServer, msg: StandardMessage) -> Result { - chat.check_rate_limit_register(msg.id)?; let register: Register = serde_json::from_str(data)?; - let res = Oper::new(user_operation, register).perform()?; - Ok(serde_json::to_string(&res)?) + let res = Oper::new(user_operation, register).perform(); + if res.is_ok() { + chat.check_rate_limit_register(msg.id)?; + } + Ok(serde_json::to_string(&res?)?) } UserOperation::GetUserDetails => { let get_user_details: GetUserDetails = serde_json::from_str(data)?; -- 2.44.1