aboutsummaryrefslogtreecommitdiff
path: root/ui/commands.go
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2020-07-25 18:40:31 +0300
committerTulir Asokan <tulir@maunium.net>2020-07-25 18:40:31 +0300
commitead7e0bf1d9c584224c1738b32ad26e314957220 (patch)
treefb5c4fe731dc40b864417c59b48741466595248b /ui/commands.go
parent341f8829d67b197ece20fe1cb0da929486665853 (diff)
Make verification modal wait for confirmation
Diffstat (limited to 'ui/commands.go')
-rw-r--r--ui/commands.go18
1 files changed, 12 insertions, 6 deletions
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"