Prevent crashing when trying to register with an empty payload
This commit is contained in:
parent
bfc4dd05ed
commit
150c3f032c
1 changed files with 3 additions and 0 deletions
|
@ -45,6 +45,9 @@ func RegisterUser(c echo.Context) error {
|
||||||
if err := c.Bind(&datUser); err != nil {
|
if err := c.Bind(&datUser); err != nil {
|
||||||
return c.JSON(http.StatusBadRequest, models.Message{"No or invalid user model provided."})
|
return c.JSON(http.StatusBadRequest, models.Message{"No or invalid user model provided."})
|
||||||
}
|
}
|
||||||
|
if datUser == nil {
|
||||||
|
return c.JSON(http.StatusBadRequest, models.Message{"No or invalid user model provided."})
|
||||||
|
}
|
||||||
|
|
||||||
// Insert the user
|
// Insert the user
|
||||||
newUser, err := user.CreateUser(datUser.APIFormat())
|
newUser, err := user.CreateUser(datUser.APIFormat())
|
||||||
|
|
Loading…
Reference in a new issue