refactor: consolidate debug flag and update gitignore
- Rename debugMode to isDebug for consistency across codebase - Move debug flag check in ValidateTimeStamp to match other validations - Add database.db to gitignore and remove unused config file - Update README.md to clarify user registration rules
This commit is contained in:
+9
-4
@@ -35,6 +35,7 @@ func RegisterHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if !ValidateTimeStamp(r.Header) {
|
||||
SendErrorResponse(w, http.StatusBadRequest, "Invalid or missing X-Timestamp in header")
|
||||
postLog.Warning(fmt.Sprintf("[RegisterHandler] Invalid or missing X-Timestamp in header: %s", r.Header.Get("X-Timestamp")))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -219,8 +220,10 @@ func ValidateRequestWithBody(w http.ResponseWriter, r *http.Request, body []byte
|
||||
return 0, "", fmt.Errorf("Token is required in header: %s", token)
|
||||
}
|
||||
|
||||
if !ValidateTimeStamp(r.Header) {
|
||||
return 0, "", fmt.Errorf("Invalid or missing X-Timestamp in header")
|
||||
if !isDebug {
|
||||
if !ValidateTimeStamp(r.Header) {
|
||||
return 0, "", fmt.Errorf("Invalid or missing X-Timestamp in header")
|
||||
}
|
||||
}
|
||||
|
||||
userID, err := extractUserIDFromToken(token)
|
||||
@@ -247,8 +250,10 @@ func ValidateRequestWithHeader(w http.ResponseWriter, r *http.Request, requiredF
|
||||
return 0, "", fmt.Errorf("Token is required in header: %s", token)
|
||||
}
|
||||
|
||||
if !ValidateTimeStamp(r.Header) {
|
||||
return 0, "", fmt.Errorf("Invalid or missing X-Timestamp in header")
|
||||
if !isDebug {
|
||||
if !ValidateTimeStamp(r.Header) {
|
||||
return 0, "", fmt.Errorf("Invalid or missing X-Timestamp in header")
|
||||
}
|
||||
}
|
||||
|
||||
userID, err := extractUserIDFromToken(token)
|
||||
|
||||
Reference in New Issue
Block a user