summaryrefslogtreecommitdiffstats
path: root/routers/user/setting/security_openid.go
diff options
context:
space:
mode:
authorDavid Schneiderbauer <daviian@users.noreply.github.com>2018-06-18 20:24:45 +0200
committertechknowlogick <techknowlogick@users.noreply.github.com>2018-06-18 14:24:45 -0400
commit69bfd81b1cc4b95d6bc49e7b027d2e5ff03167a5 (patch)
treeeafbcecfa86dd1e636dbbfcfbb3ed54c83e91027 /routers/user/setting/security_openid.go
parent6e39f3d422155293a06df6430766a40ebc56277c (diff)
downloadgitea-69bfd81b1cc4b95d6bc49e7b027d2e5ff03167a5.tar.gz
gitea-69bfd81b1cc4b95d6bc49e7b027d2e5ff03167a5.zip
fix missing data on redirects (#3975)
Diffstat (limited to 'routers/user/setting/security_openid.go')
-rw-r--r--routers/user/setting/security_openid.go21
1 files changed, 8 insertions, 13 deletions
diff --git a/routers/user/setting/security_openid.go b/routers/user/setting/security_openid.go
index c98dc2cda9..6813765f6f 100644
--- a/routers/user/setting/security_openid.go
+++ b/routers/user/setting/security_openid.go
@@ -19,12 +19,8 @@ func OpenIDPost(ctx *context.Context, form auth.AddOpenIDForm) {
ctx.Data["PageIsSettingsSecurity"] = true
if ctx.HasError() {
- openid, err := models.GetUserOpenIDs(ctx.User.ID)
- if err != nil {
- ctx.ServerError("GetUserOpenIDs", err)
- return
- }
- ctx.Data["OpenIDs"] = openid
+ loadSecurityData(ctx)
+
ctx.HTML(200, tplSettingsSecurity)
return
}
@@ -37,6 +33,8 @@ func OpenIDPost(ctx *context.Context, form auth.AddOpenIDForm) {
id, err := openid.Normalize(form.Openid)
if err != nil {
+ loadSecurityData(ctx)
+
ctx.RenderWithErr(err.Error(), tplSettingsSecurity, &form)
return
}
@@ -53,6 +51,8 @@ func OpenIDPost(ctx *context.Context, form auth.AddOpenIDForm) {
// Check that the OpenID is not already used
for _, obj := range oids {
if obj.URI == id {
+ loadSecurityData(ctx)
+
ctx.RenderWithErr(ctx.Tr("form.openid_been_used", id), tplSettingsSecurity, &form)
return
}
@@ -61,6 +61,8 @@ func OpenIDPost(ctx *context.Context, form auth.AddOpenIDForm) {
redirectTo := setting.AppURL + "user/settings/security"
url, err := openid.RedirectURL(id, redirectTo, setting.AppURL)
if err != nil {
+ loadSecurityData(ctx)
+
ctx.RenderWithErr(err.Error(), tplSettingsSecurity, &form)
return
}
@@ -73,13 +75,6 @@ func settingsOpenIDVerify(ctx *context.Context) {
fullURL := setting.AppURL + ctx.Req.Request.URL.String()[1:]
log.Trace("Full URL: " + fullURL)
- oids, err := models.GetUserOpenIDs(ctx.User.ID)
- if err != nil {
- ctx.ServerError("GetUserOpenIDs", err)
- return
- }
- ctx.Data["OpenIDs"] = oids
-
id, err := openid.Verify(fullURL)
if err != nil {
ctx.RenderWithErr(err.Error(), tplSettingsSecurity, &auth.AddOpenIDForm{