From ead7e0bf1d9c584224c1738b32ad26e314957220 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sat, 25 Jul 2020 18:40:31 +0300 Subject: Make verification modal wait for confirmation --- ui/commands.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'ui/commands.go') diff --git a/ui/commands.go b/ui/commands.go index a10445f..a6309fd 100644 --- a/ui/commands.go +++ b/ui/commands.go @@ -498,18 +498,20 @@ func cmdVerify(cmd *Command) { if device == nil { return } + if device.Trust == crypto.TrustStateVerified { + cmd.Reply("That device is already verified") + return + } if len(cmd.Args) == 2 { mach := cmd.Matrix.Crypto().(*crypto.OlmMachine) - timeout := 60 * time.Second - err := mach.NewSASVerificationWith(device, "", timeout, true) + mach.DefaultSASTimeout = 120 * time.Second + modal := NewVerificationModal(cmd.MainView, device, mach.DefaultSASTimeout) + cmd.MainView.ShowModal(modal) + err := mach.NewSimpleSASVerificationWith(device, modal) if err != nil { cmd.Reply("Failed to start interactive verification: %v", err) return } - modal := NewVerificationModal(cmd.MainView, device, timeout) - mach.VerifySASEmojisMatch = modal.VerifyEmojisMatch - mach.VerifySASNumbersMatch = modal.VerifyNumbersMatch - cmd.MainView.ShowModal(modal) } else { fingerprint := strings.Join(cmd.Args[2:], "") if string(device.SigningKey) != fingerprint { @@ -547,6 +549,10 @@ func cmdBlacklist(cmd *Command) { if device == nil { return } + if device.Trust == crypto.TrustStateBlacklisted { + cmd.Reply("That device is already blacklisted") + return + } action := "blacklisted" if device.Trust == crypto.TrustStateVerified { action = "unverified and blacklisted" -- cgit v1.2.3