diff options
author | Robby Zambito <contact@robbyzambito.me> | 2025-08-07 01:06:18 -0400 |
---|---|---|
committer | Robby Zambito <contact@robbyzambito.me> | 2025-08-07 01:06:18 -0400 |
commit | e50f01f009ce91a14087bfab84f30c357e06dce2 (patch) | |
tree | 7b8fbbed04870d7ae1942f540624fea48a62e1d2 /internal/api | |
parent | 1fd1358eeb4159e00f0d4b770130ad2d3adb467c (diff) |
Properly send unauthorized response for login
Diffstat (limited to 'internal/api')
-rw-r--r-- | internal/api/handlers.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/internal/api/handlers.go b/internal/api/handlers.go index 8d328a6..6fb6361 100644 --- a/internal/api/handlers.go +++ b/internal/api/handlers.go @@ -60,7 +60,7 @@ func CreateLoginHandler(logs *[log_length]string, n *int, logChan chan string) h var data map[string]any if json.Unmarshal(body, &data) != nil { addRotLog(logs, n, logChan, fmt.Sprintf(`{"authRequest": %s}`, string(body))) - http.Error(w, "Forbidden", http.StatusForbidden) + http.Error(w, `{"message": "Unauthorized"}`, http.StatusUnauthorized) return } @@ -69,7 +69,7 @@ func CreateLoginHandler(logs *[log_length]string, n *int, logChan chan string) h addRotLog(logs, n, logChan, fmt.Sprintf(`{"authRequest": {"email": "%s", "password": "XXXXXXXX", "loginTime": "%s", "success": false, "rememberMe": %t}}`, email, time.Now().UTC(), rememberMe)) } } - http.Error(w, "Forbidden", http.StatusForbidden) + http.Error(w, `{"message": "Unauthorized"}`, http.StatusUnauthorized) } } |