mirror of
				https://github.com/ClusterCockpit/cc-backend
				synced 2025-10-30 23:45:06 +01:00 
			
		
		
		
	Change to html output for jwt-login
This commit is contained in:
		| @@ -109,13 +109,6 @@ var ( | |||||||
| 	version string | 	version string | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // ErrorResponse model |  | ||||||
| type ErrorResponse struct { |  | ||||||
| 	// Statustext of Errorcode |  | ||||||
| 	Status string `json:"status"` |  | ||||||
| 	Error  string `json:"error"` // Error Message |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func initEnv() { | func initEnv() { | ||||||
| 	if util.CheckFileExists("var") { | 	if util.CheckFileExists("var") { | ||||||
| 		fmt.Print("Directory ./var already exists. Exiting!\n") | 		fmt.Print("Directory ./var already exists. Exiting!\n") | ||||||
| @@ -370,11 +363,13 @@ func main() { | |||||||
|  |  | ||||||
| 			// On failure: | 			// On failure: | ||||||
| 			func(rw http.ResponseWriter, r *http.Request, err error) { | 			func(rw http.ResponseWriter, r *http.Request, err error) { | ||||||
| 				rw.Header().Add("Content-Type", "application/json") | 				rw.Header().Add("Content-Type", "text/html; charset=utf-8") | ||||||
| 				rw.WriteHeader(http.StatusForbidden) | 				rw.WriteHeader(http.StatusUnauthorized) | ||||||
| 				json.NewEncoder(rw).Encode(ErrorResponse{ | 				web.RenderTemplate(rw, "login.tmpl", &web.Page{ | ||||||
| 					Status: http.StatusText(http.StatusForbidden), | 					Title:   "Login failed - ClusterCockpit", | ||||||
| 					Error:  err.Error(), | 					MsgType: "alert-warning", | ||||||
|  | 					Message: err.Error(), | ||||||
|  | 					Build:   buildInfo, | ||||||
| 				}) | 				}) | ||||||
| 			})) | 			})) | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user