aboutsummaryrefslogtreecommitdiff
path: root/routers/api/v1/user.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-07-14 23:21:34 +0800
committerUnknwon <u@gogs.io>2015-07-14 23:21:34 +0800
commit2b1e67e0851ccaf040baf5331f5b66150a550afb (patch)
tree19d8977b7da1fcad36bfebe45483f6217ddee4a3 /routers/api/v1/user.go
parentec774d48c58f83b599ac210d6def718187806ecd (diff)
#1127: hide user e-mail when API caller isn't signed in
Diffstat (limited to 'routers/api/v1/user.go')
-rw-r--r--routers/api/v1/user.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/routers/api/v1/user.go b/routers/api/v1/user.go
index e9ba615f..a4648297 100644
--- a/routers/api/v1/user.go
+++ b/routers/api/v1/user.go
@@ -68,5 +68,10 @@ func GetUserInfo(ctx *middleware.Context) {
}
return
}
+
+ // Hide user e-mail when API caller isn't signed in.
+ if !ctx.IsSigned {
+ u.Email = ""
+ }
ctx.JSON(200, &api.User{u.Id, u.Name, u.FullName, u.Email, u.AvatarLink()})
}