Skip to content

Commit

Permalink
Clean UX so it is more clear that a pass is required
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlyp committed Apr 14, 2016
1 parent 6be3794 commit 2e788aa
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions dcrwallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package main

import (
"bufio"
"fmt"
"io/ioutil"
"net"
"net/http"
Expand Down Expand Up @@ -184,10 +185,13 @@ func startPromptPass(w *wallet.Wallet) {
}
if promptPass {
w.SetResyncAccounts(true)
log.Infof("Please enter the private wallet passphrase. " +
"This will complete syncing of the wallet accounts " +
"and then leave your wallet unlocked. You may relock " +
"wallet after by calling 'walletlock' through the RPC.")
backendLog.Flush()
fmt.Println("*** ATTENTION ***")
fmt.Println("Since this is your first time running we need to sync accounts. Please enter")

This comment has been minimized.

Copy link
@chappjc

chappjc Apr 15, 2016

Member

...or you've supplied --promptpass on the command line.

fmt.Println("the private wallet passphrase. This will complete syncing of the wallet")
fmt.Println("accounts and then leave your wallet unlocked. You may relock wallet after by")
fmt.Println("calling 'walletlock' through the RPC.")
fmt.Println("*****************")
} else {
return
}
Expand All @@ -209,18 +213,19 @@ func startPromptPass(w *wallet.Wallet) {
}
}
if promptPass {
backendLog.Flush()
reader := bufio.NewReader(os.Stdin)
passphrase, err := prompt.PassPrompt(reader, "", false)
passphrase, err := prompt.PassPrompt(reader, "Enter private passphrase", false)
if err != nil {
log.Errorf("Failed to input password. Please try again.")
fmt.Println("Failed to input password. Please try again.")
continue
}
defer zero.Bytes(passphrase)

var unlockAfter <-chan time.Time
err = w.Unlock(passphrase, unlockAfter)
if err != nil {
log.Errorf("Incorrect password entered. Please " +
fmt.Println("Incorrect password entered. Please " +
"try again.")
continue
}
Expand Down

0 comments on commit 2e788aa

Please sign in to comment.