From 009b1f9e9ea3d7da6f20b6b521a162c935ca7b83 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 22 Jul 2021 20:17:14 +0300 Subject: Improved password updating formatting --- go-src/windows.go | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'go-src/windows.go') diff --git a/go-src/windows.go b/go-src/windows.go index 93e27f9..f32d0a7 100644 --- a/go-src/windows.go +++ b/go-src/windows.go @@ -237,20 +237,22 @@ func accountWindow(...string) { nextWindow := handleInputActions(input, true) if nextWindow == nil { - if editI, err := strconv.Atoi(input); editI > 0 && editI < 2 && err == nil { - switch editI { - case 1: - pass := formWindow("Editing", accountWindow, - []formInput{ - {"Current password", inputBackSpec, nil}, - {"New password", "", stringValidPassword}, - }, - ) - if !updatePassword(pass[0], pass[1]) { - defer showError(invalidArgument, accountWindow) - } + editI, _ := strconv.Atoi(input) + switch editI { + case 1: + pass := formWindow("Editing", accountWindow, + []formInput{ + {"Current password", inputBackSpec, nil}, + {"New password", "", stringValidPassword}, + }, + ) + if !updatePassword(pass[0], pass[1]) { + defer showError(invalidArgument, accountWindow) + } else { + logoutUser() + defer StartupWindow() } - } else { + default: defer showError(invalidCommand, accountWindow) } } else { -- cgit v1.2.3