chore: ignore password for get current user
This commit is contained in:
@ -60,5 +60,6 @@ func Login(c *gin.Context) {
|
||||
// if token is empty, return guest user
|
||||
func CurrentUser(c *gin.Context) {
|
||||
user := c.MustGet("user").(*model.User)
|
||||
user.Password = ""
|
||||
common.SuccessResp(c, gin.H{"user": user})
|
||||
}
|
||||
|
@ -11,7 +11,12 @@ import (
|
||||
func Auth(c *gin.Context) {
|
||||
token := c.GetHeader("Authorization")
|
||||
if token == "" {
|
||||
guest, _ := db.GetGuest()
|
||||
guest, err := db.GetGuest()
|
||||
if err != nil {
|
||||
common.ErrorResp(c, err, 500, true)
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
c.Set("user", guest)
|
||||
c.Next()
|
||||
return
|
||||
|
Reference in New Issue
Block a user