diff options
author | Sandro Santilli <strk@kbt.io> | 2017-03-20 09:31:08 +0100 |
---|---|---|
committer | Kim "BKC" Carlbäcker <kim.carlbacker@gmail.com> | 2017-03-20 09:31:08 +0100 |
commit | 9182a35f18b6d5cd981486852028e670984145c3 (patch) | |
tree | cab69a27330df5a095de95017e8b40bf13598889 /routers | |
parent | e1586898b2f0905b6f59383c01a3aed6b39de93a (diff) | |
download | gitea-9182a35f18b6d5cd981486852028e670984145c3.tar.gz gitea-9182a35f18b6d5cd981486852028e670984145c3.zip |
Show user OpenID URIs in their profile (#1314)
Diffstat (limited to 'routers')
-rw-r--r-- | routers/user/profile.go | 8 | ||||
-rw-r--r-- | routers/user/setting_openid.go | 16 |
2 files changed, 24 insertions, 0 deletions
diff --git a/routers/user/profile.go b/routers/user/profile.go index 89585551ad..eb862d6542 100644 --- a/routers/user/profile.go +++ b/routers/user/profile.go @@ -75,9 +75,17 @@ func Profile(ctx *context.Context) { return } + // Show OpenID URIs + openIDs, err := models.GetUserOpenIDs(ctxUser.ID) + if err != nil { + ctx.Handle(500, "GetUserOpenIDs", err) + return + } + ctx.Data["Title"] = ctxUser.DisplayName() ctx.Data["PageIsUserProfile"] = true ctx.Data["Owner"] = ctxUser + ctx.Data["OpenIDs"] = openIDs showPrivate := ctx.IsSigned && (ctx.User.IsAdmin || ctx.User.ID == ctxUser.ID) orgs, err := models.GetOrgsByUserID(ctxUser.ID, showPrivate) diff --git a/routers/user/setting_openid.go b/routers/user/setting_openid.go index 5e6052d3ef..e33ab144ed 100644 --- a/routers/user/setting_openid.go +++ b/routers/user/setting_openid.go @@ -45,6 +45,12 @@ func SettingsOpenIDPost(ctx *context.Context, form auth.AddOpenIDForm) { ctx.Data["PageIsSettingsOpenID"] = true if ctx.HasError() { + openid, err := models.GetUserOpenIDs(ctx.User.ID) + if err != nil { + ctx.Handle(500, "GetUserOpenIDs", err) + return + } + ctx.Data["OpenIDs"] = openid ctx.HTML(200, tplSettingsOpenID) return } @@ -140,3 +146,13 @@ func DeleteOpenID(ctx *context.Context) { }) } +// ToggleOpenIDVisibility response for toggle visibility of user's openid +func ToggleOpenIDVisibility(ctx *context.Context) { + if err := models.ToggleUserOpenIDVisibility(ctx.QueryInt64("id")); err != nil { + ctx.Handle(500, "ToggleUserOpenIDVisibility", err) + return + } + + ctx.Redirect(setting.AppSubURL + "/user/settings/openid") +} + |