diff options
author | renothing <261274+renothing@users.noreply.github.com> | 2019-07-27 21:15:30 +0800 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2019-07-27 16:15:30 +0300 |
commit | cbf231a67595feb36fccb68dc00b2bc7607fa882 (patch) | |
tree | 9f200fb9c89dc79a2f6a6472901668753a742aa3 /routers/api/v1/user/follower.go | |
parent | 700cd346fad3a0bed203bfb032f7b4bc9d1f2551 (diff) | |
download | gitea-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/user/follower.go')
-rw-r--r-- | routers/api/v1/user/follower.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/routers/api/v1/user/follower.go b/routers/api/v1/user/follower.go index 453f73137d..078f30af3c 100644 --- a/routers/api/v1/user/follower.go +++ b/routers/api/v1/user/follower.go @@ -9,12 +9,13 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/context" + "code.gitea.io/gitea/routers/api/v1/convert" ) func responseAPIUsers(ctx *context.APIContext, users []*models.User) { apiUsers := make([]*api.User, len(users)) for i := range users { - apiUsers[i] = users[i].APIFormat() + apiUsers[i] = convert.ToUser(users[i], ctx.IsSigned, ctx.User != nil && ctx.User.IsAdmin) } ctx.JSON(200, &apiUsers) } |