MCPcopy Create free account
hub / github.com/eventure/hide.client.linux / InteractiveCredentials

Method InteractiveCredentials

rest/interactive.go:11–22  ·  view source on GitHub ↗

InteractiveCredentials asks for username/password when no such credentials were configured

()

Source from the content-addressed store, hash-verified

9
10// InteractiveCredentials asks for username/password when no such credentials were configured
11func ( c *Client ) InteractiveCredentials() ( err error ) {
12 if ! terminal.IsTerminal( syscall.Stdin ) { return errors.New( "not a terminal" ) }
13 if len( c.Config.Username ) == 0 {
14 fmt.Print( "Username: " )
15 if _, err = fmt.Scanln( &c.Config.Username ); err != nil { return }
16 }
17 if len( c.Config.Password ) == 0 {
18 fmt.Print( "Password: " )
19 if passwordBytes, err := terminal.ReadPassword( syscall.Stdin ); err != nil { fmt.Println() } else { fmt.Println(); c.Config.Password = string( passwordBytes ) }
20 }
21 return
22}

Callers 1

accessTokenFunction · 0.80

Calls 1

PrintMethod · 0.45

Tested by

no test coverage detected