diff options
author | Martin van Beurden <chadoe@gmail.com> | 2014-09-14 19:35:22 +0200 |
---|---|---|
committer | Martin van Beurden <chadoe@gmail.com> | 2014-09-18 20:50:48 +0200 |
commit | 0055cbd3651ebde0f8b6cc70c9c44de56dc38830 (patch) | |
tree | 64a9ea617ba1f704139881c3960fa2425dad9018 /routers | |
parent | 4f74b4e6578be4251af65cd08daa37c884e431a0 (diff) | |
download | gitea-0055cbd3651ebde0f8b6cc70c9c44de56dc38830.tar.gz gitea-0055cbd3651ebde0f8b6cc70c9c44de56dc38830.zip |
Allow Gogs to run from a suburl behind a reverse proxy. e.g. http://mydomain.com/gogs/
Conflicts:
modules/setting/setting.go
Conflicts:
templates/repo/release/list.tmpl
templates/user/dashboard/dashboard.tmpl
Conflicts:
routers/repo/setting.go
Diffstat (limited to 'routers')
-rw-r--r-- | routers/admin/admin.go | 2 | ||||
-rw-r--r-- | routers/admin/auths.go | 9 | ||||
-rw-r--r-- | routers/admin/users.go | 9 | ||||
-rw-r--r-- | routers/home.go | 2 | ||||
-rw-r--r-- | routers/install.go | 2 | ||||
-rw-r--r-- | routers/org/members.go | 3 | ||||
-rw-r--r-- | routers/org/org.go | 3 | ||||
-rw-r--r-- | routers/org/setting.go | 9 | ||||
-rw-r--r-- | routers/repo/commit.go | 4 | ||||
-rw-r--r-- | routers/repo/issue.go | 6 | ||||
-rw-r--r-- | routers/repo/repo.go | 5 | ||||
-rw-r--r-- | routers/repo/setting.go | 16 | ||||
-rw-r--r-- | routers/user/auth.go | 12 | ||||
-rw-r--r-- | routers/user/home.go | 7 | ||||
-rw-r--r-- | routers/user/setting.go | 19 | ||||
-rw-r--r-- | routers/user/social.go | 4 |
16 files changed, 60 insertions, 52 deletions
diff --git a/routers/admin/admin.go b/routers/admin/admin.go index 756d76c0f7..1fee7adbd5 100644 --- a/routers/admin/admin.go +++ b/routers/admin/admin.go @@ -143,7 +143,7 @@ func Dashboard(ctx *middleware.Context) { } else { ctx.Flash.Success(success) } - ctx.Redirect("/admin") + ctx.Redirect(setting.AppRootSubUrl + "/admin") return } diff --git a/routers/admin/auths.go b/routers/admin/auths.go index 6fbeab354e..9eaae489ae 100644 --- a/routers/admin/auths.go +++ b/routers/admin/auths.go @@ -14,6 +14,7 @@ import ( "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/modules/setting" ) const ( @@ -99,7 +100,7 @@ func NewAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) { } log.Trace("Authentication created by admin(%s): %s", ctx.User.Name, form.AuthName) - ctx.Redirect("/admin/auths") + ctx.Redirect(setting.AppRootSubUrl + "/admin/auths") } func EditAuthSource(ctx *middleware.Context) { @@ -180,7 +181,7 @@ func EditAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) { log.Trace("Authentication changed by admin(%s): %s", ctx.User.Name, form.AuthName) ctx.Flash.Success(ctx.Tr("admin.auths.update_success")) - ctx.Redirect("/admin/auths/" + ctx.Params(":authid")) + ctx.Redirect(setting.AppRootSubUrl + "/admin/auths/" + ctx.Params(":authid")) } func DeleteAuthSource(ctx *middleware.Context) { @@ -200,12 +201,12 @@ func DeleteAuthSource(ctx *middleware.Context) { switch err { case models.ErrAuthenticationUserUsed: ctx.Flash.Error("form.still_own_user") - ctx.Redirect("/admin/auths/" + ctx.Params(":authid")) + ctx.Redirect(setting.AppRootSubUrl + "/admin/auths/" + ctx.Params(":authid")) default: ctx.Handle(500, "DelLoginSource", err) } return } log.Trace("Authentication deleted by admin(%s): %s", ctx.User.Name, a.Name) - ctx.Redirect("/admin/auths") + ctx.Redirect(setting.AppRootSubUrl + "/admin/auths") } diff --git a/routers/admin/users.go b/routers/admin/users.go index 3f14e48f04..5cdb0f5ce9 100644 --- a/routers/admin/users.go +++ b/routers/admin/users.go @@ -14,6 +14,7 @@ import ( "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/modules/setting" ) const ( @@ -120,7 +121,7 @@ func NewUserPost(ctx *middleware.Context, form auth.RegisterForm) { return } log.Trace("Account created by admin(%s): %s", ctx.User.Name, u.Name) - ctx.Redirect("/admin/users") + ctx.Redirect(setting.AppRootSubUrl + "/admin/users") } func EditUser(ctx *middleware.Context) { @@ -197,7 +198,7 @@ func EditUserPost(ctx *middleware.Context, form auth.AdminEditUserForm) { ctx.Data["User"] = u ctx.Flash.Success(ctx.Tr("admin.users.update_profile_success")) - ctx.Redirect("/admin/users/" + ctx.Params(":userid")) + ctx.Redirect(setting.AppRootSubUrl + "/admin/users/" + ctx.Params(":userid")) } func DeleteUser(ctx *middleware.Context) { @@ -217,12 +218,12 @@ func DeleteUser(ctx *middleware.Context) { switch err { case models.ErrUserOwnRepos: ctx.Flash.Error(ctx.Tr("admin.users.still_own_repo")) - ctx.Redirect("/admin/users/" + ctx.Params(":userid")) + ctx.Redirect(setting.AppRootSubUrl + "/admin/users/" + ctx.Params(":userid")) default: ctx.Handle(500, "DeleteUser", err) } return } log.Trace("Account deleted by admin(%s): %s", ctx.User.Name, u.Name) - ctx.Redirect("/admin/users") + ctx.Redirect(setting.AppRootSubUrl + "/admin/users") } diff --git a/routers/home.go b/routers/home.go index 36a4f50fd2..8e973d161b 100644 --- a/routers/home.go +++ b/routers/home.go @@ -33,7 +33,7 @@ func Home(ctx *middleware.Context) { // Check auto-login. uname := ctx.GetCookie(setting.CookieUserName) if len(uname) != 0 { - ctx.Redirect("/user/login") + ctx.Redirect(setting.AppRootSubUrl + "/user/login") return } diff --git a/routers/install.go b/routers/install.go index 26409814e2..54da4d4f72 100644 --- a/routers/install.go +++ b/routers/install.go @@ -253,5 +253,5 @@ func InstallPost(ctx *middleware.Context, form auth.InstallForm) { log.Info("First-time run install finished!") ctx.Flash.Success(ctx.Tr("install.install_success")) - ctx.Redirect("/user/login") + ctx.Redirect(setting.AppRootSubUrl + "/user/login") } diff --git a/routers/org/members.go b/routers/org/members.go index 823daec948..d3bd51eae8 100644 --- a/routers/org/members.go +++ b/routers/org/members.go @@ -11,6 +11,7 @@ import ( "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/modules/setting" ) const ( @@ -86,7 +87,7 @@ func MembersAction(ctx *middleware.Context) { if ctx.Params(":action") != "leave" { ctx.Redirect(ctx.Org.OrgLink + "/members") } else { - ctx.Redirect("/") + ctx.Redirect(setting.AppRootSubUrl + "/") } } diff --git a/routers/org/org.go b/routers/org/org.go index 27ccf02d3f..cea70823af 100644 --- a/routers/org/org.go +++ b/routers/org/org.go @@ -10,6 +10,7 @@ import ( "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/modules/setting" ) const ( @@ -82,5 +83,5 @@ func CreatePost(ctx *middleware.Context, form auth.CreateOrgForm) { } log.Trace("Organization created: %s", org.Name) - ctx.Redirect("/org/" + form.OrgName + "/dashboard") + ctx.Redirect(setting.AppRootSubUrl + "/org/" + form.OrgName + "/dashboard") } diff --git a/routers/org/setting.go b/routers/org/setting.go index f853ef0e8e..3d397c0c66 100644 --- a/routers/org/setting.go +++ b/routers/org/setting.go @@ -11,6 +11,7 @@ import ( "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/modules/setting" ) const ( @@ -48,7 +49,7 @@ func SettingsPost(ctx *middleware.Context, form auth.UpdateOrgSettingForm) { } else if err = models.ChangeUserName(org, form.OrgUserName); err != nil { if err == models.ErrUserNameIllegal { ctx.Flash.Error(ctx.Tr("form.illegal_username")) - ctx.Redirect("/org/" + org.LowerName + "/settings") + ctx.Redirect(setting.AppRootSubUrl + "/org/" + org.LowerName + "/settings") return } else { ctx.Handle(500, "ChangeUserName", err) @@ -72,7 +73,7 @@ func SettingsPost(ctx *middleware.Context, form auth.UpdateOrgSettingForm) { } log.Trace("Organization setting updated: %s", org.Name) ctx.Flash.Success(ctx.Tr("org.settings.update_setting_success")) - ctx.Redirect("/org/" + org.Name + "/settings") + ctx.Redirect(setting.AppRootSubUrl + "/org/" + org.Name + "/settings") } func SettingsDelete(ctx *middleware.Context) { @@ -86,13 +87,13 @@ func SettingsDelete(ctx *middleware.Context) { switch err { case models.ErrUserOwnRepos: ctx.Flash.Error(ctx.Tr("form.org_still_own_repo")) - ctx.Redirect("/org/" + org.LowerName + "/settings/delete") + ctx.Redirect(setting.AppRootSubUrl + "/org/" + org.LowerName + "/settings/delete") default: ctx.Handle(500, "DeleteOrganization", err) } } else { log.Trace("Organization deleted: %s", ctx.User.Name) - ctx.Redirect("/") + ctx.Redirect(setting.AppRootSubUrl + "/") } return } diff --git a/routers/repo/commit.go b/routers/repo/commit.go index f7feb4d95e..e58b9e78f6 100644 --- a/routers/repo/commit.go +++ b/routers/repo/commit.go @@ -159,8 +159,8 @@ func Diff(ctx *middleware.Context) { ctx.Data["Diff"] = diff ctx.Data["Parents"] = parents ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0 - ctx.Data["SourcePath"] = "/" + path.Join(userName, repoName, "src", commitId) - ctx.Data["RawPath"] = "/" + path.Join(userName, repoName, "raw", commitId) + ctx.Data["SourcePath"] = setting.AppRootSubUrl + "/" + path.Join(userName, repoName, "src", commitId) + ctx.Data["RawPath"] = setting.AppRootSubUrl + "/" + path.Join(userName, repoName, "raw", commitId) ctx.HTML(200, DIFF) } diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 934cf3c988..8aba82ffc5 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -54,8 +54,8 @@ func Issues(ctx *middleware.Context) { isShowClosed := ctx.Query("state") == "closed" if viewType != "all" && !ctx.IsSigned { - ctx.SetCookie("redirect_to", "/"+url.QueryEscape(ctx.Req.RequestURI)) - ctx.Redirect("/user/login") + ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppRootSubUrl + ctx.Req.RequestURI)) + ctx.Redirect(setting.AppRootSubUrl + "/user/login") return } @@ -312,7 +312,7 @@ func CreateIssuePost(ctx *middleware.Context, form auth.CreateIssueForm) { } log.Trace("%d Issue created: %d", ctx.Repo.Repository.Id, issue.Id) - send(200, fmt.Sprintf("/%s/%s/issues/%d", ctx.Params(":username"), ctx.Params(":reponame"), issue.Index), nil) + send(200, fmt.Sprintf("%s/%s/%s/issues/%d", setting.AppRootSubUrl, ctx.Params(":username"), ctx.Params(":reponame"), issue.Index), nil) } func checkLabels(labels, allLabels []*models.Label) { diff --git a/routers/repo/repo.go b/routers/repo/repo.go index 17f20a0a71..3bd9aa7cd1 100644 --- a/routers/repo/repo.go +++ b/routers/repo/repo.go @@ -18,6 +18,7 @@ import ( "github.com/gogits/gogs/modules/git" "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/modules/setting" ) const ( @@ -95,7 +96,7 @@ func CreatePost(ctx *middleware.Context, form auth.CreateRepoForm) { form.Gitignore, form.License, form.Private, false, form.InitReadme) if err == nil { log.Trace("Repository created: %s/%s", ctxUser.Name, form.RepoName) - ctx.Redirect("/" + ctxUser.Name + "/" + form.RepoName) + ctx.Redirect(setting.AppRootSubUrl + "/" + ctxUser.Name + "/" + form.RepoName) return } else if err == models.ErrRepoAlreadyExist { ctx.Data["Err_RepoName"] = true @@ -179,7 +180,7 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) { form.Mirror, url) if err == nil { log.Trace("Repository migrated: %s/%s", ctxUser.Name, form.RepoName) - ctx.Redirect("/" + ctxUser.Name + "/" + form.RepoName) + ctx.Redirect(setting.AppRootSubUrl + "/" + ctxUser.Name + "/" + form.RepoName) return } else if err == models.ErrRepoAlreadyExist { ctx.Data["Err_RepoName"] = true diff --git a/routers/repo/setting.go b/routers/repo/setting.go index 62f2dbf531..926b543202 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -97,7 +97,7 @@ func SettingsPost(ctx *middleware.Context, form auth.RepoSettingForm) { } ctx.Flash.Success(ctx.Tr("repo.settings.update_settings_success")) - ctx.Redirect(fmt.Sprintf("/%s/%s/settings", ctx.Repo.Owner.Name, ctx.Repo.Repository.Name)) + ctx.Redirect(fmt.Sprintf("%s/%s/%s/settings", setting.AppRootSubUrl, ctx.Repo.Owner.Name, ctx.Repo.Repository.Name)) case "transfer": if ctx.Repo.Repository.Name != form.RepoName { ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_repo_name"), SETTINGS_OPTIONS, nil) @@ -122,7 +122,7 @@ func SettingsPost(ctx *middleware.Context, form auth.RepoSettingForm) { } log.Trace("Repository transfered: %s/%s -> %s", ctx.Repo.Owner.Name, ctx.Repo.Repository.Name, newOwner) ctx.Flash.Success(ctx.Tr("repo.settings.transfer_succeed")) - ctx.Redirect("/") + ctx.Redirect(setting.AppRootSubUrl + "/") case "delete": if ctx.Repo.Repository.Name != form.RepoName { ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_repo_name"), SETTINGS_OPTIONS, nil) @@ -151,9 +151,9 @@ func SettingsPost(ctx *middleware.Context, form auth.RepoSettingForm) { } log.Trace("Repository deleted: %s/%s", ctx.Repo.Owner.Name, ctx.Repo.Repository.Name) if ctx.Repo.Owner.IsOrganization() { - ctx.Redirect("/org/" + ctx.Repo.Owner.Name + "/dashboard") + ctx.Redirect(setting.AppRootSubUrl + "/org/" + ctx.Repo.Owner.Name + "/dashboard") } else { - ctx.Redirect("/") + ctx.Redirect(setting.AppRootSubUrl + "/") } } } @@ -167,7 +167,7 @@ func SettingsCollaboration(ctx *middleware.Context) { if ctx.Req.Method == "POST" { name := strings.ToLower(ctx.Query("collaborator")) if len(name) == 0 || ctx.Repo.Owner.LowerName == name { - ctx.Redirect(ctx.Req.URL.Path) + ctx.Redirect(setting.AppRootSubUrl + ctx.Req.URL.Path) return } has, err := models.HasAccess(name, repoLink, models.WRITABLE) @@ -175,7 +175,7 @@ func SettingsCollaboration(ctx *middleware.Context) { ctx.Handle(500, "HasAccess", err) return } else if has { - ctx.Redirect(ctx.Req.URL.Path) + ctx.Redirect(setting.AppRootSubUrl + ctx.Req.URL.Path) return } @@ -183,7 +183,7 @@ func SettingsCollaboration(ctx *middleware.Context) { if err != nil { if err == models.ErrUserNotExist { ctx.Flash.Error(ctx.Tr("form.user_not_exist")) - ctx.Redirect(ctx.Req.URL.Path) + ctx.Redirect(setting.AppRootSubUrl + ctx.Req.URL.Path) } else { ctx.Handle(500, "GetUserByName", err) } @@ -204,7 +204,7 @@ func SettingsCollaboration(ctx *middleware.Context) { } ctx.Flash.Success(ctx.Tr("repo.settings.add_collaborator_success")) - ctx.Redirect(ctx.Req.URL.Path) + ctx.Redirect(setting.AppRootSubUrl + ctx.Req.URL.Path) return } diff --git a/routers/user/auth.go b/routers/user/auth.go index e3d132166e..1dbc3300dd 100644 --- a/routers/user/auth.go +++ b/routers/user/auth.go @@ -82,7 +82,7 @@ func SignIn(ctx *middleware.Context) { return } - ctx.Redirect("/") + ctx.Redirect(setting.AppRootSubUrl + "/") } func SignInPost(ctx *middleware.Context, form auth.SignInForm) { @@ -140,7 +140,7 @@ func SignInPost(ctx *middleware.Context, form auth.SignInForm) { return } - ctx.Redirect("/") + ctx.Redirect(setting.AppRootSubUrl + "/") } func SignOut(ctx *middleware.Context) { @@ -151,7 +151,7 @@ func SignOut(ctx *middleware.Context) { ctx.Session.Delete("socialEmail") ctx.SetCookie(setting.CookieUserName, "", -1) ctx.SetCookie(setting.CookieRememberName, "", -1) - ctx.Redirect("/") + ctx.Redirect(setting.AppRootSubUrl + "/") } func oauthSignUp(ctx *middleware.Context, sid int64) { @@ -288,7 +288,7 @@ func SignUpPost(ctx *middleware.Context, cpt *captcha.Captcha, form auth.Registe return } - ctx.Redirect("/user/login") + ctx.Redirect(setting.AppRootSubUrl + "/user/login") } func Activate(ctx *middleware.Context) { @@ -335,7 +335,7 @@ func Activate(ctx *middleware.Context) { ctx.Session.Set("uid", user.Id) ctx.Session.Set("uname", user.Name) - ctx.Redirect("/") + ctx.Redirect(setting.AppRootSubUrl + "/") return } @@ -437,7 +437,7 @@ func ResetPasswdPost(ctx *middleware.Context) { } log.Trace("User password reset: %s", u.Name) - ctx.Redirect("/user/login") + ctx.Redirect(setting.AppRootSubUrl + "/user/login") return } diff --git a/routers/user/home.go b/routers/user/home.go index 372f111aec..b411b8fc1f 100644 --- a/routers/user/home.go +++ b/routers/user/home.go @@ -13,6 +13,7 @@ import ( "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/modules/setting" ) const ( @@ -126,7 +127,7 @@ func Profile(ctx *middleware.Context) { uname := ctx.Params(":username") // Special handle for FireFox requests favicon.ico. if uname == "favicon.ico" { - ctx.Redirect("/img/favicon.png") + ctx.Redirect(setting.AppRootSubUrl + "/img/favicon.png") return } @@ -141,7 +142,7 @@ func Profile(ctx *middleware.Context) { } if u.IsOrganization() { - ctx.Redirect("/org/" + u.Name) + ctx.Redirect(setting.AppRootSubUrl + "/org/" + u.Name) return } @@ -181,7 +182,7 @@ func Email2User(ctx *middleware.Context) { } return } - ctx.Redirect("/user/" + u.Name) + ctx.Redirect(setting.AppRootSubUrl + "/user/" + u.Name) } const ( diff --git a/routers/user/setting.go b/routers/user/setting.go index 4e0e468f0e..a540f054f8 100644 --- a/routers/user/setting.go +++ b/routers/user/setting.go @@ -14,6 +14,7 @@ import ( "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/modules/setting" ) const ( @@ -55,7 +56,7 @@ func SettingsPost(ctx *middleware.Context, form auth.UpdateProfileForm) { } else if err = models.ChangeUserName(ctx.User, form.UserName); err != nil { if err == models.ErrUserNameIllegal { ctx.Flash.Error(ctx.Tr("form.illegal_username")) - ctx.Redirect("/user/settings") + ctx.Redirect(setting.AppRootSubUrl + "/user/settings") return } else { ctx.Handle(500, "ChangeUserName", err) @@ -78,7 +79,7 @@ func SettingsPost(ctx *middleware.Context, form auth.UpdateProfileForm) { } log.Trace("User setting updated: %s", ctx.User.Name) ctx.Flash.Success(ctx.Tr("settings.update_profile_success")) - ctx.Redirect("/user/settings") + ctx.Redirect(setting.AppRootSubUrl + "/user/settings") } func SettingsPassword(ctx *middleware.Context) { @@ -119,7 +120,7 @@ func SettingsPasswordPost(ctx *middleware.Context, form auth.ChangePasswordForm) ctx.Flash.Success(ctx.Tr("settings.change_password_success")) } - ctx.Redirect("/user/settings/password") + ctx.Redirect(setting.AppRootSubUrl + "/user/settings/password") } func SettingsSSHKeys(ctx *middleware.Context) { @@ -160,7 +161,7 @@ func SettingsSSHKeysPost(ctx *middleware.Context, form auth.AddSSHKeyForm) { ctx.Handle(500, "DeletePublicKey", err) } else { log.Trace("SSH key deleted: %s", ctx.User.Name) - ctx.Redirect("/user/settings/ssh") + ctx.Redirect(setting.AppRootSubUrl + "/user/settings/ssh") } return } @@ -177,7 +178,7 @@ func SettingsSSHKeysPost(ctx *middleware.Context, form auth.AddSSHKeyForm) { if ok, err := models.CheckPublicKeyString(cleanContent); !ok { ctx.Flash.Error(ctx.Tr("form.invalid_ssh_key", err.Error())) - ctx.Redirect("/user/settings/ssh") + ctx.Redirect(setting.AppRootSubUrl + "/user/settings/ssh") return } @@ -196,7 +197,7 @@ func SettingsSSHKeysPost(ctx *middleware.Context, form auth.AddSSHKeyForm) { } else { log.Trace("SSH key added: %s", ctx.User.Name) ctx.Flash.Success(ctx.Tr("settings.add_key_success")) - ctx.Redirect("/user/settings/ssh") + ctx.Redirect(setting.AppRootSubUrl + "/user/settings/ssh") return } } @@ -217,7 +218,7 @@ func SettingsSocial(ctx *middleware.Context) { return } ctx.Flash.Success(ctx.Tr("settings.unbind_success")) - ctx.Redirect("/user/settings/social") + ctx.Redirect(setting.AppRootSubUrl + "/user/settings/social") return } @@ -248,13 +249,13 @@ func SettingsDelete(ctx *middleware.Context) { switch err { case models.ErrUserOwnRepos: ctx.Flash.Error(ctx.Tr("form.still_own_repo")) - ctx.Redirect("/user/settings/delete") + ctx.Redirect(setting.AppRootSubUrl + "/user/settings/delete") default: ctx.Handle(500, "DeleteUser", err) } } else { log.Trace("Account deleted: %s", ctx.User.Name) - ctx.Redirect("/") + ctx.Redirect(setting.AppRootSubUrl + "/") } return } diff --git a/routers/user/social.go b/routers/user/social.go index 07c6deed6d..fc2ea5fb49 100644 --- a/routers/user/social.go +++ b/routers/user/social.go @@ -22,7 +22,7 @@ import ( func extractPath(next string) string { n, err := url.Parse(next) if err != nil { - return "/" + return setting.AppRootSubUrl + "/" } return n.Path } @@ -88,7 +88,7 @@ func SocialSignIn(ctx *middleware.Context) { return } case models.ErrOauth2NotAssociated: - next = "/user/sign_up" + next = setting.AppRootSubUrl + "/user/sign_up" default: ctx.Handle(500, "social.SocialSignIn(GetOauth2)", err) return |