password to newUser

This commit is contained in:
Shel Le 2024-08-29 23:22:32 -07:00
parent 6cd1fdde9d
commit 1b593a70e4

View File

@ -65,11 +65,12 @@ func getSpin(w http.ResponseWriter, r *http.Request) {
}
// generate UUID
// get username & password; generate UUID
func newUser(w http.ResponseWriter, r *http.Request) {
id := uuid.New()
username := r.URL.Query().Get("username")
password := r.URL.Query().Get("password")
if username == "" {
http.Error(w, "USERNAME is required", http.StatusBadRequest)
@ -82,8 +83,9 @@ func newUser(w http.ResponseWriter, r *http.Request) {
rdb.ZAdd(ctx, "user_uuid", redis.Z{float64(user_slot), id}).Result()
}
// fmt.Println(id.String())
json.NewEncoder(w).Encode(Message{ID: id.String(), Content: username})
c := fmt.Sprint(username, " has password ", password)
json.NewEncoder(w).Encode(Message{ID: id.String(), Content: c})
}
// this user, this amount, this type of bet, this roulette number