Procházet zdrojové kódy

Add password flag for authentication

For T692
pull/43/head
Christopher Davis před 4 roky
rodič
revize
c6af292b2a
2 změnil soubory, kde provedl 16 přidání a 8 odebrání
  1. +4
    -0
      cmd/writeas/main.go
  2. +12
    -8
      commands/commands.go

+ 4
- 0
cmd/writeas/main.go Zobrazit soubor

@@ -238,6 +238,10 @@ func main() {
Name: "verbose, v",
Usage: "Make the operation more talkative",
},
cli.StringFlag{
Name: "password, p",
Usage: "The password for the account being logged into",
},
},
},
{


+ 12
- 8
commands/commands.go Zobrazit soubor

@@ -408,15 +408,19 @@ func CmdAuth(c *cli.Context) error {
}
}

fmt.Print("Password: ")
pass, err := gopass.GetPasswdMasked()
if err != nil {
return cli.NewExitError(fmt.Sprintf("error reading password: %v", err), 1)
}

// Validate password
// Take password from argument, and fall back to input
pass := c.String("p")
if len(pass) == 0 {
return cli.NewExitError("Please enter your password.", 1)
fmt.Print("Password: ")
pass, err := gopass.GetPasswdMasked()
if err != nil {
return cli.NewExitError(fmt.Sprintf("error reading password: %v", err), 1)
}

// Validate password
if len(pass) == 0 {
return cli.NewExitError("Please enter your password.", 1)
}
}

if config.IsTor(c) {


Načítá se…
Zrušit
Uložit