change colors to work in uint32 and Rgba type

This commit is contained in:
2026-04-12 20:44:38 +02:00
parent 376992d2e1
commit e7f408788c
6 changed files with 53 additions and 38 deletions
+2 -8
View File
@@ -84,12 +84,6 @@ func HttpHandleUserNew(response http.ResponseWriter, request *http.Request) {
return
}
color, err := ConvertStringToRgb(request.FormValue("color"))
if err != nil {
http.Error(response, "bad color", http.StatusBadRequest)
return
}
hashedPassword, err := PasswordHash(password)
if err != nil {
http.Error(response, "internal server error", http.StatusInternalServerError)
@@ -99,7 +93,7 @@ func HttpHandleUserNew(response http.ResponseWriter, request *http.Request) {
newUser := &User{
Name: username,
PasswordHash: hashedPassword,
Color: color,
Color: Rgba{}.GetRandom(),
CreatedAt: time.Now(),
}
@@ -149,7 +143,7 @@ func HttpHandleUserModifyAppearance(response http.ResponseWriter, request *http.
return
}
color, err := ConvertStringToRgb(request.FormValue("color"))
color, err := ConvertStringToRgba(request.FormValue("color"))
if err != nil {
http.Error(response, "invalid color", http.StatusBadRequest)
return