Fixed some login quirks

This commit is contained in:
shin- 2013-05-01 13:41:58 -07:00
parent 594827d416
commit 18796d55a6
1 changed files with 6 additions and 2 deletions

View File

@ -15,7 +15,7 @@ import (
const CONFIGFILE = ".dockercfg" const CONFIGFILE = ".dockercfg"
// the registry server we want to login against // the registry server we want to login against
const INDEX_SERVER = "http://indexstaging-docker.dotcloud.com" const INDEX_SERVER = "https://indexstaging-docker.dotcloud.com"
type AuthConfig struct { type AuthConfig struct {
Username string `json:"username"` Username string `json:"username"`
@ -123,8 +123,12 @@ func Login(authConfig *AuthConfig) (string, error) {
} }
if reqStatusCode == 201 { if reqStatusCode == 201 {
status = "Account Created\n" status = "Account created. Please use the confirmation link we sent"+
" to your e-mail to activate it.\n"
storeConfig = true storeConfig = true
} else if reqStatusCode == 403 {
return "", fmt.Errorf("Login: Your account hasn't been activated. "+
"Please check your e-mail for a confirmation link.")
} else if reqStatusCode == 400 { } else if reqStatusCode == 400 {
if string(reqBody) == "\"Username or email already exists\"" { if string(reqBody) == "\"Username or email already exists\"" {
req, err := http.NewRequest("GET", INDEX_SERVER+"/v1/users/", nil) req, err := http.NewRequest("GET", INDEX_SERVER+"/v1/users/", nil)