This commit is contained in:
daru
2022-04-14 21:27:18 +02:00
parent 0cc4c3245f
commit 9dfe6424c8
2 changed files with 4 additions and 1 deletions

View File

@@ -5,11 +5,13 @@ import "time"
type UserData struct {
Username string `json:"username"`
MalId int `json:"malId"`
Secret string `json:"secret"`
}
type RegisterData struct {
Username string `json:"username"`
MalId int `json:"malId"`
Secret string `json:"secret"`
Sauce string `json:"sauce"`
}

View File

@@ -75,7 +75,7 @@ func Register(ctx *fasthttp.RequestCtx) {
ctx.SetStatusCode(fasthttp.StatusBadRequest)
return
}
if register.MalId == 0 || register.Username == "" || register.Sauce == "" {
if register.MalId == 0 || register.Username == "" || register.Secret == "" || register.Sauce == "" {
ctx.WriteString("Sprich JSON du Hurensohn")
ctx.SetStatusCode(fasthttp.StatusBadRequest)
return
@@ -109,6 +109,7 @@ func Register(ctx *fasthttp.RequestCtx) {
user := UserData{
Username: register.Username,
MalId: register.MalId,
Secret: register.Secret,
}
err = SaveUser(&user)
if err != nil {