mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-17 11:59:30 +00:00
Golint fixed for modules/setting (#262)
* golint fixed for modules/setting * typo fixed and renamed UNIXSOCKET to UnixSocket
This commit is contained in:
parent
0a76d260fa
commit
94da472717
38 changed files with 178 additions and 167 deletions
|
@ -164,7 +164,7 @@ func Dashboard(ctx *context.Context) {
|
|||
} else {
|
||||
ctx.Flash.Success(success)
|
||||
}
|
||||
ctx.Redirect(setting.AppSubUrl + "/admin")
|
||||
ctx.Redirect(setting.AppSubURL + "/admin")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ func SendTestMail(ctx *context.Context) {
|
|||
ctx.Flash.Info(ctx.Tr("admin.config.test_mail_sent", email))
|
||||
}
|
||||
|
||||
ctx.Redirect(setting.AppSubUrl + "/admin/config")
|
||||
ctx.Redirect(setting.AppSubURL + "/admin/config")
|
||||
}
|
||||
|
||||
// Config show admin config page
|
||||
|
@ -194,7 +194,7 @@ func Config(ctx *context.Context) {
|
|||
ctx.Data["PageIsAdmin"] = true
|
||||
ctx.Data["PageIsAdminConfig"] = true
|
||||
|
||||
ctx.Data["AppUrl"] = setting.AppUrl
|
||||
ctx.Data["AppUrl"] = setting.AppURL
|
||||
ctx.Data["Domain"] = setting.Domain
|
||||
ctx.Data["OfflineMode"] = setting.OfflineMode
|
||||
ctx.Data["DisableRouterLog"] = setting.DisableRouterLog
|
||||
|
|
|
@ -167,7 +167,7 @@ func NewAuthSourcePost(ctx *context.Context, form auth.AuthenticationForm) {
|
|||
log.Trace("Authentication created by admin(%s): %s", ctx.User.Name, form.Name)
|
||||
|
||||
ctx.Flash.Success(ctx.Tr("admin.auths.new_success", form.Name))
|
||||
ctx.Redirect(setting.AppSubUrl + "/admin/auths")
|
||||
ctx.Redirect(setting.AppSubURL + "/admin/auths")
|
||||
}
|
||||
|
||||
// EditAuthSource render editing auth source page
|
||||
|
@ -236,7 +236,7 @@ func EditAuthSourcePost(ctx *context.Context, form auth.AuthenticationForm) {
|
|||
log.Trace("Authentication changed by admin(%s): %s", ctx.User.Name, source.ID)
|
||||
|
||||
ctx.Flash.Success(ctx.Tr("admin.auths.update_success"))
|
||||
ctx.Redirect(setting.AppSubUrl + "/admin/auths/" + com.ToStr(form.ID))
|
||||
ctx.Redirect(setting.AppSubURL + "/admin/auths/" + com.ToStr(form.ID))
|
||||
}
|
||||
|
||||
// DeleteAuthSource response for deleting an auth source
|
||||
|
@ -254,7 +254,7 @@ func DeleteAuthSource(ctx *context.Context) {
|
|||
ctx.Flash.Error(fmt.Sprintf("DeleteSource: %v", err))
|
||||
}
|
||||
ctx.JSON(200, map[string]interface{}{
|
||||
"redirect": setting.AppSubUrl + "/admin/auths/" + ctx.Params(":authid"),
|
||||
"redirect": setting.AppSubURL + "/admin/auths/" + ctx.Params(":authid"),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
@ -262,6 +262,6 @@ func DeleteAuthSource(ctx *context.Context) {
|
|||
|
||||
ctx.Flash.Success(ctx.Tr("admin.auths.deletion_success"))
|
||||
ctx.JSON(200, map[string]interface{}{
|
||||
"redirect": setting.AppSubUrl + "/admin/auths",
|
||||
"redirect": setting.AppSubURL + "/admin/auths",
|
||||
})
|
||||
}
|
||||
|
|
|
@ -72,5 +72,5 @@ func EmptyNotices(ctx *context.Context) {
|
|||
|
||||
log.Trace("System notices deleted by admin (%s): [start: %d]", ctx.User.Name, 0)
|
||||
ctx.Flash.Success(ctx.Tr("admin.notices.delete_success"))
|
||||
ctx.Redirect(setting.AppSubUrl + "/admin/notices")
|
||||
ctx.Redirect(setting.AppSubURL + "/admin/notices")
|
||||
}
|
||||
|
|
|
@ -49,6 +49,6 @@ func DeleteRepo(ctx *context.Context) {
|
|||
|
||||
ctx.Flash.Success(ctx.Tr("repo.settings.deletion_success"))
|
||||
ctx.JSON(200, map[string]interface{}{
|
||||
"redirect": setting.AppSubUrl + "/admin/repos?page=" + ctx.Query("page"),
|
||||
"redirect": setting.AppSubURL + "/admin/repos?page=" + ctx.Query("page"),
|
||||
})
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ func NewUserPost(ctx *context.Context, form auth.AdminCrateUserForm) {
|
|||
}
|
||||
|
||||
ctx.Flash.Success(ctx.Tr("admin.users.new_success", u.Name))
|
||||
ctx.Redirect(setting.AppSubUrl + "/admin/users/" + com.ToStr(u.ID))
|
||||
ctx.Redirect(setting.AppSubURL + "/admin/users/" + com.ToStr(u.ID))
|
||||
}
|
||||
|
||||
func prepareUserInfo(ctx *context.Context) *models.User {
|
||||
|
@ -225,7 +225,7 @@ func EditUserPost(ctx *context.Context, form auth.AdminEditUserForm) {
|
|||
log.Trace("Account profile updated by admin (%s): %s", ctx.User.Name, u.Name)
|
||||
|
||||
ctx.Flash.Success(ctx.Tr("admin.users.update_profile_success"))
|
||||
ctx.Redirect(setting.AppSubUrl + "/admin/users/" + ctx.Params(":userid"))
|
||||
ctx.Redirect(setting.AppSubURL + "/admin/users/" + ctx.Params(":userid"))
|
||||
}
|
||||
|
||||
// DeleteUser response for deleting a user
|
||||
|
@ -241,12 +241,12 @@ func DeleteUser(ctx *context.Context) {
|
|||
case models.IsErrUserOwnRepos(err):
|
||||
ctx.Flash.Error(ctx.Tr("admin.users.still_own_repo"))
|
||||
ctx.JSON(200, map[string]interface{}{
|
||||
"redirect": setting.AppSubUrl + "/admin/users/" + ctx.Params(":userid"),
|
||||
"redirect": setting.AppSubURL + "/admin/users/" + ctx.Params(":userid"),
|
||||
})
|
||||
case models.IsErrUserHasOrgs(err):
|
||||
ctx.Flash.Error(ctx.Tr("admin.users.still_has_org"))
|
||||
ctx.JSON(200, map[string]interface{}{
|
||||
"redirect": setting.AppSubUrl + "/admin/users/" + ctx.Params(":userid"),
|
||||
"redirect": setting.AppSubURL + "/admin/users/" + ctx.Params(":userid"),
|
||||
})
|
||||
default:
|
||||
ctx.Handle(500, "DeleteUser", err)
|
||||
|
@ -257,6 +257,6 @@ func DeleteUser(ctx *context.Context) {
|
|||
|
||||
ctx.Flash.Success(ctx.Tr("admin.users.deletion_success"))
|
||||
ctx.JSON(200, map[string]interface{}{
|
||||
"redirect": setting.AppSubUrl + "/admin/users",
|
||||
"redirect": setting.AppSubURL + "/admin/users",
|
||||
})
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import (
|
|||
)
|
||||
|
||||
func composeDeployKeysAPILink(repoPath string) string {
|
||||
return setting.AppUrl + "api/v1/repos/" + repoPath + "/keys/"
|
||||
return setting.AppURL + "api/v1/repos/" + repoPath + "/keys/"
|
||||
}
|
||||
|
||||
// ListDeployKeys list all the deploy keys of a repository
|
||||
|
|
|
@ -34,7 +34,7 @@ func GetUserByParams(ctx *context.APIContext) *models.User {
|
|||
}
|
||||
|
||||
func composePublicKeysAPILink() string {
|
||||
return setting.AppUrl + "api/v1/user/keys/"
|
||||
return setting.AppURL + "api/v1/user/keys/"
|
||||
}
|
||||
|
||||
func listPublicKeys(ctx *context.APIContext, uid int64) {
|
||||
|
|
|
@ -16,7 +16,7 @@ func TemplatePreview(ctx *context.Context) {
|
|||
ctx.Data["User"] = models.User{Name: "Unknown"}
|
||||
ctx.Data["AppName"] = setting.AppName
|
||||
ctx.Data["AppVer"] = setting.AppVer
|
||||
ctx.Data["AppUrl"] = setting.AppUrl
|
||||
ctx.Data["AppUrl"] = setting.AppURL
|
||||
ctx.Data["Code"] = "2014031910370000009fff6782aadb2162b4a997acb69d4400888e0b9274657374"
|
||||
ctx.Data["ActiveCodeLives"] = setting.Service.ActiveCodeLives / 60
|
||||
ctx.Data["ResetPwdCodeLives"] = setting.Service.ResetPwdCodeLives / 60
|
||||
|
|
|
@ -42,7 +42,7 @@ func Home(ctx *context.Context) {
|
|||
// Check auto-login.
|
||||
uname := ctx.GetCookie(setting.CookieUserName)
|
||||
if len(uname) != 0 {
|
||||
ctx.Redirect(setting.AppSubUrl + "/user/login")
|
||||
ctx.Redirect(setting.AppSubURL + "/user/login")
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ func Install(ctx *context.Context) {
|
|||
form.Domain = setting.Domain
|
||||
form.SSHPort = setting.SSH.Port
|
||||
form.HTTPPort = setting.HTTPPort
|
||||
form.AppUrl = setting.AppUrl
|
||||
form.AppUrl = setting.AppURL
|
||||
form.LogRootPath = setting.LogRootPath
|
||||
|
||||
// E-mail service settings
|
||||
|
|
|
@ -91,7 +91,7 @@ func MembersAction(ctx *context.Context) {
|
|||
if ctx.Params(":action") != "leave" {
|
||||
ctx.Redirect(ctx.Org.OrgLink + "/members")
|
||||
} else {
|
||||
ctx.Redirect(setting.AppSubUrl + "/")
|
||||
ctx.Redirect(setting.AppSubURL + "/")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,5 +55,5 @@ func CreatePost(ctx *context.Context, form auth.CreateOrgForm) {
|
|||
}
|
||||
log.Trace("Organization created: %s", org.Name)
|
||||
|
||||
ctx.Redirect(setting.AppSubUrl + "/org/" + form.OrgName + "/dashboard")
|
||||
ctx.Redirect(setting.AppSubURL + "/org/" + form.OrgName + "/dashboard")
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ func SettingsPost(ctx *context.Context, form auth.UpdateOrgSettingForm) {
|
|||
return
|
||||
}
|
||||
// reset ctx.org.OrgLink with new name
|
||||
ctx.Org.OrgLink = setting.AppSubUrl + "/org/" + form.Name
|
||||
ctx.Org.OrgLink = setting.AppSubURL + "/org/" + form.Name
|
||||
log.Trace("Organization name changed: %s -> %s", org.Name, form.Name)
|
||||
}
|
||||
// In case it's just a case change.
|
||||
|
@ -134,7 +134,7 @@ func SettingsDelete(ctx *context.Context) {
|
|||
}
|
||||
} else {
|
||||
log.Trace("Organization deleted: %s", org.Name)
|
||||
ctx.Redirect(setting.AppSubUrl + "/")
|
||||
ctx.Redirect(setting.AppSubURL + "/")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
@ -194,11 +194,11 @@ func Diff(ctx *context.Context) {
|
|||
ctx.Data["Diff"] = diff
|
||||
ctx.Data["Parents"] = parents
|
||||
ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
|
||||
ctx.Data["SourcePath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "src", commitID)
|
||||
ctx.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", commitID)
|
||||
if commit.ParentCount() > 0 {
|
||||
ctx.Data["BeforeSourcePath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "src", parents[0])
|
||||
ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", parents[0])
|
||||
}
|
||||
ctx.Data["RawPath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "raw", commitID)
|
||||
ctx.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "raw", commitID)
|
||||
ctx.HTML(200, tplDiff)
|
||||
}
|
||||
|
||||
|
@ -257,8 +257,8 @@ func CompareDiff(ctx *context.Context) {
|
|||
ctx.Data["Commit"] = commit
|
||||
ctx.Data["Diff"] = diff
|
||||
ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
|
||||
ctx.Data["SourcePath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "src", afterCommitID)
|
||||
ctx.Data["BeforeSourcePath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "src", beforeCommitID)
|
||||
ctx.Data["RawPath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "raw", afterCommitID)
|
||||
ctx.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", afterCommitID)
|
||||
ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", beforeCommitID)
|
||||
ctx.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "raw", afterCommitID)
|
||||
ctx.HTML(200, tplDiff)
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ func editFile(ctx *context.Context, isNewFile bool) {
|
|||
ctx.Data["MarkdownFileExts"] = strings.Join(setting.Markdown.FileExtensions, ",")
|
||||
ctx.Data["LineWrapExtensions"] = strings.Join(setting.Repository.Editor.LineWrapExtensions, ",")
|
||||
ctx.Data["PreviewableFileModes"] = strings.Join(setting.Repository.Editor.PreviewableFileModes, ",")
|
||||
ctx.Data["EditorconfigURLPrefix"] = fmt.Sprintf("%s/api/v1/repos/%s/editorconfig/", setting.AppSubUrl, ctx.Repo.Repository.FullName())
|
||||
ctx.Data["EditorconfigURLPrefix"] = fmt.Sprintf("%s/api/v1/repos/%s/editorconfig/", setting.AppSubURL, ctx.Repo.Repository.FullName())
|
||||
|
||||
ctx.HTML(200, tplEditFile)
|
||||
}
|
||||
|
|
|
@ -123,8 +123,8 @@ func Issues(ctx *context.Context) {
|
|||
|
||||
// Must sign in to see issues about you.
|
||||
if viewType != "all" && !ctx.IsSigned {
|
||||
ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppSubUrl+ctx.Req.RequestURI), 0, setting.AppSubUrl)
|
||||
ctx.Redirect(setting.AppSubUrl + "/user/login")
|
||||
ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppSubURL+ctx.Req.RequestURI), 0, setting.AppSubURL)
|
||||
ctx.Redirect(setting.AppSubURL + "/user/login")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -651,7 +651,7 @@ func ViewIssue(ctx *context.Context) {
|
|||
ctx.Data["NumParticipants"] = len(participants)
|
||||
ctx.Data["Issue"] = issue
|
||||
ctx.Data["IsIssueOwner"] = ctx.Repo.IsWriter() || (ctx.IsSigned && issue.IsPoster(ctx.User.ID))
|
||||
ctx.Data["SignInLink"] = setting.AppSubUrl + "/user/login?redirect_to=" + ctx.Data["Link"].(string)
|
||||
ctx.Data["SignInLink"] = setting.AppSubURL + "/user/login?redirect_to=" + ctx.Data["Link"].(string)
|
||||
ctx.HTML(200, tplIssueView)
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ func ForkPost(ctx *context.Context, form auth.CreateRepoForm) {
|
|||
|
||||
repo, has := models.HasForkedRepo(ctxUser.ID, forkRepo.ID)
|
||||
if has {
|
||||
ctx.Redirect(setting.AppSubUrl + "/" + ctxUser.Name + "/" + repo.Name)
|
||||
ctx.Redirect(setting.AppSubURL + "/" + ctxUser.Name + "/" + repo.Name)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ func ForkPost(ctx *context.Context, form auth.CreateRepoForm) {
|
|||
}
|
||||
|
||||
log.Trace("Repository forked[%d]: %s/%s", forkRepo.ID, ctxUser.Name, repo.Name)
|
||||
ctx.Redirect(setting.AppSubUrl + "/" + ctxUser.Name + "/" + repo.Name)
|
||||
ctx.Redirect(setting.AppSubURL + "/" + ctxUser.Name + "/" + repo.Name)
|
||||
}
|
||||
|
||||
func checkPullInfo(ctx *context.Context) *models.Issue {
|
||||
|
@ -376,9 +376,9 @@ func ViewPullFiles(ctx *context.Context) {
|
|||
ctx.Data["Username"] = pull.HeadUserName
|
||||
ctx.Data["Reponame"] = pull.HeadRepo.Name
|
||||
ctx.Data["IsImageFile"] = commit.IsImageFile
|
||||
ctx.Data["SourcePath"] = setting.AppSubUrl + "/" + path.Join(headTarget, "src", endCommitID)
|
||||
ctx.Data["BeforeSourcePath"] = setting.AppSubUrl + "/" + path.Join(headTarget, "src", startCommitID)
|
||||
ctx.Data["RawPath"] = setting.AppSubUrl + "/" + path.Join(headTarget, "raw", endCommitID)
|
||||
ctx.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(headTarget, "src", endCommitID)
|
||||
ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(headTarget, "src", startCommitID)
|
||||
ctx.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(headTarget, "raw", endCommitID)
|
||||
ctx.Data["RequireHighlightJS"] = true
|
||||
|
||||
ctx.HTML(200, tplPullFiles)
|
||||
|
@ -581,9 +581,9 @@ func PrepareCompareDiff(
|
|||
ctx.Data["IsImageFile"] = headCommit.IsImageFile
|
||||
|
||||
headTarget := path.Join(headUser.Name, repo.Name)
|
||||
ctx.Data["SourcePath"] = setting.AppSubUrl + "/" + path.Join(headTarget, "src", headCommitID)
|
||||
ctx.Data["BeforeSourcePath"] = setting.AppSubUrl + "/" + path.Join(headTarget, "src", prInfo.MergeBase)
|
||||
ctx.Data["RawPath"] = setting.AppSubUrl + "/" + path.Join(headTarget, "raw", headCommitID)
|
||||
ctx.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(headTarget, "src", headCommitID)
|
||||
ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(headTarget, "src", prInfo.MergeBase)
|
||||
ctx.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(headTarget, "raw", headCommitID)
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ func CreatePost(ctx *context.Context, form auth.CreateRepoForm) {
|
|||
})
|
||||
if err == nil {
|
||||
log.Trace("Repository created [%d]: %s/%s", repo.ID, ctxUser.Name, repo.Name)
|
||||
ctx.Redirect(setting.AppSubUrl + "/" + ctxUser.Name + "/" + repo.Name)
|
||||
ctx.Redirect(setting.AppSubURL + "/" + ctxUser.Name + "/" + repo.Name)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -208,7 +208,7 @@ func MigratePost(ctx *context.Context, form auth.MigrateRepoForm) {
|
|||
})
|
||||
if err == nil {
|
||||
log.Trace("Repository migrated [%d]: %s/%s", repo.ID, ctxUser.Name, form.RepoName)
|
||||
ctx.Redirect(setting.AppSubUrl + "/" + ctxUser.Name + "/" + form.RepoName)
|
||||
ctx.Redirect(setting.AppSubURL + "/" + ctxUser.Name + "/" + form.RepoName)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) {
|
|||
}
|
||||
log.Trace("Repository converted from mirror to regular: %s/%s", ctx.Repo.Owner.Name, repo.Name)
|
||||
ctx.Flash.Success(ctx.Tr("repo.settings.convert_succeed"))
|
||||
ctx.Redirect(setting.AppSubUrl + "/" + ctx.Repo.Owner.Name + "/" + repo.Name)
|
||||
ctx.Redirect(setting.AppSubURL + "/" + ctx.Repo.Owner.Name + "/" + repo.Name)
|
||||
|
||||
case "transfer":
|
||||
if !ctx.Repo.IsOwner() {
|
||||
|
@ -233,7 +233,7 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) {
|
|||
}
|
||||
log.Trace("Repository transfered: %s/%s -> %s", ctx.Repo.Owner.Name, repo.Name, newOwner)
|
||||
ctx.Flash.Success(ctx.Tr("repo.settings.transfer_succeed"))
|
||||
ctx.Redirect(setting.AppSubUrl + "/" + newOwner + "/" + repo.Name)
|
||||
ctx.Redirect(setting.AppSubURL + "/" + newOwner + "/" + repo.Name)
|
||||
|
||||
case "delete":
|
||||
if !ctx.Repo.IsOwner() {
|
||||
|
@ -314,7 +314,7 @@ func Collaboration(ctx *context.Context) {
|
|||
func CollaborationPost(ctx *context.Context) {
|
||||
name := strings.ToLower(ctx.Query("collaborator"))
|
||||
if len(name) == 0 || ctx.Repo.Owner.LowerName == name {
|
||||
ctx.Redirect(setting.AppSubUrl + ctx.Req.URL.Path)
|
||||
ctx.Redirect(setting.AppSubURL + ctx.Req.URL.Path)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -322,7 +322,7 @@ func CollaborationPost(ctx *context.Context) {
|
|||
if err != nil {
|
||||
if models.IsErrUserNotExist(err) {
|
||||
ctx.Flash.Error(ctx.Tr("form.user_not_exist"))
|
||||
ctx.Redirect(setting.AppSubUrl + ctx.Req.URL.Path)
|
||||
ctx.Redirect(setting.AppSubURL + ctx.Req.URL.Path)
|
||||
} else {
|
||||
ctx.Handle(500, "GetUserByName", err)
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ func CollaborationPost(ctx *context.Context) {
|
|||
// Organization is not allowed to be added as a collaborator.
|
||||
if u.IsOrganization() {
|
||||
ctx.Flash.Error(ctx.Tr("repo.settings.org_not_allowed_to_be_collaborator"))
|
||||
ctx.Redirect(setting.AppSubUrl + ctx.Req.URL.Path)
|
||||
ctx.Redirect(setting.AppSubURL + ctx.Req.URL.Path)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -353,7 +353,7 @@ func CollaborationPost(ctx *context.Context) {
|
|||
}
|
||||
|
||||
ctx.Flash.Success(ctx.Tr("repo.settings.add_collaborator_success"))
|
||||
ctx.Redirect(setting.AppSubUrl + ctx.Req.URL.Path)
|
||||
ctx.Redirect(setting.AppSubURL + ctx.Req.URL.Path)
|
||||
}
|
||||
|
||||
// ChangeCollaborationAccessMode response for changing access of a collaboration
|
||||
|
|
|
@ -44,8 +44,8 @@ func AutoSignIn(ctx *context.Context) (bool, error) {
|
|||
defer func() {
|
||||
if !isSucceed {
|
||||
log.Trace("auto-login cookie cleared: %s", uname)
|
||||
ctx.SetCookie(setting.CookieUserName, "", -1, setting.AppSubUrl)
|
||||
ctx.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubUrl)
|
||||
ctx.SetCookie(setting.CookieUserName, "", -1, setting.AppSubURL)
|
||||
ctx.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubURL)
|
||||
}
|
||||
}()
|
||||
|
||||
|
@ -65,7 +65,7 @@ func AutoSignIn(ctx *context.Context) (bool, error) {
|
|||
isSucceed = true
|
||||
ctx.Session.Set("uid", u.ID)
|
||||
ctx.Session.Set("uname", u.Name)
|
||||
ctx.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubUrl)
|
||||
ctx.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubURL)
|
||||
return true, nil
|
||||
}
|
||||
|
||||
|
@ -82,17 +82,17 @@ func SignIn(ctx *context.Context) {
|
|||
|
||||
redirectTo := ctx.Query("redirect_to")
|
||||
if len(redirectTo) > 0 {
|
||||
ctx.SetCookie("redirect_to", redirectTo, 0, setting.AppSubUrl)
|
||||
ctx.SetCookie("redirect_to", redirectTo, 0, setting.AppSubURL)
|
||||
} else {
|
||||
redirectTo, _ = url.QueryUnescape(ctx.GetCookie("redirect_to"))
|
||||
}
|
||||
|
||||
if isSucceed {
|
||||
if len(redirectTo) > 0 {
|
||||
ctx.SetCookie("redirect_to", "", -1, setting.AppSubUrl)
|
||||
ctx.SetCookie("redirect_to", "", -1, setting.AppSubURL)
|
||||
ctx.Redirect(redirectTo)
|
||||
} else {
|
||||
ctx.Redirect(setting.AppSubUrl + "/")
|
||||
ctx.Redirect(setting.AppSubURL + "/")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -121,16 +121,16 @@ func SignInPost(ctx *context.Context, form auth.SignInForm) {
|
|||
|
||||
if form.Remember {
|
||||
days := 86400 * setting.LogInRememberDays
|
||||
ctx.SetCookie(setting.CookieUserName, u.Name, days, setting.AppSubUrl)
|
||||
ctx.SetCookie(setting.CookieUserName, u.Name, days, setting.AppSubURL)
|
||||
ctx.SetSuperSecureCookie(base.EncodeMD5(u.Rands+u.Passwd),
|
||||
setting.CookieRememberName, u.Name, days, setting.AppSubUrl)
|
||||
setting.CookieRememberName, u.Name, days, setting.AppSubURL)
|
||||
}
|
||||
|
||||
ctx.Session.Set("uid", u.ID)
|
||||
ctx.Session.Set("uname", u.Name)
|
||||
|
||||
// Clear whatever CSRF has right now, force to generate a new one
|
||||
ctx.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubUrl)
|
||||
ctx.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubURL)
|
||||
|
||||
// Register last login
|
||||
u.SetLastLogin()
|
||||
|
@ -140,12 +140,12 @@ func SignInPost(ctx *context.Context, form auth.SignInForm) {
|
|||
}
|
||||
|
||||
if redirectTo, _ := url.QueryUnescape(ctx.GetCookie("redirect_to")); len(redirectTo) > 0 {
|
||||
ctx.SetCookie("redirect_to", "", -1, setting.AppSubUrl)
|
||||
ctx.SetCookie("redirect_to", "", -1, setting.AppSubURL)
|
||||
ctx.Redirect(redirectTo)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Redirect(setting.AppSubUrl + "/")
|
||||
ctx.Redirect(setting.AppSubURL + "/")
|
||||
}
|
||||
|
||||
// SignOut sign out from login status
|
||||
|
@ -155,10 +155,10 @@ func SignOut(ctx *context.Context) {
|
|||
ctx.Session.Delete("socialId")
|
||||
ctx.Session.Delete("socialName")
|
||||
ctx.Session.Delete("socialEmail")
|
||||
ctx.SetCookie(setting.CookieUserName, "", -1, setting.AppSubUrl)
|
||||
ctx.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubUrl)
|
||||
ctx.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubUrl)
|
||||
ctx.Redirect(setting.AppSubUrl + "/")
|
||||
ctx.SetCookie(setting.CookieUserName, "", -1, setting.AppSubURL)
|
||||
ctx.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubURL)
|
||||
ctx.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubURL)
|
||||
ctx.Redirect(setting.AppSubURL + "/")
|
||||
}
|
||||
|
||||
// SignUp render the register page
|
||||
|
@ -255,7 +255,7 @@ func SignUpPost(ctx *context.Context, cpt *captcha.Captcha, form auth.RegisterFo
|
|||
return
|
||||
}
|
||||
|
||||
ctx.Redirect(setting.AppSubUrl + "/user/login")
|
||||
ctx.Redirect(setting.AppSubURL + "/user/login")
|
||||
}
|
||||
|
||||
// Activate render activate user page
|
||||
|
@ -303,7 +303,7 @@ func Activate(ctx *context.Context) {
|
|||
|
||||
ctx.Session.Set("uid", user.ID)
|
||||
ctx.Session.Set("uname", user.Name)
|
||||
ctx.Redirect(setting.AppSubUrl + "/")
|
||||
ctx.Redirect(setting.AppSubURL + "/")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -326,7 +326,7 @@ func ActivateEmail(ctx *context.Context) {
|
|||
ctx.Flash.Success(ctx.Tr("settings.add_email_success"))
|
||||
}
|
||||
|
||||
ctx.Redirect(setting.AppSubUrl + "/user/settings/email")
|
||||
ctx.Redirect(setting.AppSubURL + "/user/settings/email")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -437,7 +437,7 @@ func ResetPasswdPost(ctx *context.Context) {
|
|||
}
|
||||
|
||||
log.Trace("User password reset: %s", u.Name)
|
||||
ctx.Redirect(setting.AppSubUrl + "/user/login")
|
||||
ctx.Redirect(setting.AppSubURL + "/user/login")
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -390,5 +390,5 @@ func Email2User(ctx *context.Context) {
|
|||
}
|
||||
return
|
||||
}
|
||||
ctx.Redirect(setting.AppSubUrl + "/user/" + u.Name)
|
||||
ctx.Redirect(setting.AppSubURL + "/user/" + u.Name)
|
||||
}
|
||||
|
|
|
@ -52,16 +52,16 @@ func handleUsernameChange(ctx *context.Context, newName string) {
|
|||
switch {
|
||||
case models.IsErrUserAlreadyExist(err):
|
||||
ctx.Flash.Error(ctx.Tr("newName_been_taken"))
|
||||
ctx.Redirect(setting.AppSubUrl + "/user/settings")
|
||||
ctx.Redirect(setting.AppSubURL + "/user/settings")
|
||||
case models.IsErrEmailAlreadyUsed(err):
|
||||
ctx.Flash.Error(ctx.Tr("form.email_been_used"))
|
||||
ctx.Redirect(setting.AppSubUrl + "/user/settings")
|
||||
ctx.Redirect(setting.AppSubURL + "/user/settings")
|
||||
case models.IsErrNameReserved(err):
|
||||
ctx.Flash.Error(ctx.Tr("user.newName_reserved"))
|
||||
ctx.Redirect(setting.AppSubUrl + "/user/settings")
|
||||
ctx.Redirect(setting.AppSubURL + "/user/settings")
|
||||
case models.IsErrNamePatternNotAllowed(err):
|
||||
ctx.Flash.Error(ctx.Tr("user.newName_pattern_not_allowed"))
|
||||
ctx.Redirect(setting.AppSubUrl + "/user/settings")
|
||||
ctx.Redirect(setting.AppSubURL + "/user/settings")
|
||||
default:
|
||||
ctx.Handle(500, "ChangeUserName", err)
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ func SettingsPost(ctx *context.Context, form auth.UpdateProfileForm) {
|
|||
|
||||
log.Trace("User settings updated: %s", ctx.User.Name)
|
||||
ctx.Flash.Success(ctx.Tr("settings.update_profile_success"))
|
||||
ctx.Redirect(setting.AppSubUrl + "/user/settings")
|
||||
ctx.Redirect(setting.AppSubURL + "/user/settings")
|
||||
}
|
||||
|
||||
// UpdateAvatarSetting update user's avatar
|
||||
|
@ -162,7 +162,7 @@ func SettingsAvatarPost(ctx *context.Context, form auth.AvatarForm) {
|
|||
ctx.Flash.Success(ctx.Tr("settings.update_avatar_success"))
|
||||
}
|
||||
|
||||
ctx.Redirect(setting.AppSubUrl + "/user/settings/avatar")
|
||||
ctx.Redirect(setting.AppSubURL + "/user/settings/avatar")
|
||||
}
|
||||
|
||||
// SettingsDeleteAvatar render delete avatar page
|
||||
|
@ -171,7 +171,7 @@ func SettingsDeleteAvatar(ctx *context.Context) {
|
|||
ctx.Flash.Error(err.Error())
|
||||
}
|
||||
|
||||
ctx.Redirect(setting.AppSubUrl + "/user/settings/avatar")
|
||||
ctx.Redirect(setting.AppSubURL + "/user/settings/avatar")
|
||||
}
|
||||
|
||||
// SettingsPassword render change user's password page
|
||||
|
@ -207,7 +207,7 @@ func SettingsPasswordPost(ctx *context.Context, form auth.ChangePasswordForm) {
|
|||
ctx.Flash.Success(ctx.Tr("settings.change_password_success"))
|
||||
}
|
||||
|
||||
ctx.Redirect(setting.AppSubUrl + "/user/settings/password")
|
||||
ctx.Redirect(setting.AppSubURL + "/user/settings/password")
|
||||
}
|
||||
|
||||
// SettingsEmails render user's emails page
|
||||
|
@ -238,7 +238,7 @@ func SettingsEmailPost(ctx *context.Context, form auth.AddEmailForm) {
|
|||
}
|
||||
|
||||
log.Trace("Email made primary: %s", ctx.User.Name)
|
||||
ctx.Redirect(setting.AppSubUrl + "/user/settings/email")
|
||||
ctx.Redirect(setting.AppSubURL + "/user/settings/email")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -282,7 +282,7 @@ func SettingsEmailPost(ctx *context.Context, form auth.AddEmailForm) {
|
|||
}
|
||||
|
||||
log.Trace("Email address added: %s", email.Email)
|
||||
ctx.Redirect(setting.AppSubUrl + "/user/settings/email")
|
||||
ctx.Redirect(setting.AppSubURL + "/user/settings/email")
|
||||
}
|
||||
|
||||
// DeleteEmail reponse for delete user's email
|
||||
|
@ -295,7 +295,7 @@ func DeleteEmail(ctx *context.Context) {
|
|||
|
||||
ctx.Flash.Success(ctx.Tr("settings.email_deletion_success"))
|
||||
ctx.JSON(200, map[string]interface{}{
|
||||
"redirect": setting.AppSubUrl + "/user/settings/email",
|
||||
"redirect": setting.AppSubURL + "/user/settings/email",
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -337,7 +337,7 @@ func SettingsSSHKeysPost(ctx *context.Context, form auth.AddSSHKeyForm) {
|
|||
ctx.Flash.Info(ctx.Tr("form.unable_verify_ssh_key"))
|
||||
} else {
|
||||
ctx.Flash.Error(ctx.Tr("form.invalid_ssh_key", err.Error()))
|
||||
ctx.Redirect(setting.AppSubUrl + "/user/settings/ssh")
|
||||
ctx.Redirect(setting.AppSubURL + "/user/settings/ssh")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -358,7 +358,7 @@ func SettingsSSHKeysPost(ctx *context.Context, form auth.AddSSHKeyForm) {
|
|||
}
|
||||
|
||||
ctx.Flash.Success(ctx.Tr("settings.add_key_success", form.Title))
|
||||
ctx.Redirect(setting.AppSubUrl + "/user/settings/ssh")
|
||||
ctx.Redirect(setting.AppSubURL + "/user/settings/ssh")
|
||||
}
|
||||
|
||||
// DeleteSSHKey response for delete user's SSH key
|
||||
|
@ -370,7 +370,7 @@ func DeleteSSHKey(ctx *context.Context) {
|
|||
}
|
||||
|
||||
ctx.JSON(200, map[string]interface{}{
|
||||
"redirect": setting.AppSubUrl + "/user/settings/ssh",
|
||||
"redirect": setting.AppSubURL + "/user/settings/ssh",
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -417,7 +417,7 @@ func SettingsApplicationsPost(ctx *context.Context, form auth.NewAccessTokenForm
|
|||
ctx.Flash.Success(ctx.Tr("settings.generate_token_succees"))
|
||||
ctx.Flash.Info(t.Sha1)
|
||||
|
||||
ctx.Redirect(setting.AppSubUrl + "/user/settings/applications")
|
||||
ctx.Redirect(setting.AppSubURL + "/user/settings/applications")
|
||||
}
|
||||
|
||||
// SettingsDeleteApplication response for delete user access token
|
||||
|
@ -429,7 +429,7 @@ func SettingsDeleteApplication(ctx *context.Context) {
|
|||
}
|
||||
|
||||
ctx.JSON(200, map[string]interface{}{
|
||||
"redirect": setting.AppSubUrl + "/user/settings/applications",
|
||||
"redirect": setting.AppSubURL + "/user/settings/applications",
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -452,16 +452,16 @@ func SettingsDelete(ctx *context.Context) {
|
|||
switch {
|
||||
case models.IsErrUserOwnRepos(err):
|
||||
ctx.Flash.Error(ctx.Tr("form.still_own_repo"))
|
||||
ctx.Redirect(setting.AppSubUrl + "/user/settings/delete")
|
||||
ctx.Redirect(setting.AppSubURL + "/user/settings/delete")
|
||||
case models.IsErrUserHasOrgs(err):
|
||||
ctx.Flash.Error(ctx.Tr("form.still_has_org"))
|
||||
ctx.Redirect(setting.AppSubUrl + "/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.AppSubUrl + "/")
|
||||
ctx.Redirect(setting.AppSubURL + "/")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue