summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-07-14 23:21:34 +0800
committerUnknwon <u@gogs.io>2015-07-15 12:59:43 +0800
commit4cbbaefd8281354e7e69078ceb52b30c8478642f (patch)
treebe3c65f18bece90a173de84aa2cad0515f9b7081 /routers
parentccf17a6ecb8de10eb44f776f8cd2196ddbe3ee31 (diff)
downloadgitea-4cbbaefd8281354e7e69078ceb52b30c8478642f.tar.gz
gitea-4cbbaefd8281354e7e69078ceb52b30c8478642f.zip
#1127: hide user e-mail when API caller isn't signed in
Diffstat (limited to 'routers')
-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 e9ba615fcb..a4648297b9 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()})
}