diff --git a/auth/auth.go b/auth/auth.go index 6eb9af22eb..bbc9e32640 100644 --- a/auth/auth.go +++ b/auth/auth.go @@ -25,6 +25,15 @@ type AuthConfig struct { 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 func EncodeAuth(authConfig *AuthConfig) string { authStr := authConfig.Username + ":" + authConfig.Password diff --git a/commands.go b/commands.go index 6e8342ea37..a8247855fa 100644 --- a/commands.go +++ b/commands.go @@ -94,7 +94,7 @@ func (srv *Server) CmdLogin(stdin io.ReadCloser, stdout io.Writer, args ...strin password = srv.runtime.authConfig.Password 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) if err != nil { fmt.Fprintf(stdout, "Error : %s\n", err)