fixing duplicate users
This commit is contained in:
@@ -28,7 +28,10 @@ func (store *Store) CreateUser(ctx *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
user := models.User{Username: input.Username, Password: hashedPassword}
|
user := models.User{Username: input.Username, Password: hashedPassword}
|
||||||
store.DB.Create(&user)
|
tx := store.DB.Create(&user)
|
||||||
|
if tx.Error != nil {
|
||||||
|
ctx.JSON(http.StatusInternalServerError, tx.Error.Error())
|
||||||
|
}
|
||||||
|
|
||||||
// Generate JWT token
|
// Generate JWT token
|
||||||
tokens, err := store.Auth.GenerateJWT(&user)
|
tokens, err := store.Auth.GenerateJWT(&user)
|
||||||
|
|||||||
Reference in New Issue
Block a user