diff --git a/auth/auth.go b/auth/auth.go index 6eb9af22eb1d59596c4b43992ed20cbc36d5e249..bbc9e32640df66af976de727e7316c20462d34dd 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 6e8342ea37888fe0c04fc456c23a0d862dbaae04..a8247855fa816da16b9bb4a6b252d25c8544c1a5 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)