Tests
This commit is contained in:
@@ -92,11 +92,16 @@ func RegisterHandler(w http.ResponseWriter, r *http.Request) {
|
||||
req.DateOfBirth = strings.TrimSpace(req.DateOfBirth)
|
||||
|
||||
// Check required fields
|
||||
if req.FirstName == "" || req.LastName == "" || req.Email == "" || req.Phone == "" || req.DateOfBirth == "" {
|
||||
if req.FirstName == "" || req.LastName == "" || req.Email == "" || req.Phone == "" || req.DateOfBirth == "" || req.Password == "" {
|
||||
http.Error(w, "all fields are required", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
// Password must not exceed bcrypt's 72-byte limit
|
||||
if len(req.Password) > 72 {
|
||||
http.Error(w, "password must be 72 characters or less", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
// Validate name (unicode letters, spaces, hyphen, apostrophe, dot)
|
||||
nameRegex := regexp.MustCompile(`^[\p{L}\p{M}\s\-'\.]+$`)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user