From 4575fc829356ba4cd538094b987d69b0233648f7 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Fri, 9 Jul 2021 14:15:45 +0300 Subject: Implemented validation of existance of username and chat name on creation --- go-src/windows.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'go-src/windows.go') diff --git a/go-src/windows.go b/go-src/windows.go index 183849e..3bc621c 100644 --- a/go-src/windows.go +++ b/go-src/windows.go @@ -54,6 +54,10 @@ func registerWindow(values ...string) { if len(inputs) == 0 { return } + if usernameExists(inputs[0]) { + defer showError(valueAlreadyTaken("Username"), registerWindow, values...) + return + } createUser(inputs) logInUser(inputs[0], inputs[1]) @@ -92,6 +96,10 @@ func createChatWindow(values ...string) { if len(inputs) == 0 { return } + if chatNameExists(inputs[0]) { + defer showError(valueAlreadyTaken("Chat name"), createChatWindow, values...) + return + } createChat(inputs[0], inputs[1], loggedInUser.Username) defer chatWindow(inputs[0]) -- cgit v1.2.3