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
18
cmd/web.go
18
cmd/web.go
|
@ -123,7 +123,7 @@ func newMacaron() *macaron.Macaron {
|
||||||
m.Use(gzip.Gziper())
|
m.Use(gzip.Gziper())
|
||||||
}
|
}
|
||||||
if setting.Protocol == setting.FCGI {
|
if setting.Protocol == setting.FCGI {
|
||||||
m.SetURLPrefix(setting.AppSubUrl)
|
m.SetURLPrefix(setting.AppSubURL)
|
||||||
}
|
}
|
||||||
m.Use(macaron.Static(
|
m.Use(macaron.Static(
|
||||||
path.Join(setting.StaticRootPath, "public"),
|
path.Join(setting.StaticRootPath, "public"),
|
||||||
|
@ -158,7 +158,7 @@ func newMacaron() *macaron.Macaron {
|
||||||
localFiles[name] = bindata.MustAsset("conf/locale/" + name)
|
localFiles[name] = bindata.MustAsset("conf/locale/" + name)
|
||||||
}
|
}
|
||||||
m.Use(i18n.I18n(i18n.Options{
|
m.Use(i18n.I18n(i18n.Options{
|
||||||
SubURL: setting.AppSubUrl,
|
SubURL: setting.AppSubURL,
|
||||||
Files: localFiles,
|
Files: localFiles,
|
||||||
CustomDirectory: path.Join(setting.CustomPath, "conf/locale"),
|
CustomDirectory: path.Join(setting.CustomPath, "conf/locale"),
|
||||||
Langs: setting.Langs,
|
Langs: setting.Langs,
|
||||||
|
@ -172,7 +172,7 @@ func newMacaron() *macaron.Macaron {
|
||||||
Interval: setting.CacheInterval,
|
Interval: setting.CacheInterval,
|
||||||
}))
|
}))
|
||||||
m.Use(captcha.Captchaer(captcha.Options{
|
m.Use(captcha.Captchaer(captcha.Options{
|
||||||
SubURL: setting.AppSubUrl,
|
SubURL: setting.AppSubURL,
|
||||||
}))
|
}))
|
||||||
m.Use(session.Sessioner(setting.SessionConfig))
|
m.Use(session.Sessioner(setting.SessionConfig))
|
||||||
m.Use(csrf.Csrfer(csrf.Options{
|
m.Use(csrf.Csrfer(csrf.Options{
|
||||||
|
@ -180,7 +180,7 @@ func newMacaron() *macaron.Macaron {
|
||||||
Cookie: setting.CSRFCookieName,
|
Cookie: setting.CSRFCookieName,
|
||||||
SetCookie: true,
|
SetCookie: true,
|
||||||
Header: "X-Csrf-Token",
|
Header: "X-Csrf-Token",
|
||||||
CookiePath: setting.AppSubUrl,
|
CookiePath: setting.AppSubURL,
|
||||||
}))
|
}))
|
||||||
m.Use(toolbox.Toolboxer(m, toolbox.Options{
|
m.Use(toolbox.Toolboxer(m, toolbox.Options{
|
||||||
HealthCheckFuncs: []*toolbox.HealthCheckFuncDesc{
|
HealthCheckFuncs: []*toolbox.HealthCheckFuncDesc{
|
||||||
|
@ -216,7 +216,7 @@ func runWeb(ctx *cli.Context) error {
|
||||||
m.Get("/", ignSignIn, routers.Home)
|
m.Get("/", ignSignIn, routers.Home)
|
||||||
m.Group("/explore", func() {
|
m.Group("/explore", func() {
|
||||||
m.Get("", func(ctx *context.Context) {
|
m.Get("", func(ctx *context.Context) {
|
||||||
ctx.Redirect(setting.AppSubUrl + "/explore/repos")
|
ctx.Redirect(setting.AppSubURL + "/explore/repos")
|
||||||
})
|
})
|
||||||
m.Get("/repos", routers.ExploreRepos)
|
m.Get("/repos", routers.ExploreRepos)
|
||||||
m.Get("/users", routers.ExploreUsers)
|
m.Get("/users", routers.ExploreUsers)
|
||||||
|
@ -635,17 +635,17 @@ func runWeb(ctx *cli.Context) error {
|
||||||
|
|
||||||
// Flag for port number in case first time run conflict.
|
// Flag for port number in case first time run conflict.
|
||||||
if ctx.IsSet("port") {
|
if ctx.IsSet("port") {
|
||||||
setting.AppUrl = strings.Replace(setting.AppUrl, setting.HTTPPort, ctx.String("port"), 1)
|
setting.AppURL = strings.Replace(setting.AppURL, setting.HTTPPort, ctx.String("port"), 1)
|
||||||
setting.HTTPPort = ctx.String("port")
|
setting.HTTPPort = ctx.String("port")
|
||||||
}
|
}
|
||||||
|
|
||||||
var listenAddr string
|
var listenAddr string
|
||||||
if setting.Protocol == setting.UNIX_SOCKET {
|
if setting.Protocol == setting.UnixSocket {
|
||||||
listenAddr = fmt.Sprintf("%s", setting.HTTPAddr)
|
listenAddr = fmt.Sprintf("%s", setting.HTTPAddr)
|
||||||
} else {
|
} else {
|
||||||
listenAddr = fmt.Sprintf("%s:%s", setting.HTTPAddr, setting.HTTPPort)
|
listenAddr = fmt.Sprintf("%s:%s", setting.HTTPAddr, setting.HTTPPort)
|
||||||
}
|
}
|
||||||
log.Info("Listen: %v://%s%s", setting.Protocol, listenAddr, setting.AppSubUrl)
|
log.Info("Listen: %v://%s%s", setting.Protocol, listenAddr, setting.AppSubURL)
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
switch setting.Protocol {
|
switch setting.Protocol {
|
||||||
|
@ -656,7 +656,7 @@ func runWeb(ctx *cli.Context) error {
|
||||||
err = server.ListenAndServeTLS(setting.CertFile, setting.KeyFile)
|
err = server.ListenAndServeTLS(setting.CertFile, setting.KeyFile)
|
||||||
case setting.FCGI:
|
case setting.FCGI:
|
||||||
err = fcgi.Serve(nil, m)
|
err = fcgi.Serve(nil, m)
|
||||||
case setting.UNIX_SOCKET:
|
case setting.UnixSocket:
|
||||||
os.Remove(listenAddr)
|
os.Remove(listenAddr)
|
||||||
|
|
||||||
var listener *net.UnixListener
|
var listener *net.UnixListener
|
||||||
|
|
|
@ -152,8 +152,8 @@ func (a *Action) ShortRepoPath() string {
|
||||||
|
|
||||||
// GetRepoLink returns relative link to action repository.
|
// GetRepoLink returns relative link to action repository.
|
||||||
func (a *Action) GetRepoLink() string {
|
func (a *Action) GetRepoLink() string {
|
||||||
if len(setting.AppSubUrl) > 0 {
|
if len(setting.AppSubURL) > 0 {
|
||||||
return path.Join(setting.AppSubUrl, a.GetRepoPath())
|
return path.Join(setting.AppSubURL, a.GetRepoPath())
|
||||||
}
|
}
|
||||||
return "/" + a.GetRepoPath()
|
return "/" + a.GetRepoPath()
|
||||||
}
|
}
|
||||||
|
@ -546,7 +546,7 @@ func CommitRepoAction(opts CommitRepoActionOptions) error {
|
||||||
Ref: opts.RefFullName,
|
Ref: opts.RefFullName,
|
||||||
Before: opts.OldCommitID,
|
Before: opts.OldCommitID,
|
||||||
After: opts.NewCommitID,
|
After: opts.NewCommitID,
|
||||||
CompareURL: setting.AppUrl + opts.Commits.CompareURL,
|
CompareURL: setting.AppURL + opts.Commits.CompareURL,
|
||||||
Commits: opts.Commits.ToAPIPayloadCommits(repo.HTMLURL()),
|
Commits: opts.Commits.ToAPIPayloadCommits(repo.HTMLURL()),
|
||||||
Repo: apiRepo,
|
Repo: apiRepo,
|
||||||
Pusher: apiPusher,
|
Pusher: apiPusher,
|
||||||
|
|
|
@ -317,7 +317,7 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository) (err error
|
||||||
Ref: git.BRANCH_PREFIX + pr.BaseBranch,
|
Ref: git.BRANCH_PREFIX + pr.BaseBranch,
|
||||||
Before: pr.MergeBase,
|
Before: pr.MergeBase,
|
||||||
After: pr.MergedCommitID,
|
After: pr.MergedCommitID,
|
||||||
CompareURL: setting.AppUrl + pr.BaseRepo.ComposeCompareURL(pr.MergeBase, pr.MergedCommitID),
|
CompareURL: setting.AppURL + pr.BaseRepo.ComposeCompareURL(pr.MergeBase, pr.MergedCommitID),
|
||||||
Commits: ListToPushCommits(l).ToAPIPayloadCommits(pr.BaseRepo.HTMLURL()),
|
Commits: ListToPushCommits(l).ToAPIPayloadCommits(pr.BaseRepo.HTMLURL()),
|
||||||
Repo: pr.BaseRepo.APIFormat(nil),
|
Repo: pr.BaseRepo.APIFormat(nil),
|
||||||
Pusher: pr.HeadRepo.MustOwner().APIFormat(),
|
Pusher: pr.HeadRepo.MustOwner().APIFormat(),
|
||||||
|
|
|
@ -246,7 +246,7 @@ func (repo *Repository) FullName() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (repo *Repository) HTMLURL() string {
|
func (repo *Repository) HTMLURL() string {
|
||||||
return setting.AppUrl + repo.FullName()
|
return setting.AppURL + repo.FullName()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Arguments that are allowed to be nil: permission
|
// Arguments that are allowed to be nil: permission
|
||||||
|
@ -412,7 +412,7 @@ func (repo *Repository) RelLink() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (repo *Repository) Link() string {
|
func (repo *Repository) Link() string {
|
||||||
return setting.AppSubUrl + "/" + repo.FullName()
|
return setting.AppSubURL + "/" + repo.FullName()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (repo *Repository) ComposeCompareURL(oldCommitID, newCommitID string) string {
|
func (repo *Repository) ComposeCompareURL(oldCommitID, newCommitID string) string {
|
||||||
|
@ -550,7 +550,7 @@ type CloneLink struct {
|
||||||
|
|
||||||
// ComposeHTTPSCloneURL returns HTTPS clone URL based on given owner and repository name.
|
// ComposeHTTPSCloneURL returns HTTPS clone URL based on given owner and repository name.
|
||||||
func ComposeHTTPSCloneURL(owner, repo string) string {
|
func ComposeHTTPSCloneURL(owner, repo string) string {
|
||||||
return fmt.Sprintf("%s%s/%s.git", setting.AppUrl, owner, repo)
|
return fmt.Sprintf("%s%s/%s.git", setting.AppURL, owner, repo)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (repo *Repository) cloneLink(isWiki bool) *CloneLink {
|
func (repo *Repository) cloneLink(isWiki bool) *CloneLink {
|
||||||
|
|
|
@ -198,14 +198,14 @@ func (u *User) CanImportLocal() bool {
|
||||||
// DashboardLink returns the user dashboard page link.
|
// DashboardLink returns the user dashboard page link.
|
||||||
func (u *User) DashboardLink() string {
|
func (u *User) DashboardLink() string {
|
||||||
if u.IsOrganization() {
|
if u.IsOrganization() {
|
||||||
return setting.AppSubUrl + "/org/" + u.Name + "/dashboard/"
|
return setting.AppSubURL + "/org/" + u.Name + "/dashboard/"
|
||||||
}
|
}
|
||||||
return setting.AppSubUrl + "/"
|
return setting.AppSubURL + "/"
|
||||||
}
|
}
|
||||||
|
|
||||||
// HomeLink returns the user or organization home page link.
|
// HomeLink returns the user or organization home page link.
|
||||||
func (u *User) HomeLink() string {
|
func (u *User) HomeLink() string {
|
||||||
return setting.AppSubUrl + "/" + u.Name
|
return setting.AppSubURL + "/" + u.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
// GenerateEmailActivateCode generates an activate code based on user information and given e-mail.
|
// GenerateEmailActivateCode generates an activate code based on user information and given e-mail.
|
||||||
|
@ -261,7 +261,7 @@ func (u *User) GenerateRandomAvatar() error {
|
||||||
// which includes app sub-url as prefix. However, it is possible
|
// which includes app sub-url as prefix. However, it is possible
|
||||||
// to return full URL if user enables Gravatar-like service.
|
// to return full URL if user enables Gravatar-like service.
|
||||||
func (u *User) RelAvatarLink() string {
|
func (u *User) RelAvatarLink() string {
|
||||||
defaultImgUrl := setting.AppSubUrl + "/img/avatar_default.png"
|
defaultImgUrl := setting.AppSubURL + "/img/avatar_default.png"
|
||||||
if u.ID == -1 {
|
if u.ID == -1 {
|
||||||
return defaultImgUrl
|
return defaultImgUrl
|
||||||
}
|
}
|
||||||
|
@ -271,7 +271,7 @@ func (u *User) RelAvatarLink() string {
|
||||||
if !com.IsExist(u.CustomAvatarPath()) {
|
if !com.IsExist(u.CustomAvatarPath()) {
|
||||||
return defaultImgUrl
|
return defaultImgUrl
|
||||||
}
|
}
|
||||||
return setting.AppSubUrl + "/avatars/" + com.ToStr(u.ID)
|
return setting.AppSubURL + "/avatars/" + com.ToStr(u.ID)
|
||||||
case setting.DisableGravatar, setting.OfflineMode:
|
case setting.DisableGravatar, setting.OfflineMode:
|
||||||
if !com.IsExist(u.CustomAvatarPath()) {
|
if !com.IsExist(u.CustomAvatarPath()) {
|
||||||
if err := u.GenerateRandomAvatar(); err != nil {
|
if err := u.GenerateRandomAvatar(); err != nil {
|
||||||
|
@ -279,7 +279,7 @@ func (u *User) RelAvatarLink() string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return setting.AppSubUrl + "/avatars/" + com.ToStr(u.ID)
|
return setting.AppSubURL + "/avatars/" + com.ToStr(u.ID)
|
||||||
}
|
}
|
||||||
return base.AvatarLink(u.AvatarEmail)
|
return base.AvatarLink(u.AvatarEmail)
|
||||||
}
|
}
|
||||||
|
@ -288,7 +288,7 @@ func (u *User) RelAvatarLink() string {
|
||||||
func (u *User) AvatarLink() string {
|
func (u *User) AvatarLink() string {
|
||||||
link := u.RelAvatarLink()
|
link := u.RelAvatarLink()
|
||||||
if link[0] == '/' && link[1] != '/' {
|
if link[0] == '/' && link[1] != '/' {
|
||||||
return setting.AppUrl + strings.TrimPrefix(link, setting.AppSubUrl)[1:]
|
return setting.AppURL + strings.TrimPrefix(link, setting.AppSubURL)[1:]
|
||||||
}
|
}
|
||||||
return link
|
return link
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,7 +142,7 @@ func getSlackPushPayload(p *api.PushPayload, slack *SlackMeta) (*SlackPayload, e
|
||||||
}
|
}
|
||||||
|
|
||||||
func getSlackPullRequestPayload(p *api.PullRequestPayload, slack *SlackMeta) (*SlackPayload, error) {
|
func getSlackPullRequestPayload(p *api.PullRequestPayload, slack *SlackMeta) (*SlackPayload, error) {
|
||||||
senderLink := SlackLinkFormatter(setting.AppUrl+p.Sender.UserName, p.Sender.UserName)
|
senderLink := SlackLinkFormatter(setting.AppURL+p.Sender.UserName, p.Sender.UserName)
|
||||||
titleLink := SlackLinkFormatter(fmt.Sprintf("%s/pulls/%d", p.Repository.HTMLURL, p.Index),
|
titleLink := SlackLinkFormatter(fmt.Sprintf("%s/pulls/%d", p.Repository.HTMLURL, p.Index),
|
||||||
fmt.Sprintf("#%d %s", p.Index, p.PullRequest.Title))
|
fmt.Sprintf("#%d %s", p.Index, p.PullRequest.Title))
|
||||||
var text, title, attachmentText string
|
var text, title, attachmentText string
|
||||||
|
@ -164,7 +164,7 @@ func getSlackPullRequestPayload(p *api.PullRequestPayload, slack *SlackMeta) (*S
|
||||||
attachmentText = SlackTextFormatter(p.PullRequest.Body)
|
attachmentText = SlackTextFormatter(p.PullRequest.Body)
|
||||||
case api.HookIssueAssigned:
|
case api.HookIssueAssigned:
|
||||||
text = fmt.Sprintf("[%s] Pull request assigned to %s: %s by %s", p.Repository.FullName,
|
text = fmt.Sprintf("[%s] Pull request assigned to %s: %s by %s", p.Repository.FullName,
|
||||||
SlackLinkFormatter(setting.AppUrl+p.PullRequest.Assignee.UserName, p.PullRequest.Assignee.UserName),
|
SlackLinkFormatter(setting.AppURL+p.PullRequest.Assignee.UserName, p.PullRequest.Assignee.UserName),
|
||||||
titleLink, senderLink)
|
titleLink, senderLink)
|
||||||
case api.HookIssueUnassigned:
|
case api.HookIssueUnassigned:
|
||||||
text = fmt.Sprintf("[%s] Pull request unassigned: %s by %s", p.Repository.FullName, titleLink, senderLink)
|
text = fmt.Sprintf("[%s] Pull request unassigned: %s by %s", p.Repository.FullName, titleLink, senderLink)
|
||||||
|
|
|
@ -217,7 +217,7 @@ func AvatarLink(email string) string {
|
||||||
return setting.GravatarSource + HashEmail(email)
|
return setting.GravatarSource + HashEmail(email)
|
||||||
}
|
}
|
||||||
|
|
||||||
return setting.AppSubUrl + "/img/avatar_default.png"
|
return setting.AppSubURL + "/img/avatar_default.png"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Seconds-based time units
|
// Seconds-based time units
|
||||||
|
|
|
@ -47,16 +47,16 @@ func (ctx *APIContext) SetLinkHeader(total, pageSize int) {
|
||||||
page := paginater.New(total, pageSize, ctx.QueryInt("page"), 0)
|
page := paginater.New(total, pageSize, ctx.QueryInt("page"), 0)
|
||||||
links := make([]string, 0, 4)
|
links := make([]string, 0, 4)
|
||||||
if page.HasNext() {
|
if page.HasNext() {
|
||||||
links = append(links, fmt.Sprintf("<%s%s?page=%d>; rel=\"next\"", setting.AppUrl, ctx.Req.URL.Path[1:], page.Next()))
|
links = append(links, fmt.Sprintf("<%s%s?page=%d>; rel=\"next\"", setting.AppURL, ctx.Req.URL.Path[1:], page.Next()))
|
||||||
}
|
}
|
||||||
if !page.IsLast() {
|
if !page.IsLast() {
|
||||||
links = append(links, fmt.Sprintf("<%s%s?page=%d>; rel=\"last\"", setting.AppUrl, ctx.Req.URL.Path[1:], page.TotalPages()))
|
links = append(links, fmt.Sprintf("<%s%s?page=%d>; rel=\"last\"", setting.AppURL, ctx.Req.URL.Path[1:], page.TotalPages()))
|
||||||
}
|
}
|
||||||
if !page.IsFirst() {
|
if !page.IsFirst() {
|
||||||
links = append(links, fmt.Sprintf("<%s%s?page=1>; rel=\"first\"", setting.AppUrl, ctx.Req.URL.Path[1:]))
|
links = append(links, fmt.Sprintf("<%s%s?page=1>; rel=\"first\"", setting.AppURL, ctx.Req.URL.Path[1:]))
|
||||||
}
|
}
|
||||||
if page.HasPrevious() {
|
if page.HasPrevious() {
|
||||||
links = append(links, fmt.Sprintf("<%s%s?page=%d>; rel=\"prev\"", setting.AppUrl, ctx.Req.URL.Path[1:], page.Previous()))
|
links = append(links, fmt.Sprintf("<%s%s?page=%d>; rel=\"prev\"", setting.AppURL, ctx.Req.URL.Path[1:], page.Previous()))
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(links) > 0 {
|
if len(links) > 0 {
|
||||||
|
|
|
@ -26,7 +26,7 @@ func Toggle(options *ToggleOptions) macaron.Handler {
|
||||||
return func(ctx *Context) {
|
return func(ctx *Context) {
|
||||||
// Cannot view any page before installation.
|
// Cannot view any page before installation.
|
||||||
if !setting.InstallLock {
|
if !setting.InstallLock {
|
||||||
ctx.Redirect(setting.AppSubUrl + "/install")
|
ctx.Redirect(setting.AppSubURL + "/install")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,14 +38,14 @@ func Toggle(options *ToggleOptions) macaron.Handler {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check non-logged users landing page.
|
// Check non-logged users landing page.
|
||||||
if !ctx.IsSigned && ctx.Req.RequestURI == "/" && setting.LandingPageURL != setting.LANDING_PAGE_HOME {
|
if !ctx.IsSigned && ctx.Req.RequestURI == "/" && setting.LandingPageURL != setting.LandingPageHome {
|
||||||
ctx.Redirect(setting.AppSubUrl + string(setting.LandingPageURL))
|
ctx.Redirect(setting.AppSubURL + string(setting.LandingPageURL))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redirect to dashboard if user tries to visit any non-login page.
|
// Redirect to dashboard if user tries to visit any non-login page.
|
||||||
if options.SignOutRequired && ctx.IsSigned && ctx.Req.RequestURI != "/" {
|
if options.SignOutRequired && ctx.IsSigned && ctx.Req.RequestURI != "/" {
|
||||||
ctx.Redirect(setting.AppSubUrl + "/")
|
ctx.Redirect(setting.AppSubURL + "/")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,8 +66,8 @@ func Toggle(options *ToggleOptions) macaron.Handler {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.SetCookie("redirect_to", url.QueryEscape(setting.AppSubUrl+ctx.Req.RequestURI), 0, setting.AppSubUrl)
|
ctx.SetCookie("redirect_to", url.QueryEscape(setting.AppSubURL+ctx.Req.RequestURI), 0, setting.AppSubURL)
|
||||||
ctx.Redirect(setting.AppSubUrl + "/user/login")
|
ctx.Redirect(setting.AppSubURL + "/user/login")
|
||||||
return
|
return
|
||||||
} else if !ctx.User.IsActive && setting.Service.RegisterEmailConfirm {
|
} else if !ctx.User.IsActive && setting.Service.RegisterEmailConfirm {
|
||||||
ctx.Data["Title"] = ctx.Tr("auth.active_your_account")
|
ctx.Data["Title"] = ctx.Tr("auth.active_your_account")
|
||||||
|
@ -79,8 +79,8 @@ func Toggle(options *ToggleOptions) macaron.Handler {
|
||||||
// Redirect to log in page if auto-signin info is provided and has not signed in.
|
// Redirect to log in page if auto-signin info is provided and has not signed in.
|
||||||
if !options.SignOutRequired && !ctx.IsSigned && !auth.IsAPIPath(ctx.Req.URL.Path) &&
|
if !options.SignOutRequired && !ctx.IsSigned && !auth.IsAPIPath(ctx.Req.URL.Path) &&
|
||||||
len(ctx.GetCookie(setting.CookieUserName)) > 0 {
|
len(ctx.GetCookie(setting.CookieUserName)) > 0 {
|
||||||
ctx.SetCookie("redirect_to", url.QueryEscape(setting.AppSubUrl+ctx.Req.RequestURI), 0, setting.AppSubUrl)
|
ctx.SetCookie("redirect_to", url.QueryEscape(setting.AppSubURL+ctx.Req.RequestURI), 0, setting.AppSubURL)
|
||||||
ctx.Redirect(setting.AppSubUrl + "/user/login")
|
ctx.Redirect(setting.AppSubURL + "/user/login")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ func Contexter() macaron.Handler {
|
||||||
Org: &Organization{},
|
Org: &Organization{},
|
||||||
}
|
}
|
||||||
// Compute current URL for real-time change language.
|
// Compute current URL for real-time change language.
|
||||||
ctx.Data["Link"] = setting.AppSubUrl + strings.TrimSuffix(ctx.Req.URL.Path, "/")
|
ctx.Data["Link"] = setting.AppSubURL + strings.TrimSuffix(ctx.Req.URL.Path, "/")
|
||||||
|
|
||||||
ctx.Data["PageStartTime"] = time.Now()
|
ctx.Data["PageStartTime"] = time.Now()
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ func HandleOrgAssignment(ctx *Context, args ...bool) {
|
||||||
ctx.Data["IsOrganizationOwner"] = ctx.Org.IsOwner
|
ctx.Data["IsOrganizationOwner"] = ctx.Org.IsOwner
|
||||||
ctx.Data["IsOrganizationMember"] = ctx.Org.IsMember
|
ctx.Data["IsOrganizationMember"] = ctx.Org.IsMember
|
||||||
|
|
||||||
ctx.Org.OrgLink = setting.AppSubUrl + "/org/" + org.Name
|
ctx.Org.OrgLink = setting.AppSubURL + "/org/" + org.Name
|
||||||
ctx.Data["OrgLink"] = ctx.Org.OrgLink
|
ctx.Data["OrgLink"] = ctx.Org.OrgLink
|
||||||
|
|
||||||
// Team.
|
// Team.
|
||||||
|
|
|
@ -117,7 +117,7 @@ func RetrieveBaseRepo(ctx *Context, repo *models.Repository) {
|
||||||
|
|
||||||
// composeGoGetImport returns go-get-import meta content.
|
// composeGoGetImport returns go-get-import meta content.
|
||||||
func composeGoGetImport(owner, repo string) string {
|
func composeGoGetImport(owner, repo string) string {
|
||||||
return path.Join(setting.Domain, setting.AppSubUrl, owner, repo)
|
return path.Join(setting.Domain, setting.AppSubURL, owner, repo)
|
||||||
}
|
}
|
||||||
|
|
||||||
// earlyResponseForGoGetMeta responses appropriate go-get meta with status 200
|
// earlyResponseForGoGetMeta responses appropriate go-get meta with status 200
|
||||||
|
@ -331,7 +331,7 @@ func RepoAssignment(args ...bool) macaron.Handler {
|
||||||
|
|
||||||
if ctx.Query("go-get") == "1" {
|
if ctx.Query("go-get") == "1" {
|
||||||
ctx.Data["GoGetImport"] = composeGoGetImport(owner.Name, repo.Name)
|
ctx.Data["GoGetImport"] = composeGoGetImport(owner.Name, repo.Name)
|
||||||
prefix := setting.AppUrl + path.Join(owner.Name, repo.Name, "src", ctx.Repo.BranchName)
|
prefix := setting.AppURL + path.Join(owner.Name, repo.Name, "src", ctx.Repo.BranchName)
|
||||||
ctx.Data["GoDocDirectory"] = prefix + "{/dir}"
|
ctx.Data["GoDocDirectory"] = prefix + "{/dir}"
|
||||||
ctx.Data["GoDocFile"] = prefix + "{/dir}/{file}#L{line}"
|
ctx.Data["GoDocFile"] = prefix + "{/dir}/{file}#L{line}"
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,7 +135,7 @@ func (r *Renderer) AutoLink(out *bytes.Buffer, link []byte, kind int) {
|
||||||
|
|
||||||
// Since this method could only possibly serve one link at a time,
|
// Since this method could only possibly serve one link at a time,
|
||||||
// we do not need to find all.
|
// we do not need to find all.
|
||||||
if bytes.HasPrefix(link, []byte(setting.AppUrl)) {
|
if bytes.HasPrefix(link, []byte(setting.AppURL)) {
|
||||||
m := CommitPattern.Find(link)
|
m := CommitPattern.Find(link)
|
||||||
if m != nil {
|
if m != nil {
|
||||||
m = bytes.TrimSpace(m)
|
m = bytes.TrimSpace(m)
|
||||||
|
@ -225,7 +225,7 @@ func cutoutVerbosePrefix(prefix string) string {
|
||||||
if prefix[i] == '/' {
|
if prefix[i] == '/' {
|
||||||
count++
|
count++
|
||||||
}
|
}
|
||||||
if count >= 3+setting.AppSubUrlDepth {
|
if count >= 3+setting.AppSubURLDepth {
|
||||||
return prefix[:i]
|
return prefix[:i]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -279,7 +279,7 @@ func RenderSpecialLink(rawBytes []byte, urlPrefix string, metas map[string]strin
|
||||||
for _, m := range ms {
|
for _, m := range ms {
|
||||||
m = m[bytes.Index(m, []byte("@")):]
|
m = m[bytes.Index(m, []byte("@")):]
|
||||||
rawBytes = bytes.Replace(rawBytes, m,
|
rawBytes = bytes.Replace(rawBytes, m,
|
||||||
[]byte(fmt.Sprintf(`<a href="%s/%s">%s</a>`, setting.AppSubUrl, m[1:], m)), -1)
|
[]byte(fmt.Sprintf(`<a href="%s/%s">%s</a>`, setting.AppSubURL, m[1:], m)), -1)
|
||||||
}
|
}
|
||||||
|
|
||||||
rawBytes = RenderIssueIndexPattern(rawBytes, urlPrefix, metas)
|
rawBytes = RenderIssueIndexPattern(rawBytes, urlPrefix, metas)
|
||||||
|
|
|
@ -16,7 +16,7 @@ func TestMarkdown(t *testing.T) {
|
||||||
urlPrefix = "/prefix"
|
urlPrefix = "/prefix"
|
||||||
metas map[string]string = nil
|
metas map[string]string = nil
|
||||||
)
|
)
|
||||||
setting.AppSubUrlDepth = 0
|
setting.AppSubURLDepth = 0
|
||||||
|
|
||||||
Convey("To the internal issue tracker", func() {
|
Convey("To the internal issue tracker", func() {
|
||||||
Convey("It should not render anything when there are no mentions", func() {
|
Convey("It should not render anything when there are no mentions", func() {
|
||||||
|
@ -237,7 +237,7 @@ func TestMarkdown(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
Convey("Rendering an issue URL", t, func() {
|
Convey("Rendering an issue URL", t, func() {
|
||||||
setting.AppUrl = "http://localhost:3000/"
|
setting.AppURL = "http://localhost:3000/"
|
||||||
htmlFlags := 0
|
htmlFlags := 0
|
||||||
htmlFlags |= blackfriday.HTML_SKIP_STYLE
|
htmlFlags |= blackfriday.HTML_SKIP_STYLE
|
||||||
htmlFlags |= blackfriday.HTML_OMIT_CONTENTS
|
htmlFlags |= blackfriday.HTML_OMIT_CONTENTS
|
||||||
|
@ -279,7 +279,7 @@ func TestMarkdown(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
Convey("Rendering a commit URL", t, func() {
|
Convey("Rendering a commit URL", t, func() {
|
||||||
setting.AppUrl = "http://localhost:3000/"
|
setting.AppURL = "http://localhost:3000/"
|
||||||
htmlFlags := 0
|
htmlFlags := 0
|
||||||
htmlFlags |= blackfriday.HTML_SKIP_STYLE
|
htmlFlags |= blackfriday.HTML_SKIP_STYLE
|
||||||
htmlFlags |= blackfriday.HTML_OMIT_CONTENTS
|
htmlFlags |= blackfriday.HTML_OMIT_CONTENTS
|
||||||
|
|
|
@ -18,10 +18,10 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Unknwon/com"
|
"github.com/Unknwon/com"
|
||||||
_ "github.com/go-macaron/cache/memcache"
|
_ "github.com/go-macaron/cache/memcache" // memcache plugin for cache
|
||||||
_ "github.com/go-macaron/cache/redis"
|
_ "github.com/go-macaron/cache/redis"
|
||||||
"github.com/go-macaron/session"
|
"github.com/go-macaron/session"
|
||||||
_ "github.com/go-macaron/session/redis"
|
_ "github.com/go-macaron/session/redis" // redis plugin for store session
|
||||||
"gopkg.in/ini.v1"
|
"gopkg.in/ini.v1"
|
||||||
"strk.kbt.io/projects/go/libravatar"
|
"strk.kbt.io/projects/go/libravatar"
|
||||||
|
|
||||||
|
@ -30,44 +30,51 @@ import (
|
||||||
"code.gitea.io/gitea/modules/user"
|
"code.gitea.io/gitea/modules/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Scheme describes protocol types
|
||||||
type Scheme string
|
type Scheme string
|
||||||
|
|
||||||
|
// enumerates all the scheme types
|
||||||
const (
|
const (
|
||||||
HTTP Scheme = "http"
|
HTTP Scheme = "http"
|
||||||
HTTPS Scheme = "https"
|
HTTPS Scheme = "https"
|
||||||
FCGI Scheme = "fcgi"
|
FCGI Scheme = "fcgi"
|
||||||
UNIX_SOCKET Scheme = "unix"
|
UnixSocket Scheme = "unix"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// LandingPage describes the default page
|
||||||
type LandingPage string
|
type LandingPage string
|
||||||
|
|
||||||
|
// enumerates all the landing page types
|
||||||
const (
|
const (
|
||||||
LANDING_PAGE_HOME LandingPage = "/"
|
LandingPageHome LandingPage = "/"
|
||||||
LANDING_PAGE_EXPLORE LandingPage = "/explore"
|
LandingPageExplore LandingPage = "/explore"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// settings
|
||||||
var (
|
var (
|
||||||
// Build information should only be set by -ldflags.
|
// BuildTime information should only be set by -ldflags.
|
||||||
BuildTime string
|
BuildTime string
|
||||||
BuildGitHash string
|
BuildGitHash string
|
||||||
|
|
||||||
// App settings
|
// AppVer settings
|
||||||
AppVer string
|
AppVer string
|
||||||
AppName string
|
AppName string
|
||||||
AppUrl string
|
AppURL string
|
||||||
AppSubUrl string
|
AppSubURL string
|
||||||
AppSubUrlDepth int // Number of slashes
|
AppSubURLDepth int // Number of slashes
|
||||||
AppPath string
|
AppPath string
|
||||||
AppDataPath string
|
AppDataPath string
|
||||||
|
|
||||||
// Server settings
|
// Server settings
|
||||||
Protocol Scheme
|
Protocol Scheme
|
||||||
Domain string
|
Domain string
|
||||||
HTTPAddr, HTTPPort string
|
HTTPAddr string
|
||||||
|
HTTPPort string
|
||||||
LocalURL string
|
LocalURL string
|
||||||
OfflineMode bool
|
OfflineMode bool
|
||||||
DisableRouterLog bool
|
DisableRouterLog bool
|
||||||
CertFile, KeyFile string
|
CertFile string
|
||||||
|
KeyFile string
|
||||||
StaticRootPath string
|
StaticRootPath string
|
||||||
EnableGzip bool
|
EnableGzip bool
|
||||||
LandingPageURL LandingPage
|
LandingPageURL LandingPage
|
||||||
|
@ -242,7 +249,8 @@ var (
|
||||||
}
|
}
|
||||||
|
|
||||||
// I18n settings
|
// I18n settings
|
||||||
Langs, Names []string
|
Langs []string
|
||||||
|
Names []string
|
||||||
dateLangs map[string]string
|
dateLangs map[string]string
|
||||||
|
|
||||||
// Highlight settings are loaded in modules/template/hightlight.go
|
// Highlight settings are loaded in modules/template/hightlight.go
|
||||||
|
@ -386,20 +394,20 @@ please consider changing to GITEA_CUSTOM`)
|
||||||
|
|
||||||
sec := Cfg.Section("server")
|
sec := Cfg.Section("server")
|
||||||
AppName = Cfg.Section("").Key("APP_NAME").MustString("Gogs: Go Git Service")
|
AppName = Cfg.Section("").Key("APP_NAME").MustString("Gogs: Go Git Service")
|
||||||
AppUrl = sec.Key("ROOT_URL").MustString("http://localhost:3000/")
|
AppURL = sec.Key("ROOT_URL").MustString("http://localhost:3000/")
|
||||||
if AppUrl[len(AppUrl)-1] != '/' {
|
if AppURL[len(AppURL)-1] != '/' {
|
||||||
AppUrl += "/"
|
AppURL += "/"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if has app suburl.
|
// Check if has app suburl.
|
||||||
url, err := url.Parse(AppUrl)
|
url, err := url.Parse(AppURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(4, "Invalid ROOT_URL '%s': %s", AppUrl, err)
|
log.Fatal(4, "Invalid ROOT_URL '%s': %s", AppURL, err)
|
||||||
}
|
}
|
||||||
// Suburl should start with '/' and end without '/', such as '/{subpath}'.
|
// Suburl should start with '/' and end without '/', such as '/{subpath}'.
|
||||||
// This value is empty if site does not have sub-url.
|
// This value is empty if site does not have sub-url.
|
||||||
AppSubUrl = strings.TrimSuffix(url.Path, "/")
|
AppSubURL = strings.TrimSuffix(url.Path, "/")
|
||||||
AppSubUrlDepth = strings.Count(AppSubUrl, "/")
|
AppSubURLDepth = strings.Count(AppSubURL, "/")
|
||||||
|
|
||||||
Protocol = HTTP
|
Protocol = HTTP
|
||||||
if sec.Key("PROTOCOL").String() == "https" {
|
if sec.Key("PROTOCOL").String() == "https" {
|
||||||
|
@ -409,7 +417,7 @@ please consider changing to GITEA_CUSTOM`)
|
||||||
} else if sec.Key("PROTOCOL").String() == "fcgi" {
|
} else if sec.Key("PROTOCOL").String() == "fcgi" {
|
||||||
Protocol = FCGI
|
Protocol = FCGI
|
||||||
} else if sec.Key("PROTOCOL").String() == "unix" {
|
} else if sec.Key("PROTOCOL").String() == "unix" {
|
||||||
Protocol = UNIX_SOCKET
|
Protocol = UnixSocket
|
||||||
UnixSocketPermissionRaw := sec.Key("UNIX_SOCKET_PERMISSION").MustString("666")
|
UnixSocketPermissionRaw := sec.Key("UNIX_SOCKET_PERMISSION").MustString("666")
|
||||||
UnixSocketPermissionParsed, err := strconv.ParseUint(UnixSocketPermissionRaw, 8, 32)
|
UnixSocketPermissionParsed, err := strconv.ParseUint(UnixSocketPermissionRaw, 8, 32)
|
||||||
if err != nil || UnixSocketPermissionParsed > 0777 {
|
if err != nil || UnixSocketPermissionParsed > 0777 {
|
||||||
|
@ -429,9 +437,9 @@ please consider changing to GITEA_CUSTOM`)
|
||||||
|
|
||||||
switch sec.Key("LANDING_PAGE").MustString("home") {
|
switch sec.Key("LANDING_PAGE").MustString("home") {
|
||||||
case "explore":
|
case "explore":
|
||||||
LandingPageURL = LANDING_PAGE_EXPLORE
|
LandingPageURL = LandingPageExplore
|
||||||
default:
|
default:
|
||||||
LandingPageURL = LANDING_PAGE_HOME
|
LandingPageURL = LandingPageHome
|
||||||
}
|
}
|
||||||
|
|
||||||
SSH.RootPath = path.Join(homeDir, ".ssh")
|
SSH.RootPath = path.Join(homeDir, ".ssh")
|
||||||
|
@ -596,6 +604,7 @@ please consider changing to GITEA_CUSTOM`)
|
||||||
HasRobotsTxt = com.IsFile(path.Join(CustomPath, "robots.txt"))
|
HasRobotsTxt = com.IsFile(path.Join(CustomPath, "robots.txt"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Service settings
|
||||||
var Service struct {
|
var Service struct {
|
||||||
ActiveCodeLives int
|
ActiveCodeLives int
|
||||||
ResetPwdCodeLives int
|
ResetPwdCodeLives int
|
||||||
|
@ -719,7 +728,7 @@ func newSessionService() {
|
||||||
[]string{"memory", "file", "redis", "mysql"})
|
[]string{"memory", "file", "redis", "mysql"})
|
||||||
SessionConfig.ProviderConfig = strings.Trim(Cfg.Section("session").Key("PROVIDER_CONFIG").String(), "\" ")
|
SessionConfig.ProviderConfig = strings.Trim(Cfg.Section("session").Key("PROVIDER_CONFIG").String(), "\" ")
|
||||||
SessionConfig.CookieName = Cfg.Section("session").Key("COOKIE_NAME").MustString("i_like_gogits")
|
SessionConfig.CookieName = Cfg.Section("session").Key("COOKIE_NAME").MustString("i_like_gogits")
|
||||||
SessionConfig.CookiePath = AppSubUrl
|
SessionConfig.CookiePath = AppSubURL
|
||||||
SessionConfig.Secure = Cfg.Section("session").Key("COOKIE_SECURE").MustBool()
|
SessionConfig.Secure = Cfg.Section("session").Key("COOKIE_SECURE").MustBool()
|
||||||
SessionConfig.Gclifetime = Cfg.Section("session").Key("GC_INTERVAL_TIME").MustInt64(86400)
|
SessionConfig.Gclifetime = Cfg.Section("session").Key("GC_INTERVAL_TIME").MustInt64(86400)
|
||||||
SessionConfig.Maxlifetime = Cfg.Section("session").Key("SESSION_LIFE_TIME").MustInt64(86400)
|
SessionConfig.Maxlifetime = Cfg.Section("session").Key("SESSION_LIFE_TIME").MustInt64(86400)
|
||||||
|
@ -744,6 +753,7 @@ type Mailer struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
// MailService the global mailer
|
||||||
MailService *Mailer
|
MailService *Mailer
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -810,6 +820,7 @@ func newWebhookService() {
|
||||||
Webhook.PagingNum = sec.Key("PAGING_NUM").MustInt(10)
|
Webhook.PagingNum = sec.Key("PAGING_NUM").MustInt(10)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewServices initializes the services
|
||||||
func NewServices() {
|
func NewServices() {
|
||||||
newService()
|
newService()
|
||||||
newLogService()
|
newLogService()
|
||||||
|
|
|
@ -33,16 +33,16 @@ func NewFuncMap() []template.FuncMap {
|
||||||
return strings.Title(runtime.Version())
|
return strings.Title(runtime.Version())
|
||||||
},
|
},
|
||||||
"UseHTTPS": func() bool {
|
"UseHTTPS": func() bool {
|
||||||
return strings.HasPrefix(setting.AppUrl, "https")
|
return strings.HasPrefix(setting.AppURL, "https")
|
||||||
},
|
},
|
||||||
"AppName": func() string {
|
"AppName": func() string {
|
||||||
return setting.AppName
|
return setting.AppName
|
||||||
},
|
},
|
||||||
"AppSubUrl": func() string {
|
"AppSubUrl": func() string {
|
||||||
return setting.AppSubUrl
|
return setting.AppSubURL
|
||||||
},
|
},
|
||||||
"AppUrl": func() string {
|
"AppUrl": func() string {
|
||||||
return setting.AppUrl
|
return setting.AppURL
|
||||||
},
|
},
|
||||||
"AppVer": func() string {
|
"AppVer": func() string {
|
||||||
return setting.AppVer
|
return setting.AppVer
|
||||||
|
|
|
@ -164,7 +164,7 @@ func Dashboard(ctx *context.Context) {
|
||||||
} else {
|
} else {
|
||||||
ctx.Flash.Success(success)
|
ctx.Flash.Success(success)
|
||||||
}
|
}
|
||||||
ctx.Redirect(setting.AppSubUrl + "/admin")
|
ctx.Redirect(setting.AppSubURL + "/admin")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ func SendTestMail(ctx *context.Context) {
|
||||||
ctx.Flash.Info(ctx.Tr("admin.config.test_mail_sent", email))
|
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
|
// Config show admin config page
|
||||||
|
@ -194,7 +194,7 @@ func Config(ctx *context.Context) {
|
||||||
ctx.Data["PageIsAdmin"] = true
|
ctx.Data["PageIsAdmin"] = true
|
||||||
ctx.Data["PageIsAdminConfig"] = true
|
ctx.Data["PageIsAdminConfig"] = true
|
||||||
|
|
||||||
ctx.Data["AppUrl"] = setting.AppUrl
|
ctx.Data["AppUrl"] = setting.AppURL
|
||||||
ctx.Data["Domain"] = setting.Domain
|
ctx.Data["Domain"] = setting.Domain
|
||||||
ctx.Data["OfflineMode"] = setting.OfflineMode
|
ctx.Data["OfflineMode"] = setting.OfflineMode
|
||||||
ctx.Data["DisableRouterLog"] = setting.DisableRouterLog
|
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)
|
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.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
|
// 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)
|
log.Trace("Authentication changed by admin(%s): %s", ctx.User.Name, source.ID)
|
||||||
|
|
||||||
ctx.Flash.Success(ctx.Tr("admin.auths.update_success"))
|
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
|
// 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.Flash.Error(fmt.Sprintf("DeleteSource: %v", err))
|
||||||
}
|
}
|
||||||
ctx.JSON(200, map[string]interface{}{
|
ctx.JSON(200, map[string]interface{}{
|
||||||
"redirect": setting.AppSubUrl + "/admin/auths/" + ctx.Params(":authid"),
|
"redirect": setting.AppSubURL + "/admin/auths/" + ctx.Params(":authid"),
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -262,6 +262,6 @@ func DeleteAuthSource(ctx *context.Context) {
|
||||||
|
|
||||||
ctx.Flash.Success(ctx.Tr("admin.auths.deletion_success"))
|
ctx.Flash.Success(ctx.Tr("admin.auths.deletion_success"))
|
||||||
ctx.JSON(200, map[string]interface{}{
|
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)
|
log.Trace("System notices deleted by admin (%s): [start: %d]", ctx.User.Name, 0)
|
||||||
ctx.Flash.Success(ctx.Tr("admin.notices.delete_success"))
|
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.Flash.Success(ctx.Tr("repo.settings.deletion_success"))
|
||||||
ctx.JSON(200, map[string]interface{}{
|
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.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 {
|
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)
|
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.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
|
// DeleteUser response for deleting a user
|
||||||
|
@ -241,12 +241,12 @@ func DeleteUser(ctx *context.Context) {
|
||||||
case models.IsErrUserOwnRepos(err):
|
case models.IsErrUserOwnRepos(err):
|
||||||
ctx.Flash.Error(ctx.Tr("admin.users.still_own_repo"))
|
ctx.Flash.Error(ctx.Tr("admin.users.still_own_repo"))
|
||||||
ctx.JSON(200, map[string]interface{}{
|
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):
|
case models.IsErrUserHasOrgs(err):
|
||||||
ctx.Flash.Error(ctx.Tr("admin.users.still_has_org"))
|
ctx.Flash.Error(ctx.Tr("admin.users.still_has_org"))
|
||||||
ctx.JSON(200, map[string]interface{}{
|
ctx.JSON(200, map[string]interface{}{
|
||||||
"redirect": setting.AppSubUrl + "/admin/users/" + ctx.Params(":userid"),
|
"redirect": setting.AppSubURL + "/admin/users/" + ctx.Params(":userid"),
|
||||||
})
|
})
|
||||||
default:
|
default:
|
||||||
ctx.Handle(500, "DeleteUser", err)
|
ctx.Handle(500, "DeleteUser", err)
|
||||||
|
@ -257,6 +257,6 @@ func DeleteUser(ctx *context.Context) {
|
||||||
|
|
||||||
ctx.Flash.Success(ctx.Tr("admin.users.deletion_success"))
|
ctx.Flash.Success(ctx.Tr("admin.users.deletion_success"))
|
||||||
ctx.JSON(200, map[string]interface{}{
|
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 {
|
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
|
// ListDeployKeys list all the deploy keys of a repository
|
||||||
|
|
|
@ -34,7 +34,7 @@ func GetUserByParams(ctx *context.APIContext) *models.User {
|
||||||
}
|
}
|
||||||
|
|
||||||
func composePublicKeysAPILink() string {
|
func composePublicKeysAPILink() string {
|
||||||
return setting.AppUrl + "api/v1/user/keys/"
|
return setting.AppURL + "api/v1/user/keys/"
|
||||||
}
|
}
|
||||||
|
|
||||||
func listPublicKeys(ctx *context.APIContext, uid int64) {
|
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["User"] = models.User{Name: "Unknown"}
|
||||||
ctx.Data["AppName"] = setting.AppName
|
ctx.Data["AppName"] = setting.AppName
|
||||||
ctx.Data["AppVer"] = setting.AppVer
|
ctx.Data["AppVer"] = setting.AppVer
|
||||||
ctx.Data["AppUrl"] = setting.AppUrl
|
ctx.Data["AppUrl"] = setting.AppURL
|
||||||
ctx.Data["Code"] = "2014031910370000009fff6782aadb2162b4a997acb69d4400888e0b9274657374"
|
ctx.Data["Code"] = "2014031910370000009fff6782aadb2162b4a997acb69d4400888e0b9274657374"
|
||||||
ctx.Data["ActiveCodeLives"] = setting.Service.ActiveCodeLives / 60
|
ctx.Data["ActiveCodeLives"] = setting.Service.ActiveCodeLives / 60
|
||||||
ctx.Data["ResetPwdCodeLives"] = setting.Service.ResetPwdCodeLives / 60
|
ctx.Data["ResetPwdCodeLives"] = setting.Service.ResetPwdCodeLives / 60
|
||||||
|
|
|
@ -42,7 +42,7 @@ func Home(ctx *context.Context) {
|
||||||
// Check auto-login.
|
// Check auto-login.
|
||||||
uname := ctx.GetCookie(setting.CookieUserName)
|
uname := ctx.GetCookie(setting.CookieUserName)
|
||||||
if len(uname) != 0 {
|
if len(uname) != 0 {
|
||||||
ctx.Redirect(setting.AppSubUrl + "/user/login")
|
ctx.Redirect(setting.AppSubURL + "/user/login")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ func Install(ctx *context.Context) {
|
||||||
form.Domain = setting.Domain
|
form.Domain = setting.Domain
|
||||||
form.SSHPort = setting.SSH.Port
|
form.SSHPort = setting.SSH.Port
|
||||||
form.HTTPPort = setting.HTTPPort
|
form.HTTPPort = setting.HTTPPort
|
||||||
form.AppUrl = setting.AppUrl
|
form.AppUrl = setting.AppURL
|
||||||
form.LogRootPath = setting.LogRootPath
|
form.LogRootPath = setting.LogRootPath
|
||||||
|
|
||||||
// E-mail service settings
|
// E-mail service settings
|
||||||
|
|
|
@ -91,7 +91,7 @@ func MembersAction(ctx *context.Context) {
|
||||||
if ctx.Params(":action") != "leave" {
|
if ctx.Params(":action") != "leave" {
|
||||||
ctx.Redirect(ctx.Org.OrgLink + "/members")
|
ctx.Redirect(ctx.Org.OrgLink + "/members")
|
||||||
} else {
|
} 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)
|
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
|
return
|
||||||
}
|
}
|
||||||
// reset ctx.org.OrgLink with new name
|
// 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)
|
log.Trace("Organization name changed: %s -> %s", org.Name, form.Name)
|
||||||
}
|
}
|
||||||
// In case it's just a case change.
|
// In case it's just a case change.
|
||||||
|
@ -134,7 +134,7 @@ func SettingsDelete(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Trace("Organization deleted: %s", org.Name)
|
log.Trace("Organization deleted: %s", org.Name)
|
||||||
ctx.Redirect(setting.AppSubUrl + "/")
|
ctx.Redirect(setting.AppSubURL + "/")
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,11 +194,11 @@ func Diff(ctx *context.Context) {
|
||||||
ctx.Data["Diff"] = diff
|
ctx.Data["Diff"] = diff
|
||||||
ctx.Data["Parents"] = parents
|
ctx.Data["Parents"] = parents
|
||||||
ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
|
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 {
|
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)
|
ctx.HTML(200, tplDiff)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,8 +257,8 @@ func CompareDiff(ctx *context.Context) {
|
||||||
ctx.Data["Commit"] = commit
|
ctx.Data["Commit"] = commit
|
||||||
ctx.Data["Diff"] = diff
|
ctx.Data["Diff"] = diff
|
||||||
ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
|
ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
|
||||||
ctx.Data["SourcePath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "src", 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["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", beforeCommitID)
|
||||||
ctx.Data["RawPath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "raw", afterCommitID)
|
ctx.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "raw", afterCommitID)
|
||||||
ctx.HTML(200, tplDiff)
|
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["MarkdownFileExts"] = strings.Join(setting.Markdown.FileExtensions, ",")
|
||||||
ctx.Data["LineWrapExtensions"] = strings.Join(setting.Repository.Editor.LineWrapExtensions, ",")
|
ctx.Data["LineWrapExtensions"] = strings.Join(setting.Repository.Editor.LineWrapExtensions, ",")
|
||||||
ctx.Data["PreviewableFileModes"] = strings.Join(setting.Repository.Editor.PreviewableFileModes, ",")
|
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)
|
ctx.HTML(200, tplEditFile)
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,8 +123,8 @@ func Issues(ctx *context.Context) {
|
||||||
|
|
||||||
// Must sign in to see issues about you.
|
// Must sign in to see issues about you.
|
||||||
if viewType != "all" && !ctx.IsSigned {
|
if viewType != "all" && !ctx.IsSigned {
|
||||||
ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppSubUrl+ctx.Req.RequestURI), 0, setting.AppSubUrl)
|
ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppSubURL+ctx.Req.RequestURI), 0, setting.AppSubURL)
|
||||||
ctx.Redirect(setting.AppSubUrl + "/user/login")
|
ctx.Redirect(setting.AppSubURL + "/user/login")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -651,7 +651,7 @@ func ViewIssue(ctx *context.Context) {
|
||||||
ctx.Data["NumParticipants"] = len(participants)
|
ctx.Data["NumParticipants"] = len(participants)
|
||||||
ctx.Data["Issue"] = issue
|
ctx.Data["Issue"] = issue
|
||||||
ctx.Data["IsIssueOwner"] = ctx.Repo.IsWriter() || (ctx.IsSigned && issue.IsPoster(ctx.User.ID))
|
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)
|
ctx.HTML(200, tplIssueView)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ func ForkPost(ctx *context.Context, form auth.CreateRepoForm) {
|
||||||
|
|
||||||
repo, has := models.HasForkedRepo(ctxUser.ID, forkRepo.ID)
|
repo, has := models.HasForkedRepo(ctxUser.ID, forkRepo.ID)
|
||||||
if has {
|
if has {
|
||||||
ctx.Redirect(setting.AppSubUrl + "/" + ctxUser.Name + "/" + repo.Name)
|
ctx.Redirect(setting.AppSubURL + "/" + ctxUser.Name + "/" + repo.Name)
|
||||||
return
|
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)
|
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 {
|
func checkPullInfo(ctx *context.Context) *models.Issue {
|
||||||
|
@ -376,9 +376,9 @@ func ViewPullFiles(ctx *context.Context) {
|
||||||
ctx.Data["Username"] = pull.HeadUserName
|
ctx.Data["Username"] = pull.HeadUserName
|
||||||
ctx.Data["Reponame"] = pull.HeadRepo.Name
|
ctx.Data["Reponame"] = pull.HeadRepo.Name
|
||||||
ctx.Data["IsImageFile"] = commit.IsImageFile
|
ctx.Data["IsImageFile"] = commit.IsImageFile
|
||||||
ctx.Data["SourcePath"] = setting.AppSubUrl + "/" + path.Join(headTarget, "src", endCommitID)
|
ctx.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(headTarget, "src", endCommitID)
|
||||||
ctx.Data["BeforeSourcePath"] = setting.AppSubUrl + "/" + path.Join(headTarget, "src", startCommitID)
|
ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(headTarget, "src", startCommitID)
|
||||||
ctx.Data["RawPath"] = setting.AppSubUrl + "/" + path.Join(headTarget, "raw", endCommitID)
|
ctx.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(headTarget, "raw", endCommitID)
|
||||||
ctx.Data["RequireHighlightJS"] = true
|
ctx.Data["RequireHighlightJS"] = true
|
||||||
|
|
||||||
ctx.HTML(200, tplPullFiles)
|
ctx.HTML(200, tplPullFiles)
|
||||||
|
@ -581,9 +581,9 @@ func PrepareCompareDiff(
|
||||||
ctx.Data["IsImageFile"] = headCommit.IsImageFile
|
ctx.Data["IsImageFile"] = headCommit.IsImageFile
|
||||||
|
|
||||||
headTarget := path.Join(headUser.Name, repo.Name)
|
headTarget := path.Join(headUser.Name, repo.Name)
|
||||||
ctx.Data["SourcePath"] = setting.AppSubUrl + "/" + path.Join(headTarget, "src", headCommitID)
|
ctx.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(headTarget, "src", headCommitID)
|
||||||
ctx.Data["BeforeSourcePath"] = setting.AppSubUrl + "/" + path.Join(headTarget, "src", prInfo.MergeBase)
|
ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(headTarget, "src", prInfo.MergeBase)
|
||||||
ctx.Data["RawPath"] = setting.AppSubUrl + "/" + path.Join(headTarget, "raw", headCommitID)
|
ctx.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(headTarget, "raw", headCommitID)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ func CreatePost(ctx *context.Context, form auth.CreateRepoForm) {
|
||||||
})
|
})
|
||||||
if err == nil {
|
if err == nil {
|
||||||
log.Trace("Repository created [%d]: %s/%s", repo.ID, ctxUser.Name, repo.Name)
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ func MigratePost(ctx *context.Context, form auth.MigrateRepoForm) {
|
||||||
})
|
})
|
||||||
if err == nil {
|
if err == nil {
|
||||||
log.Trace("Repository migrated [%d]: %s/%s", repo.ID, ctxUser.Name, form.RepoName)
|
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
|
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)
|
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.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":
|
case "transfer":
|
||||||
if !ctx.Repo.IsOwner() {
|
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)
|
log.Trace("Repository transfered: %s/%s -> %s", ctx.Repo.Owner.Name, repo.Name, newOwner)
|
||||||
ctx.Flash.Success(ctx.Tr("repo.settings.transfer_succeed"))
|
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":
|
case "delete":
|
||||||
if !ctx.Repo.IsOwner() {
|
if !ctx.Repo.IsOwner() {
|
||||||
|
@ -314,7 +314,7 @@ func Collaboration(ctx *context.Context) {
|
||||||
func CollaborationPost(ctx *context.Context) {
|
func CollaborationPost(ctx *context.Context) {
|
||||||
name := strings.ToLower(ctx.Query("collaborator"))
|
name := strings.ToLower(ctx.Query("collaborator"))
|
||||||
if len(name) == 0 || ctx.Repo.Owner.LowerName == name {
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,7 +322,7 @@ func CollaborationPost(ctx *context.Context) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if models.IsErrUserNotExist(err) {
|
if models.IsErrUserNotExist(err) {
|
||||||
ctx.Flash.Error(ctx.Tr("form.user_not_exist"))
|
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 {
|
} else {
|
||||||
ctx.Handle(500, "GetUserByName", err)
|
ctx.Handle(500, "GetUserByName", err)
|
||||||
}
|
}
|
||||||
|
@ -332,7 +332,7 @@ func CollaborationPost(ctx *context.Context) {
|
||||||
// Organization is not allowed to be added as a collaborator.
|
// Organization is not allowed to be added as a collaborator.
|
||||||
if u.IsOrganization() {
|
if u.IsOrganization() {
|
||||||
ctx.Flash.Error(ctx.Tr("repo.settings.org_not_allowed_to_be_collaborator"))
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,7 +353,7 @@ func CollaborationPost(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Flash.Success(ctx.Tr("repo.settings.add_collaborator_success"))
|
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
|
// ChangeCollaborationAccessMode response for changing access of a collaboration
|
||||||
|
|
|
@ -44,8 +44,8 @@ func AutoSignIn(ctx *context.Context) (bool, error) {
|
||||||
defer func() {
|
defer func() {
|
||||||
if !isSucceed {
|
if !isSucceed {
|
||||||
log.Trace("auto-login cookie cleared: %s", uname)
|
log.Trace("auto-login cookie cleared: %s", uname)
|
||||||
ctx.SetCookie(setting.CookieUserName, "", -1, setting.AppSubUrl)
|
ctx.SetCookie(setting.CookieUserName, "", -1, setting.AppSubURL)
|
||||||
ctx.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubUrl)
|
ctx.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubURL)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ func AutoSignIn(ctx *context.Context) (bool, error) {
|
||||||
isSucceed = true
|
isSucceed = true
|
||||||
ctx.Session.Set("uid", u.ID)
|
ctx.Session.Set("uid", u.ID)
|
||||||
ctx.Session.Set("uname", u.Name)
|
ctx.Session.Set("uname", u.Name)
|
||||||
ctx.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubUrl)
|
ctx.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubURL)
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,17 +82,17 @@ func SignIn(ctx *context.Context) {
|
||||||
|
|
||||||
redirectTo := ctx.Query("redirect_to")
|
redirectTo := ctx.Query("redirect_to")
|
||||||
if len(redirectTo) > 0 {
|
if len(redirectTo) > 0 {
|
||||||
ctx.SetCookie("redirect_to", redirectTo, 0, setting.AppSubUrl)
|
ctx.SetCookie("redirect_to", redirectTo, 0, setting.AppSubURL)
|
||||||
} else {
|
} else {
|
||||||
redirectTo, _ = url.QueryUnescape(ctx.GetCookie("redirect_to"))
|
redirectTo, _ = url.QueryUnescape(ctx.GetCookie("redirect_to"))
|
||||||
}
|
}
|
||||||
|
|
||||||
if isSucceed {
|
if isSucceed {
|
||||||
if len(redirectTo) > 0 {
|
if len(redirectTo) > 0 {
|
||||||
ctx.SetCookie("redirect_to", "", -1, setting.AppSubUrl)
|
ctx.SetCookie("redirect_to", "", -1, setting.AppSubURL)
|
||||||
ctx.Redirect(redirectTo)
|
ctx.Redirect(redirectTo)
|
||||||
} else {
|
} else {
|
||||||
ctx.Redirect(setting.AppSubUrl + "/")
|
ctx.Redirect(setting.AppSubURL + "/")
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -121,16 +121,16 @@ func SignInPost(ctx *context.Context, form auth.SignInForm) {
|
||||||
|
|
||||||
if form.Remember {
|
if form.Remember {
|
||||||
days := 86400 * setting.LogInRememberDays
|
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),
|
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("uid", u.ID)
|
||||||
ctx.Session.Set("uname", u.Name)
|
ctx.Session.Set("uname", u.Name)
|
||||||
|
|
||||||
// Clear whatever CSRF has right now, force to generate a new one
|
// 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
|
// Register last login
|
||||||
u.SetLastLogin()
|
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 {
|
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)
|
ctx.Redirect(redirectTo)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Redirect(setting.AppSubUrl + "/")
|
ctx.Redirect(setting.AppSubURL + "/")
|
||||||
}
|
}
|
||||||
|
|
||||||
// SignOut sign out from login status
|
// SignOut sign out from login status
|
||||||
|
@ -155,10 +155,10 @@ func SignOut(ctx *context.Context) {
|
||||||
ctx.Session.Delete("socialId")
|
ctx.Session.Delete("socialId")
|
||||||
ctx.Session.Delete("socialName")
|
ctx.Session.Delete("socialName")
|
||||||
ctx.Session.Delete("socialEmail")
|
ctx.Session.Delete("socialEmail")
|
||||||
ctx.SetCookie(setting.CookieUserName, "", -1, setting.AppSubUrl)
|
ctx.SetCookie(setting.CookieUserName, "", -1, setting.AppSubURL)
|
||||||
ctx.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubUrl)
|
ctx.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubURL)
|
||||||
ctx.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubUrl)
|
ctx.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubURL)
|
||||||
ctx.Redirect(setting.AppSubUrl + "/")
|
ctx.Redirect(setting.AppSubURL + "/")
|
||||||
}
|
}
|
||||||
|
|
||||||
// SignUp render the register page
|
// SignUp render the register page
|
||||||
|
@ -255,7 +255,7 @@ func SignUpPost(ctx *context.Context, cpt *captcha.Captcha, form auth.RegisterFo
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Redirect(setting.AppSubUrl + "/user/login")
|
ctx.Redirect(setting.AppSubURL + "/user/login")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Activate render activate user page
|
// Activate render activate user page
|
||||||
|
@ -303,7 +303,7 @@ func Activate(ctx *context.Context) {
|
||||||
|
|
||||||
ctx.Session.Set("uid", user.ID)
|
ctx.Session.Set("uid", user.ID)
|
||||||
ctx.Session.Set("uname", user.Name)
|
ctx.Session.Set("uname", user.Name)
|
||||||
ctx.Redirect(setting.AppSubUrl + "/")
|
ctx.Redirect(setting.AppSubURL + "/")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ func ActivateEmail(ctx *context.Context) {
|
||||||
ctx.Flash.Success(ctx.Tr("settings.add_email_success"))
|
ctx.Flash.Success(ctx.Tr("settings.add_email_success"))
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Redirect(setting.AppSubUrl + "/user/settings/email")
|
ctx.Redirect(setting.AppSubURL + "/user/settings/email")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,7 +437,7 @@ func ResetPasswdPost(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Trace("User password reset: %s", u.Name)
|
log.Trace("User password reset: %s", u.Name)
|
||||||
ctx.Redirect(setting.AppSubUrl + "/user/login")
|
ctx.Redirect(setting.AppSubURL + "/user/login")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -390,5 +390,5 @@ func Email2User(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
return
|
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 {
|
switch {
|
||||||
case models.IsErrUserAlreadyExist(err):
|
case models.IsErrUserAlreadyExist(err):
|
||||||
ctx.Flash.Error(ctx.Tr("newName_been_taken"))
|
ctx.Flash.Error(ctx.Tr("newName_been_taken"))
|
||||||
ctx.Redirect(setting.AppSubUrl + "/user/settings")
|
ctx.Redirect(setting.AppSubURL + "/user/settings")
|
||||||
case models.IsErrEmailAlreadyUsed(err):
|
case models.IsErrEmailAlreadyUsed(err):
|
||||||
ctx.Flash.Error(ctx.Tr("form.email_been_used"))
|
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):
|
case models.IsErrNameReserved(err):
|
||||||
ctx.Flash.Error(ctx.Tr("user.newName_reserved"))
|
ctx.Flash.Error(ctx.Tr("user.newName_reserved"))
|
||||||
ctx.Redirect(setting.AppSubUrl + "/user/settings")
|
ctx.Redirect(setting.AppSubURL + "/user/settings")
|
||||||
case models.IsErrNamePatternNotAllowed(err):
|
case models.IsErrNamePatternNotAllowed(err):
|
||||||
ctx.Flash.Error(ctx.Tr("user.newName_pattern_not_allowed"))
|
ctx.Flash.Error(ctx.Tr("user.newName_pattern_not_allowed"))
|
||||||
ctx.Redirect(setting.AppSubUrl + "/user/settings")
|
ctx.Redirect(setting.AppSubURL + "/user/settings")
|
||||||
default:
|
default:
|
||||||
ctx.Handle(500, "ChangeUserName", err)
|
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)
|
log.Trace("User settings updated: %s", ctx.User.Name)
|
||||||
ctx.Flash.Success(ctx.Tr("settings.update_profile_success"))
|
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
|
// 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.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
|
// SettingsDeleteAvatar render delete avatar page
|
||||||
|
@ -171,7 +171,7 @@ func SettingsDeleteAvatar(ctx *context.Context) {
|
||||||
ctx.Flash.Error(err.Error())
|
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
|
// 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.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
|
// 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)
|
log.Trace("Email made primary: %s", ctx.User.Name)
|
||||||
ctx.Redirect(setting.AppSubUrl + "/user/settings/email")
|
ctx.Redirect(setting.AppSubURL + "/user/settings/email")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,7 +282,7 @@ func SettingsEmailPost(ctx *context.Context, form auth.AddEmailForm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Trace("Email address added: %s", email.Email)
|
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
|
// 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.Flash.Success(ctx.Tr("settings.email_deletion_success"))
|
||||||
ctx.JSON(200, map[string]interface{}{
|
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"))
|
ctx.Flash.Info(ctx.Tr("form.unable_verify_ssh_key"))
|
||||||
} else {
|
} else {
|
||||||
ctx.Flash.Error(ctx.Tr("form.invalid_ssh_key", err.Error()))
|
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
|
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.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
|
// DeleteSSHKey response for delete user's SSH key
|
||||||
|
@ -370,7 +370,7 @@ func DeleteSSHKey(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.JSON(200, map[string]interface{}{
|
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.Success(ctx.Tr("settings.generate_token_succees"))
|
||||||
ctx.Flash.Info(t.Sha1)
|
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
|
// SettingsDeleteApplication response for delete user access token
|
||||||
|
@ -429,7 +429,7 @@ func SettingsDeleteApplication(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.JSON(200, map[string]interface{}{
|
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 {
|
switch {
|
||||||
case models.IsErrUserOwnRepos(err):
|
case models.IsErrUserOwnRepos(err):
|
||||||
ctx.Flash.Error(ctx.Tr("form.still_own_repo"))
|
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):
|
case models.IsErrUserHasOrgs(err):
|
||||||
ctx.Flash.Error(ctx.Tr("form.still_has_org"))
|
ctx.Flash.Error(ctx.Tr("form.still_has_org"))
|
||||||
ctx.Redirect(setting.AppSubUrl + "/user/settings/delete")
|
ctx.Redirect(setting.AppSubURL + "/user/settings/delete")
|
||||||
default:
|
default:
|
||||||
ctx.Handle(500, "DeleteUser", err)
|
ctx.Handle(500, "DeleteUser", err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Trace("Account deleted: %s", ctx.User.Name)
|
log.Trace("Account deleted: %s", ctx.User.Name)
|
||||||
ctx.Redirect(setting.AppSubUrl + "/")
|
ctx.Redirect(setting.AppSubURL + "/")
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue