mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-30 00:00:12 +01:00
return user in auth response
This commit is contained in:
parent
cf739c6ae5
commit
9faec2e805
1 changed files with 7 additions and 3 deletions
|
@ -29,9 +29,10 @@ type tokenClaims struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type AuthResponse struct {
|
type AuthResponse struct {
|
||||||
Success bool `json:"success"`
|
Success bool `json:"success"`
|
||||||
Message string `json:"message"`
|
Message string `json:"message"`
|
||||||
Token string `json:"token"`
|
Token string `json:"token"`
|
||||||
|
User common.UserResponse `json:"user"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func VisitorAuthenticate(r *gin.RouterGroup) {
|
func VisitorAuthenticate(r *gin.RouterGroup) {
|
||||||
|
@ -132,10 +133,13 @@ func authenticate(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
serializer := common.UserSerializer{c, user.User}
|
||||||
|
|
||||||
c.JSON(http.StatusOK, gin.H{
|
c.JSON(http.StatusOK, gin.H{
|
||||||
"success": true,
|
"success": true,
|
||||||
"message": "Authenticated",
|
"message": "Authenticated",
|
||||||
"token": tokenString,
|
"token": tokenString,
|
||||||
|
"user": serializer.Response(false),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue