mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Fix the rootPath for auth
This commit is contained in:
parent
9b5f0fac81
commit
e726bdcce2
2 changed files with 10 additions and 1 deletions
|
@ -25,6 +25,15 @@ type AuthConfig struct {
|
||||||
rootPath string `json:-`
|
rootPath string `json:-`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func NewAuthConfig(username, password, email, rootPath string) *AuthConfig {
|
||||||
|
return &AuthConfig{
|
||||||
|
Username: username,
|
||||||
|
Password: password,
|
||||||
|
Email: email,
|
||||||
|
rootPath: rootPath,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// create a base64 encoded auth string to store in config
|
// create a base64 encoded auth string to store in config
|
||||||
func EncodeAuth(authConfig *AuthConfig) string {
|
func EncodeAuth(authConfig *AuthConfig) string {
|
||||||
authStr := authConfig.Username + ":" + authConfig.Password
|
authStr := authConfig.Username + ":" + authConfig.Password
|
||||||
|
|
|
@ -94,7 +94,7 @@ func (srv *Server) CmdLogin(stdin io.ReadCloser, stdout io.Writer, args ...strin
|
||||||
password = srv.runtime.authConfig.Password
|
password = srv.runtime.authConfig.Password
|
||||||
email = srv.runtime.authConfig.Email
|
email = srv.runtime.authConfig.Email
|
||||||
}
|
}
|
||||||
newAuthConfig := &auth.AuthConfig{Username: username, Password: password, Email: email}
|
newAuthConfig := auth.NewAuthConfig(username, password, email, srv.runtime.root)
|
||||||
status, err := auth.Login(newAuthConfig)
|
status, err := auth.Login(newAuthConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(stdout, "Error : %s\n", err)
|
fmt.Fprintf(stdout, "Error : %s\n", err)
|
||||||
|
|
Loading…
Add table
Reference in a new issue