From 98f614a58e984b386a464bc687086e096f03026a Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 23 Jun 2014 19:16:09 -0400 Subject: [PATCH] Work on #249 issue1 --- routers/user/home.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/routers/user/home.go b/routers/user/home.go index 7d0333cb4e..0f2cee2565 100644 --- a/routers/user/home.go +++ b/routers/user/home.go @@ -67,7 +67,7 @@ func Profile(ctx *middleware.Context, params martini.Params) { ctx.Data["Title"] = "Profile" ctx.Data["PageIsUserProfile"] = true - user, err := models.GetUserByName(params["username"]) + u, err := models.GetUserByName(params["username"]) if err != nil { if err == models.ErrUserNotExist { ctx.Handle(404, "user.Profile(GetUserByName)", err) @@ -76,19 +76,23 @@ func Profile(ctx *middleware.Context, params martini.Params) { } return } - ctx.Data["Owner"] = user + // For security reason, hide e-mail address for anonymous visitors. + if !ctx.IsSigned { + u.Email = "" + } + ctx.Data["Owner"] = u tab := ctx.Query("tab") ctx.Data["TabName"] = tab switch tab { case "activity": - ctx.Data["Feeds"], err = models.GetFeeds(user.Id, 0, true) + ctx.Data["Feeds"], err = models.GetFeeds(u.Id, 0, true) if err != nil { ctx.Handle(500, "user.Profile(GetFeeds)", err) return } default: - ctx.Data["Repos"], err = models.GetRepositories(user.Id, ctx.IsSigned && ctx.User.Id == user.Id) + ctx.Data["Repos"], err = models.GetRepositories(u.Id, ctx.IsSigned && ctx.User.Id == u.Id) if err != nil { ctx.Handle(500, "user.Profile(GetRepositories)", err) return