mirror of
https://github.com/gogs/gogs.git
synced 2026-05-07 15:27:50 +02:00
conf: overhaul server settings (#5928)
* conf: rename package * Requires Go 1.12 * Fix lint * Fix lint * Overhaul * db: fix tests * Save my work * Fix tests * Server.UnixSocketPermission * Server.LocalRootURL * SSH settings * Server.OfflineMode * Save my work * App.Version * Remove [server] STATIC_ROOT_PATH * Server.LandingURL
This commit is contained in:
@@ -11,12 +11,12 @@ import (
|
||||
"github.com/go-macaron/captcha"
|
||||
log "unknwon.dev/clog/v2"
|
||||
|
||||
"gogs.io/gogs/internal/conf"
|
||||
"gogs.io/gogs/internal/context"
|
||||
"gogs.io/gogs/internal/db"
|
||||
"gogs.io/gogs/internal/db/errors"
|
||||
"gogs.io/gogs/internal/form"
|
||||
"gogs.io/gogs/internal/mailer"
|
||||
"gogs.io/gogs/internal/setting"
|
||||
"gogs.io/gogs/internal/tool"
|
||||
)
|
||||
|
||||
@@ -36,7 +36,7 @@ func AutoLogin(c *context.Context) (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
uname := c.GetCookie(setting.CookieUserName)
|
||||
uname := c.GetCookie(conf.CookieUserName)
|
||||
if len(uname) == 0 {
|
||||
return false, nil
|
||||
}
|
||||
@@ -45,9 +45,9 @@ func AutoLogin(c *context.Context) (bool, error) {
|
||||
defer func() {
|
||||
if !isSucceed {
|
||||
log.Trace("auto-login cookie cleared: %s", uname)
|
||||
c.SetCookie(setting.CookieUserName, "", -1, setting.AppSubURL)
|
||||
c.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubURL)
|
||||
c.SetCookie(setting.LoginStatusCookieName, "", -1, setting.AppSubURL)
|
||||
c.SetCookie(conf.CookieUserName, "", -1, conf.Server.Subpath)
|
||||
c.SetCookie(conf.CookieRememberName, "", -1, conf.Server.Subpath)
|
||||
c.SetCookie(conf.LoginStatusCookieName, "", -1, conf.Server.Subpath)
|
||||
}
|
||||
}()
|
||||
|
||||
@@ -59,16 +59,16 @@ func AutoLogin(c *context.Context) (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
if val, ok := c.GetSuperSecureCookie(u.Rands+u.Passwd, setting.CookieRememberName); !ok || val != u.Name {
|
||||
if val, ok := c.GetSuperSecureCookie(u.Rands+u.Passwd, conf.CookieRememberName); !ok || val != u.Name {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
isSucceed = true
|
||||
c.Session.Set("uid", u.ID)
|
||||
c.Session.Set("uname", u.Name)
|
||||
c.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubURL)
|
||||
if setting.EnableLoginStatusCookie {
|
||||
c.SetCookie(setting.LoginStatusCookieName, "true", 0, setting.AppSubURL)
|
||||
c.SetCookie(conf.CSRFCookieName, "", -1, conf.Server.Subpath)
|
||||
if conf.EnableLoginStatusCookie {
|
||||
c.SetCookie(conf.LoginStatusCookieName, "true", 0, conf.Server.Subpath)
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
@@ -85,7 +85,7 @@ func Login(c *context.Context) {
|
||||
|
||||
redirectTo := c.Query("redirect_to")
|
||||
if len(redirectTo) > 0 {
|
||||
c.SetCookie("redirect_to", redirectTo, 0, setting.AppSubURL)
|
||||
c.SetCookie("redirect_to", redirectTo, 0, conf.Server.Subpath)
|
||||
} else {
|
||||
redirectTo, _ = url.QueryUnescape(c.GetCookie("redirect_to"))
|
||||
}
|
||||
@@ -96,7 +96,7 @@ func Login(c *context.Context) {
|
||||
} else {
|
||||
c.SubURLRedirect("/")
|
||||
}
|
||||
c.SetCookie("redirect_to", "", -1, setting.AppSubURL)
|
||||
c.SetCookie("redirect_to", "", -1, conf.Server.Subpath)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -119,9 +119,9 @@ func Login(c *context.Context) {
|
||||
|
||||
func afterLogin(c *context.Context, u *db.User, remember bool) {
|
||||
if remember {
|
||||
days := 86400 * setting.LoginRememberDays
|
||||
c.SetCookie(setting.CookieUserName, u.Name, days, setting.AppSubURL, "", setting.CookieSecure, true)
|
||||
c.SetSuperSecureCookie(u.Rands+u.Passwd, setting.CookieRememberName, u.Name, days, setting.AppSubURL, "", setting.CookieSecure, true)
|
||||
days := 86400 * conf.LoginRememberDays
|
||||
c.SetCookie(conf.CookieUserName, u.Name, days, conf.Server.Subpath, "", conf.CookieSecure, true)
|
||||
c.SetSuperSecureCookie(u.Rands+u.Passwd, conf.CookieRememberName, u.Name, days, conf.Server.Subpath, "", conf.CookieSecure, true)
|
||||
}
|
||||
|
||||
c.Session.Set("uid", u.ID)
|
||||
@@ -130,13 +130,13 @@ func afterLogin(c *context.Context, u *db.User, remember bool) {
|
||||
c.Session.Delete("twoFactorUserID")
|
||||
|
||||
// Clear whatever CSRF has right now, force to generate a new one
|
||||
c.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubURL)
|
||||
if setting.EnableLoginStatusCookie {
|
||||
c.SetCookie(setting.LoginStatusCookieName, "true", 0, setting.AppSubURL)
|
||||
c.SetCookie(conf.CSRFCookieName, "", -1, conf.Server.Subpath)
|
||||
if conf.EnableLoginStatusCookie {
|
||||
c.SetCookie(conf.LoginStatusCookieName, "true", 0, conf.Server.Subpath)
|
||||
}
|
||||
|
||||
redirectTo, _ := url.QueryUnescape(c.GetCookie("redirect_to"))
|
||||
c.SetCookie("redirect_to", "", -1, setting.AppSubURL)
|
||||
c.SetCookie("redirect_to", "", -1, conf.Server.Subpath)
|
||||
if tool.IsSameSiteURLPath(redirectTo) {
|
||||
c.Redirect(redirectTo)
|
||||
return
|
||||
@@ -283,18 +283,18 @@ func LoginTwoFactorRecoveryCodePost(c *context.Context) {
|
||||
func SignOut(c *context.Context) {
|
||||
c.Session.Flush()
|
||||
c.Session.Destory(c.Context)
|
||||
c.SetCookie(setting.CookieUserName, "", -1, setting.AppSubURL)
|
||||
c.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubURL)
|
||||
c.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubURL)
|
||||
c.SetCookie(conf.CookieUserName, "", -1, conf.Server.Subpath)
|
||||
c.SetCookie(conf.CookieRememberName, "", -1, conf.Server.Subpath)
|
||||
c.SetCookie(conf.CSRFCookieName, "", -1, conf.Server.Subpath)
|
||||
c.SubURLRedirect("/")
|
||||
}
|
||||
|
||||
func SignUp(c *context.Context) {
|
||||
c.Title("sign_up")
|
||||
|
||||
c.Data["EnableCaptcha"] = setting.Service.EnableCaptcha
|
||||
c.Data["EnableCaptcha"] = conf.Service.EnableCaptcha
|
||||
|
||||
if setting.Service.DisableRegistration {
|
||||
if conf.Service.DisableRegistration {
|
||||
c.Data["DisableRegistration"] = true
|
||||
c.Success(SIGNUP)
|
||||
return
|
||||
@@ -306,9 +306,9 @@ func SignUp(c *context.Context) {
|
||||
func SignUpPost(c *context.Context, cpt *captcha.Captcha, f form.Register) {
|
||||
c.Title("sign_up")
|
||||
|
||||
c.Data["EnableCaptcha"] = setting.Service.EnableCaptcha
|
||||
c.Data["EnableCaptcha"] = conf.Service.EnableCaptcha
|
||||
|
||||
if setting.Service.DisableRegistration {
|
||||
if conf.Service.DisableRegistration {
|
||||
c.Status(403)
|
||||
return
|
||||
}
|
||||
@@ -318,7 +318,7 @@ func SignUpPost(c *context.Context, cpt *captcha.Captcha, f form.Register) {
|
||||
return
|
||||
}
|
||||
|
||||
if setting.Service.EnableCaptcha && !cpt.VerifyReq(c.Req) {
|
||||
if conf.Service.EnableCaptcha && !cpt.VerifyReq(c.Req) {
|
||||
c.FormErr("Captcha")
|
||||
c.RenderWithErr(c.Tr("form.captcha_incorrect"), SIGNUP, &f)
|
||||
return
|
||||
@@ -334,7 +334,7 @@ func SignUpPost(c *context.Context, cpt *captcha.Captcha, f form.Register) {
|
||||
Name: f.UserName,
|
||||
Email: f.Email,
|
||||
Passwd: f.Password,
|
||||
IsActive: !setting.Service.RegisterEmailConfirm,
|
||||
IsActive: !conf.Service.RegisterEmailConfirm,
|
||||
}
|
||||
if err := db.CreateUser(u); err != nil {
|
||||
switch {
|
||||
@@ -368,11 +368,11 @@ func SignUpPost(c *context.Context, cpt *captcha.Captcha, f form.Register) {
|
||||
}
|
||||
|
||||
// Send confirmation email, no need for social account.
|
||||
if setting.Service.RegisterEmailConfirm && u.ID > 1 {
|
||||
if conf.Service.RegisterEmailConfirm && u.ID > 1 {
|
||||
mailer.SendActivateAccountMail(c.Context, db.NewMailerUser(u))
|
||||
c.Data["IsSendRegisterMail"] = true
|
||||
c.Data["Email"] = u.Email
|
||||
c.Data["Hours"] = setting.Service.ActiveCodeLives / 60
|
||||
c.Data["Hours"] = conf.Service.ActiveCodeLives / 60
|
||||
c.Success(ACTIVATE)
|
||||
|
||||
if err := c.Cache.Put(u.MailResendCacheKey(), 1, 180); err != nil {
|
||||
@@ -393,11 +393,11 @@ func Activate(c *context.Context) {
|
||||
return
|
||||
}
|
||||
// Resend confirmation email.
|
||||
if setting.Service.RegisterEmailConfirm {
|
||||
if conf.Service.RegisterEmailConfirm {
|
||||
if c.Cache.IsExist(c.User.MailResendCacheKey()) {
|
||||
c.Data["ResendLimited"] = true
|
||||
} else {
|
||||
c.Data["Hours"] = setting.Service.ActiveCodeLives / 60
|
||||
c.Data["Hours"] = conf.Service.ActiveCodeLives / 60
|
||||
mailer.SendActivateAccountMail(c.Context, db.NewMailerUser(c.User))
|
||||
|
||||
if err := c.Cache.Put(c.User.MailResendCacheKey(), 1, 180); err != nil {
|
||||
@@ -457,7 +457,7 @@ func ActivateEmail(c *context.Context) {
|
||||
func ForgotPasswd(c *context.Context) {
|
||||
c.Title("auth.forgot_password")
|
||||
|
||||
if setting.MailService == nil {
|
||||
if conf.MailService == nil {
|
||||
c.Data["IsResetDisable"] = true
|
||||
c.Success(FORGOT_PASSWORD)
|
||||
return
|
||||
@@ -470,7 +470,7 @@ func ForgotPasswd(c *context.Context) {
|
||||
func ForgotPasswdPost(c *context.Context) {
|
||||
c.Title("auth.forgot_password")
|
||||
|
||||
if setting.MailService == nil {
|
||||
if conf.MailService == nil {
|
||||
c.Status(403)
|
||||
return
|
||||
}
|
||||
@@ -482,7 +482,7 @@ func ForgotPasswdPost(c *context.Context) {
|
||||
u, err := db.GetUserByEmail(email)
|
||||
if err != nil {
|
||||
if errors.IsUserNotExist(err) {
|
||||
c.Data["Hours"] = setting.Service.ActiveCodeLives / 60
|
||||
c.Data["Hours"] = conf.Service.ActiveCodeLives / 60
|
||||
c.Data["IsResetSent"] = true
|
||||
c.Success(FORGOT_PASSWORD)
|
||||
return
|
||||
@@ -509,7 +509,7 @@ func ForgotPasswdPost(c *context.Context) {
|
||||
log.Error("Failed to put cache key 'mail resend': %v", err)
|
||||
}
|
||||
|
||||
c.Data["Hours"] = setting.Service.ActiveCodeLives / 60
|
||||
c.Data["Hours"] = conf.Service.ActiveCodeLives / 60
|
||||
c.Data["IsResetSent"] = true
|
||||
c.Success(FORGOT_PASSWORD)
|
||||
}
|
||||
|
||||
@@ -11,10 +11,10 @@ import (
|
||||
"github.com/unknwon/com"
|
||||
"github.com/unknwon/paginater"
|
||||
|
||||
"gogs.io/gogs/internal/conf"
|
||||
"gogs.io/gogs/internal/context"
|
||||
"gogs.io/gogs/internal/db"
|
||||
"gogs.io/gogs/internal/db/errors"
|
||||
"gogs.io/gogs/internal/setting"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -110,7 +110,7 @@ func Dashboard(c *context.Context) {
|
||||
|
||||
// Only user can have collaborative repositories.
|
||||
if !ctxUser.IsOrganization() {
|
||||
collaborateRepos, err := c.User.GetAccessibleRepositories(setting.UI.User.RepoPagingNum)
|
||||
collaborateRepos, err := c.User.GetAccessibleRepositories(conf.UI.User.RepoPagingNum)
|
||||
if err != nil {
|
||||
c.Handle(500, "GetAccessibleRepositories", err)
|
||||
return
|
||||
@@ -125,7 +125,7 @@ func Dashboard(c *context.Context) {
|
||||
var repos, mirrors []*db.Repository
|
||||
var repoCount int64
|
||||
if ctxUser.IsOrganization() {
|
||||
repos, repoCount, err = ctxUser.GetUserRepositories(c.User.ID, 1, setting.UI.User.RepoPagingNum)
|
||||
repos, repoCount, err = ctxUser.GetUserRepositories(c.User.ID, 1, conf.UI.User.RepoPagingNum)
|
||||
if err != nil {
|
||||
c.Handle(500, "GetUserRepositories", err)
|
||||
return
|
||||
@@ -137,7 +137,7 @@ func Dashboard(c *context.Context) {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
if err = ctxUser.GetRepositories(1, setting.UI.User.RepoPagingNum); err != nil {
|
||||
if err = ctxUser.GetRepositories(1, conf.UI.User.RepoPagingNum); err != nil {
|
||||
c.Handle(500, "GetRepositories", err)
|
||||
return
|
||||
}
|
||||
@@ -152,7 +152,7 @@ func Dashboard(c *context.Context) {
|
||||
}
|
||||
c.Data["Repos"] = repos
|
||||
c.Data["RepoCount"] = repoCount
|
||||
c.Data["MaxShowRepoNum"] = setting.UI.User.RepoPagingNum
|
||||
c.Data["MaxShowRepoNum"] = conf.UI.User.RepoPagingNum
|
||||
|
||||
if err := db.MirrorRepositoryList(mirrors).LoadAttributes(); err != nil {
|
||||
c.Handle(500, "MirrorRepositoryList.LoadAttributes", err)
|
||||
@@ -328,7 +328,7 @@ func Issues(c *context.Context) {
|
||||
|
||||
c.Data["Issues"] = issues
|
||||
c.Data["Repos"] = showRepos
|
||||
c.Data["Page"] = paginater.New(total, setting.UI.IssuePagingNum, page, 5)
|
||||
c.Data["Page"] = paginater.New(total, conf.UI.IssuePagingNum, page, 5)
|
||||
c.Data["IssueStats"] = issueStats
|
||||
c.Data["ViewType"] = string(filterMode)
|
||||
c.Data["SortType"] = sortType
|
||||
@@ -380,7 +380,7 @@ func showOrgProfile(c *context.Context) {
|
||||
err error
|
||||
)
|
||||
if c.IsLogged && !c.User.IsAdmin {
|
||||
repos, count, err = org.GetUserRepositories(c.User.ID, page, setting.UI.User.RepoPagingNum)
|
||||
repos, count, err = org.GetUserRepositories(c.User.ID, page, conf.UI.User.RepoPagingNum)
|
||||
if err != nil {
|
||||
c.Handle(500, "GetUserRepositories", err)
|
||||
return
|
||||
@@ -392,7 +392,7 @@ func showOrgProfile(c *context.Context) {
|
||||
UserID: org.ID,
|
||||
Private: showPrivate,
|
||||
Page: page,
|
||||
PageSize: setting.UI.User.RepoPagingNum,
|
||||
PageSize: conf.UI.User.RepoPagingNum,
|
||||
})
|
||||
if err != nil {
|
||||
c.Handle(500, "GetRepositories", err)
|
||||
@@ -401,7 +401,7 @@ func showOrgProfile(c *context.Context) {
|
||||
c.Data["Repos"] = repos
|
||||
count = db.CountUserRepositories(org.ID, showPrivate)
|
||||
}
|
||||
c.Data["Page"] = paginater.New(int(count), setting.UI.User.RepoPagingNum, page, 5)
|
||||
c.Data["Page"] = paginater.New(int(count), conf.UI.User.RepoPagingNum, page, 5)
|
||||
|
||||
if err := org.GetMembers(); err != nil {
|
||||
c.Handle(500, "GetMembers", err)
|
||||
@@ -420,5 +420,5 @@ func Email2User(c *context.Context) {
|
||||
c.NotFoundOrServerError("GetUserByEmail", errors.IsUserNotExist, err)
|
||||
return
|
||||
}
|
||||
c.Redirect(setting.AppSubURL + "/user/" + u.Name)
|
||||
c.Redirect(conf.Server.Subpath + "/user/" + u.Name)
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
|
||||
"gogs.io/gogs/internal/context"
|
||||
"gogs.io/gogs/internal/db"
|
||||
"gogs.io/gogs/internal/setting"
|
||||
"gogs.io/gogs/internal/conf"
|
||||
"gogs.io/gogs/internal/tool"
|
||||
)
|
||||
|
||||
@@ -70,7 +70,7 @@ func Profile(c *context.Context, puser *context.ParamsUser) {
|
||||
UserID: puser.ID,
|
||||
Private: showPrivate,
|
||||
Page: page,
|
||||
PageSize: setting.UI.User.RepoPagingNum,
|
||||
PageSize: conf.UI.User.RepoPagingNum,
|
||||
})
|
||||
if err != nil {
|
||||
c.ServerError("GetRepositories", err)
|
||||
@@ -78,7 +78,7 @@ func Profile(c *context.Context, puser *context.ParamsUser) {
|
||||
}
|
||||
|
||||
count := db.CountUserRepositories(puser.ID, showPrivate)
|
||||
c.Data["Page"] = paginater.New(int(count), setting.UI.User.RepoPagingNum, page, 5)
|
||||
c.Data["Page"] = paginater.New(int(count), conf.UI.User.RepoPagingNum, page, 5)
|
||||
}
|
||||
|
||||
c.Success(PROFILE)
|
||||
|
||||
@@ -18,12 +18,12 @@ import (
|
||||
"github.com/unknwon/com"
|
||||
log "unknwon.dev/clog/v2"
|
||||
|
||||
"gogs.io/gogs/internal/conf"
|
||||
"gogs.io/gogs/internal/context"
|
||||
"gogs.io/gogs/internal/db"
|
||||
"gogs.io/gogs/internal/db/errors"
|
||||
"gogs.io/gogs/internal/form"
|
||||
"gogs.io/gogs/internal/mailer"
|
||||
"gogs.io/gogs/internal/setting"
|
||||
"gogs.io/gogs/internal/tool"
|
||||
)
|
||||
|
||||
@@ -262,7 +262,7 @@ func SettingsEmailPost(c *context.Context, f form.AddEmail) {
|
||||
email := &db.EmailAddress{
|
||||
UID: c.User.ID,
|
||||
Email: f.Email,
|
||||
IsActivated: !setting.Service.RegisterEmailConfirm,
|
||||
IsActivated: !conf.Service.RegisterEmailConfirm,
|
||||
}
|
||||
if err := db.AddEmailAddress(email); err != nil {
|
||||
if db.IsErrEmailAlreadyUsed(err) {
|
||||
@@ -274,13 +274,13 @@ func SettingsEmailPost(c *context.Context, f form.AddEmail) {
|
||||
}
|
||||
|
||||
// Send confirmation email
|
||||
if setting.Service.RegisterEmailConfirm {
|
||||
if conf.Service.RegisterEmailConfirm {
|
||||
mailer.SendActivateEmailMail(c.Context, db.NewMailerUser(c.User), email.Email)
|
||||
|
||||
if err := c.Cache.Put("MailResendLimit_"+c.User.LowerName, c.User.LowerName, 180); err != nil {
|
||||
log.Error("Set cache 'MailResendLimit' failed: %v", err)
|
||||
}
|
||||
c.Flash.Info(c.Tr("settings.add_email_confirmation_sent", email.Email, setting.Service.ActiveCodeLives/60))
|
||||
c.Flash.Info(c.Tr("settings.add_email_confirmation_sent", email.Email, conf.Service.ActiveCodeLives/60))
|
||||
} else {
|
||||
c.Flash.Success(c.Tr("settings.add_email_success"))
|
||||
}
|
||||
@@ -299,7 +299,7 @@ func DeleteEmail(c *context.Context) {
|
||||
|
||||
c.Flash.Success(c.Tr("settings.email_deletion_success"))
|
||||
c.JSONSuccess(map[string]interface{}{
|
||||
"redirect": setting.AppSubURL + "/user/settings/email",
|
||||
"redirect": conf.Server.Subpath + "/user/settings/email",
|
||||
})
|
||||
}
|
||||
|
||||
@@ -371,7 +371,7 @@ func DeleteSSHKey(c *context.Context) {
|
||||
}
|
||||
|
||||
c.JSONSuccess(map[string]interface{}{
|
||||
"redirect": setting.AppSubURL + "/user/settings/ssh",
|
||||
"redirect": conf.Server.Subpath + "/user/settings/ssh",
|
||||
})
|
||||
}
|
||||
|
||||
@@ -406,7 +406,7 @@ func SettingsTwoFactorEnable(c *context.Context) {
|
||||
}
|
||||
if key == nil {
|
||||
key, err = totp.Generate(totp.GenerateOpts{
|
||||
Issuer: setting.AppName,
|
||||
Issuer: conf.App.BrandName,
|
||||
AccountName: c.User.Email,
|
||||
})
|
||||
if err != nil {
|
||||
@@ -506,7 +506,7 @@ func SettingsTwoFactorDisable(c *context.Context) {
|
||||
|
||||
c.Flash.Success(c.Tr("settings.two_factor_disable_success"))
|
||||
c.JSONSuccess(map[string]interface{}{
|
||||
"redirect": setting.AppSubURL + "/user/settings/security",
|
||||
"redirect": conf.Server.Subpath + "/user/settings/security",
|
||||
})
|
||||
}
|
||||
|
||||
@@ -542,7 +542,7 @@ func SettingsLeaveRepo(c *context.Context) {
|
||||
|
||||
c.Flash.Success(c.Tr("settings.repos.leave_success", repo.FullName()))
|
||||
c.JSONSuccess(map[string]interface{}{
|
||||
"redirect": setting.AppSubURL + "/user/settings/repositories",
|
||||
"redirect": conf.Server.Subpath + "/user/settings/repositories",
|
||||
})
|
||||
}
|
||||
|
||||
@@ -571,7 +571,7 @@ func SettingsLeaveOrganization(c *context.Context) {
|
||||
}
|
||||
|
||||
c.JSONSuccess(map[string]interface{}{
|
||||
"redirect": setting.AppSubURL + "/user/settings/organizations",
|
||||
"redirect": conf.Server.Subpath + "/user/settings/organizations",
|
||||
})
|
||||
}
|
||||
|
||||
@@ -632,7 +632,7 @@ func SettingsDeleteApplication(c *context.Context) {
|
||||
}
|
||||
|
||||
c.JSONSuccess(map[string]interface{}{
|
||||
"redirect": setting.AppSubURL + "/user/settings/applications",
|
||||
"redirect": conf.Server.Subpath + "/user/settings/applications",
|
||||
})
|
||||
}
|
||||
|
||||
@@ -654,16 +654,16 @@ func SettingsDelete(c *context.Context) {
|
||||
switch {
|
||||
case db.IsErrUserOwnRepos(err):
|
||||
c.Flash.Error(c.Tr("form.still_own_repo"))
|
||||
c.Redirect(setting.AppSubURL + "/user/settings/delete")
|
||||
c.Redirect(conf.Server.Subpath + "/user/settings/delete")
|
||||
case db.IsErrUserHasOrgs(err):
|
||||
c.Flash.Error(c.Tr("form.still_has_org"))
|
||||
c.Redirect(setting.AppSubURL + "/user/settings/delete")
|
||||
c.Redirect(conf.Server.Subpath + "/user/settings/delete")
|
||||
default:
|
||||
c.ServerError("DeleteUser", err)
|
||||
}
|
||||
} else {
|
||||
log.Trace("Account deleted: %s", c.User.Name)
|
||||
c.Redirect(setting.AppSubURL + "/")
|
||||
c.Redirect(conf.Server.Subpath + "/")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user