You've already forked woodpecker
							
							
				mirror of
				https://github.com/woodpecker-ci/woodpecker.git
				synced 2025-10-30 23:27:39 +02:00 
			
		
		
		
	added logging to handler to identify errors
This commit is contained in:
		| @@ -34,7 +34,8 @@ func GetLogin(c web.C, w http.ResponseWriter, r *http.Request) { | ||||
| 	// authenticate the user | ||||
| 	login, err := remote.Authorize(w, r) | ||||
| 	if err != nil { | ||||
| 		http.Error(w, err.Error(), http.StatusBadRequest) | ||||
| 		log.Println(err) | ||||
| 		w.WriteHeader(http.StatusBadRequest) | ||||
| 		return | ||||
| 	} else if login == nil { | ||||
| 		// in this case we probably just redirected | ||||
| @@ -63,7 +64,8 @@ func GetLogin(c web.C, w http.ResponseWriter, r *http.Request) { | ||||
|  | ||||
| 		// insert the user into the database | ||||
| 		if err := datastore.PostUser(ctx, u); err != nil { | ||||
| 			http.Error(w, err.Error(), http.StatusBadRequest) | ||||
| 			log.Println(err) | ||||
| 			w.WriteHeader(http.StatusBadRequest) | ||||
| 			return | ||||
| 		} | ||||
|  | ||||
| @@ -82,7 +84,8 @@ func GetLogin(c web.C, w http.ResponseWriter, r *http.Request) { | ||||
| 	u.SetEmail(login.Email) | ||||
| 	u.Syncing = true //u.IsStale() // todo (badrydzewski) should not always sync | ||||
| 	if err := datastore.PutUser(ctx, u); err != nil { | ||||
| 		http.Error(w, err.Error(), http.StatusBadRequest) | ||||
| 		log.Println(err) | ||||
| 		w.WriteHeader(http.StatusBadRequest) | ||||
| 		return | ||||
| 	} | ||||
|  | ||||
| @@ -147,7 +150,8 @@ func GetLogin(c web.C, w http.ResponseWriter, r *http.Request) { | ||||
|  | ||||
| 	token, err := session.GenerateToken(ctx, r, u) | ||||
| 	if err != nil { | ||||
| 		http.Error(w, err.Error(), http.StatusInternalServerError) | ||||
| 		log.Println(err) | ||||
| 		w.WriteHeader(http.StatusInternalServerError) | ||||
| 		return | ||||
| 	} | ||||
| 	redirect = redirect + "#access_token=" + token | ||||
|   | ||||
		Reference in New Issue
	
	Block a user