aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/org/team.go
diff options
context:
space:
mode:
authorrenothing <261274+renothing@users.noreply.github.com>2019-07-27 21:15:30 +0800
committerLauris BH <lauris@nix.lv>2019-07-27 16:15:30 +0300
commitcbf231a67595feb36fccb68dc00b2bc7607fa882 (patch)
tree9f200fb9c89dc79a2f6a6472901668753a742aa3 /routers/api/v1/org/team.go
parent700cd346fad3a0bed203bfb032f7b4bc9d1f2551 (diff)
downloadgitea-cbf231a67595feb36fccb68dc00b2bc7607fa882.tar.gz
gitea-cbf231a67595feb36fccb68dc00b2bc7607fa882.zip
fix wrong email when use gitea as OAuth2 provider (#7640)
when you use gitea as OAuth2 provider, the /api/v1/user should return user primary email as identifier, which is unique in OAuth2 clients. this patch use convert.ToUser replace all u.APIFormat in api requests, return primary email when caller is yourself or admin.
Diffstat (limited to 'routers/api/v1/org/team.go')
-rw-r--r--routers/api/v1/org/team.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/routers/api/v1/org/team.go b/routers/api/v1/org/team.go
index 40b6e008b9..59a000b670 100644
--- a/routers/api/v1/org/team.go
+++ b/routers/api/v1/org/team.go
@@ -257,7 +257,7 @@ func GetTeamMembers(ctx *context.APIContext) {
}
members := make([]*api.User, len(team.Members))
for i, member := range team.Members {
- members[i] = member.APIFormat()
+ members[i] = convert.ToUser(member, ctx.IsSigned, ctx.User.IsAdmin)
}
ctx.JSON(200, members)
}
@@ -288,7 +288,7 @@ func GetTeamMember(ctx *context.APIContext) {
if ctx.Written() {
return
}
- ctx.JSON(200, u.APIFormat())
+ ctx.JSON(200, convert.ToUser(u, ctx.IsSigned, ctx.User.IsAdmin))
}
// AddTeamMember api for add a member to a team