From 78e9325f353d14e310bb4d1121a5d8ca5cadd8d0 Mon Sep 17 00:00:00 2001 From: Evan Su <48808396+HACKERALERT@users.noreply.github.com> Date: Fri, 6 May 2022 23:33:44 -0400 Subject: [PATCH] Fix race condition, improve stability --- src/Picocrypt.go | 22 +++++++++++++++------- src/go.mod | 6 +++--- src/go.sum | 12 ++++++------ 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/Picocrypt.go b/src/Picocrypt.go index 50ab168..71672c7 100644 --- a/src/Picocrypt.go +++ b/src/Picocrypt.go @@ -161,13 +161,15 @@ func draw() { giu.CloseCurrentPopup() showPassgen = false }), - giu.Button("Generate").Size(100, 0).OnClick(func() { - password = genPassword() - cpassword = password - passwordStrength = zxcvbn.PasswordStrength(password, nil).Score - giu.CloseCurrentPopup() - showPassgen = false - }), + giu.Style().SetDisabled(!(passgenUpper || passgenLower || passgenNums || passgenSymbols)).To( + giu.Button("Generate").Size(100, 0).OnClick(func() { + password = genPassword() + cpassword = password + passwordStrength = zxcvbn.PasswordStrength(password, nil).Score + giu.CloseCurrentPopup() + showPassgen = false + }), + ), ), ).Build() giu.OpenPopup("Generate password:##" + strconv.Itoa(modalId)) @@ -1639,6 +1641,12 @@ func resetUI() { allFiles = nil inputLabel = "Drop files and folders into this window." startLabel = "Start" + passgenCopy = true + passgenLength = 32 + passgenUpper = true + passgenLower = true + passgenNums = true + passgenSymbols = true password = "" cpassword = "" keyfiles = nil diff --git a/src/go.mod b/src/go.mod index 62b52fc..56f7b0d 100644 --- a/src/go.mod +++ b/src/go.mod @@ -3,10 +3,10 @@ module Picocrypt go 1.17 require ( - github.com/HACKERALERT/clipboard v0.1.5-0.20211215214929-7345ba96aeca + github.com/HACKERALERT/clipboard v0.1.5-0.20220506035732-b4457b0ed524 github.com/HACKERALERT/crypto v0.0.0-20220412024110-ba8732acd7e7 github.com/HACKERALERT/dialog v0.0.0-20220415015354-cd2cf9c423ec - github.com/HACKERALERT/giu v0.5.7-0.20220418220352-faeb0afe91f6 + github.com/HACKERALERT/giu v0.5.7-0.20220507022816-75a5253eb51f github.com/HACKERALERT/infectious v0.0.0-20220412021528-bb1303403749 github.com/HACKERALERT/serpent v0.0.0-20210716182301-293b29869c66 github.com/HACKERALERT/zxcvbn-go v0.0.0-20210927200100-f131a4666ad5 @@ -15,7 +15,7 @@ require ( require ( github.com/HACKERALERT/gl v0.0.0-20220417032545-0e093e3300ba // indirect github.com/HACKERALERT/glfw/v3.3/glfw v0.0.0-20220418220159-8c0b01dff26c // indirect - github.com/HACKERALERT/imgui-go v1.12.1-0.20220418220320-02c1bb51b992 // indirect + github.com/HACKERALERT/imgui-go v1.12.1-0.20220507022715-e694f2891acc // indirect github.com/HACKERALERT/mainthread v0.0.0-20211027212305-2ec9e701cc14 // indirect github.com/HACKERALERT/sys v0.0.0-20220412020404-2e09c491f471 // indirect github.com/HACKERALERT/w32 v0.0.0-20211215215707-4b84c2675d8d // indirect diff --git a/src/go.sum b/src/go.sum index 0e53c98..08d9b7e 100644 --- a/src/go.sum +++ b/src/go.sum @@ -1,17 +1,17 @@ -github.com/HACKERALERT/clipboard v0.1.5-0.20211215214929-7345ba96aeca h1:yZj12M2feFkat7l0r7s7QnKjJ4Q6UZOwVHroR4kQ4Nk= -github.com/HACKERALERT/clipboard v0.1.5-0.20211215214929-7345ba96aeca/go.mod h1:kkjR9AGvIlIUJdjd/CBL1VfQvyPDE5kL31rAzY/r0s4= +github.com/HACKERALERT/clipboard v0.1.5-0.20220506035732-b4457b0ed524 h1:qf2fxAhhoDnoWuR/3Wj4mNDHlKEx2e3wPdta6Um7Sqw= +github.com/HACKERALERT/clipboard v0.1.5-0.20220506035732-b4457b0ed524/go.mod h1:kkjR9AGvIlIUJdjd/CBL1VfQvyPDE5kL31rAzY/r0s4= github.com/HACKERALERT/crypto v0.0.0-20220412024110-ba8732acd7e7 h1:vOy0zRm74+1hPiUJ6R2EQl+agZBo+KcGQR85OWCzEZQ= github.com/HACKERALERT/crypto v0.0.0-20220412024110-ba8732acd7e7/go.mod h1:XjuRsuBwllqVRs7DqJrbpPeUsT3qebqANdKSBJnNn0s= github.com/HACKERALERT/dialog v0.0.0-20220415015354-cd2cf9c423ec h1:BT5dOJ3xggkQOHAJTko58Fjs7/QuyBP6o3PKYWZ8N+M= github.com/HACKERALERT/dialog v0.0.0-20220415015354-cd2cf9c423ec/go.mod h1:GxPIEf2nKp6Gx+sdpjwTdFIGmW5kj6Jta7rRO50TgpU= -github.com/HACKERALERT/giu v0.5.7-0.20220418220352-faeb0afe91f6 h1:fd40jkfxT/22nlxJmez2Q18SyB0SUuvX/5vhQtoqV8E= -github.com/HACKERALERT/giu v0.5.7-0.20220418220352-faeb0afe91f6/go.mod h1:DILkSV0XbP/X4wwUobcWSo4P7DbIpg0q2B6p57xI6fk= +github.com/HACKERALERT/giu v0.5.7-0.20220507022816-75a5253eb51f h1:dCaujtH+eudgSRcjU1Tn3LFq5dVmDwpnnPPyYGqQhy4= +github.com/HACKERALERT/giu v0.5.7-0.20220507022816-75a5253eb51f/go.mod h1:Ajp2Rxqvz4bn/s+8smoqJNOKfVcGiRkgRhpmktCd4tI= github.com/HACKERALERT/gl v0.0.0-20220417032545-0e093e3300ba h1:AGAO9HNDmj3Rx/zsnmeqmZSs/d6Sm3bW9FYqgHTXmAw= github.com/HACKERALERT/gl v0.0.0-20220417032545-0e093e3300ba/go.mod h1:ZUosVzfEKNGLMLk6aj9yo0FSAhWWsbTMjuzeIUXniB0= github.com/HACKERALERT/glfw/v3.3/glfw v0.0.0-20220418220159-8c0b01dff26c h1:uQK+OMiHS0S8Ovye1PeRbej19X60SIRq6y+EnOtAEgw= github.com/HACKERALERT/glfw/v3.3/glfw v0.0.0-20220418220159-8c0b01dff26c/go.mod h1:aP+FSN9tk1W3UsQisFWxRLQ4WOF7T3niq68UYw0B150= -github.com/HACKERALERT/imgui-go v1.12.1-0.20220418220320-02c1bb51b992 h1:0SDSJVa2JbVBlvWFd8jkS30ada8dNVPQinVgAOVL8Bg= -github.com/HACKERALERT/imgui-go v1.12.1-0.20220418220320-02c1bb51b992/go.mod h1:XdQUE5swH88IF/sA6lb0z/l7vu6EJw80u5dp7DmAnh4= +github.com/HACKERALERT/imgui-go v1.12.1-0.20220507022715-e694f2891acc h1:SRuCmSyUCo2QlNsOXq9xJyqXq2jByBAKWfo35bhRtdc= +github.com/HACKERALERT/imgui-go v1.12.1-0.20220507022715-e694f2891acc/go.mod h1:XdQUE5swH88IF/sA6lb0z/l7vu6EJw80u5dp7DmAnh4= github.com/HACKERALERT/infectious v0.0.0-20220412021528-bb1303403749 h1:uZMOuYhLopMYH1E5JC4gMqWsp3aVhxUnOgvCH6cGMqo= github.com/HACKERALERT/infectious v0.0.0-20220412021528-bb1303403749/go.mod h1:LInDG9bntPYtji6J+OLDZvv1OTWA5XpqXv19MBsWJrA= github.com/HACKERALERT/mainthread v0.0.0-20211027212305-2ec9e701cc14 h1:DwWXverhu/dEsPM/GPykuHGh4SxW69DaGZL5t3fANG4=