Fix the rootPath for auth

Upstream-commit: e726bdcce2606acef136a4d5ba47e367d9e461df
Component: engine
This commit is contained in:
creack
2013-03-22 05:52:13 -07:00
parent 27b8b86083
commit 1631f2fd5f
2 changed files with 10 additions and 1 deletions

View File

@ -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

View File

@ -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)