diff options
author | Unknwon <joe2010xtmf@163.com> | 2014-09-19 20:11:34 -0400 |
---|---|---|
committer | Unknwon <joe2010xtmf@163.com> | 2014-09-19 20:11:34 -0400 |
commit | 7ba9257a7ff659417501baf7358216555cebcd86 (patch) | |
tree | ffc842cec4165d1069220ae16e08a0b824952f4b /routers/user | |
parent | 6a7bd097fe2b3e894830fc3fdb60dde5594b61d6 (diff) | |
download | gitea-7ba9257a7ff659417501baf7358216555cebcd86.tar.gz gitea-7ba9257a7ff659417501baf7358216555cebcd86.zip |
Add suburl support
Diffstat (limited to 'routers/user')
-rw-r--r-- | routers/user/auth.go | 12 | ||||
-rw-r--r-- | routers/user/home.go | 6 | ||||
-rw-r--r-- | routers/user/setting.go | 18 | ||||
-rw-r--r-- | routers/user/social.go | 4 |
4 files changed, 20 insertions, 20 deletions
diff --git a/routers/user/auth.go b/routers/user/auth.go index 1dbc3300dd..71622e5543 100644 --- a/routers/user/auth.go +++ b/routers/user/auth.go @@ -82,7 +82,7 @@ func SignIn(ctx *middleware.Context) { return } - ctx.Redirect(setting.AppRootSubUrl + "/") + ctx.Redirect(setting.AppSubUrl + "/") } func SignInPost(ctx *middleware.Context, form auth.SignInForm) { @@ -140,7 +140,7 @@ func SignInPost(ctx *middleware.Context, form auth.SignInForm) { return } - ctx.Redirect(setting.AppRootSubUrl + "/") + ctx.Redirect(setting.AppSubUrl + "/") } 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(setting.AppRootSubUrl + "/") + ctx.Redirect(setting.AppSubUrl + "/") } 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(setting.AppRootSubUrl + "/user/login") + ctx.Redirect(setting.AppSubUrl + "/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(setting.AppRootSubUrl + "/") + ctx.Redirect(setting.AppSubUrl + "/") return } @@ -437,7 +437,7 @@ func ResetPasswdPost(ctx *middleware.Context) { } log.Trace("User password reset: %s", u.Name) - ctx.Redirect(setting.AppRootSubUrl + "/user/login") + ctx.Redirect(setting.AppSubUrl + "/user/login") return } diff --git a/routers/user/home.go b/routers/user/home.go index b411b8fc1f..031872fca9 100644 --- a/routers/user/home.go +++ b/routers/user/home.go @@ -127,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(setting.AppRootSubUrl + "/img/favicon.png") + ctx.Redirect(setting.AppSubUrl + "/img/favicon.png") return } @@ -142,7 +142,7 @@ func Profile(ctx *middleware.Context) { } if u.IsOrganization() { - ctx.Redirect(setting.AppRootSubUrl + "/org/" + u.Name) + ctx.Redirect(setting.AppSubUrl + "/org/" + u.Name) return } @@ -182,7 +182,7 @@ func Email2User(ctx *middleware.Context) { } return } - ctx.Redirect(setting.AppRootSubUrl + "/user/" + u.Name) + ctx.Redirect(setting.AppSubUrl + "/user/" + u.Name) } const ( diff --git a/routers/user/setting.go b/routers/user/setting.go index a540f054f8..8f778acd0d 100644 --- a/routers/user/setting.go +++ b/routers/user/setting.go @@ -56,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(setting.AppRootSubUrl + "/user/settings") + ctx.Redirect(setting.AppSubUrl + "/user/settings") return } else { ctx.Handle(500, "ChangeUserName", err) @@ -79,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(setting.AppRootSubUrl + "/user/settings") + ctx.Redirect(setting.AppSubUrl + "/user/settings") } func SettingsPassword(ctx *middleware.Context) { @@ -120,7 +120,7 @@ func SettingsPasswordPost(ctx *middleware.Context, form auth.ChangePasswordForm) ctx.Flash.Success(ctx.Tr("settings.change_password_success")) } - ctx.Redirect(setting.AppRootSubUrl + "/user/settings/password") + ctx.Redirect(setting.AppSubUrl + "/user/settings/password") } func SettingsSSHKeys(ctx *middleware.Context) { @@ -161,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(setting.AppRootSubUrl + "/user/settings/ssh") + ctx.Redirect(setting.AppSubUrl + "/user/settings/ssh") } return } @@ -178,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(setting.AppRootSubUrl + "/user/settings/ssh") + ctx.Redirect(setting.AppSubUrl + "/user/settings/ssh") return } @@ -197,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(setting.AppRootSubUrl + "/user/settings/ssh") + ctx.Redirect(setting.AppSubUrl + "/user/settings/ssh") return } } @@ -218,7 +218,7 @@ func SettingsSocial(ctx *middleware.Context) { return } ctx.Flash.Success(ctx.Tr("settings.unbind_success")) - ctx.Redirect(setting.AppRootSubUrl + "/user/settings/social") + ctx.Redirect(setting.AppSubUrl + "/user/settings/social") return } @@ -249,13 +249,13 @@ func SettingsDelete(ctx *middleware.Context) { switch err { case models.ErrUserOwnRepos: ctx.Flash.Error(ctx.Tr("form.still_own_repo")) - ctx.Redirect(setting.AppRootSubUrl + "/user/settings/delete") + ctx.Redirect(setting.AppSubUrl + "/user/settings/delete") default: ctx.Handle(500, "DeleteUser", err) } } else { log.Trace("Account deleted: %s", ctx.User.Name) - ctx.Redirect(setting.AppRootSubUrl + "/") + ctx.Redirect(setting.AppSubUrl + "/") } return } diff --git a/routers/user/social.go b/routers/user/social.go index fc2ea5fb49..0bc1fa592f 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 setting.AppRootSubUrl + "/" + return setting.AppSubUrl + "/" } return n.Path } @@ -88,7 +88,7 @@ func SocialSignIn(ctx *middleware.Context) { return } case models.ErrOauth2NotAssociated: - next = setting.AppRootSubUrl + "/user/sign_up" + next = setting.AppSubUrl + "/user/sign_up" default: ctx.Handle(500, "social.SocialSignIn(GetOauth2)", err) return |