#1984 Better mirror repo management

This commit is contained in:
Unknwon
2015-12-08 20:06:12 -05:00
parent 1cbd4c01fb
commit 120cd4e471
16 changed files with 128 additions and 60 deletions

View File

@ -69,6 +69,9 @@ func (f MigrateRepoForm) ParseRemoteAddr(user *models.User) (string, error) {
}
if len(f.AuthUsername)+len(f.AuthPassword) > 0 {
u.User = url.UserPassword(f.AuthUsername, f.AuthPassword)
} else {
// Fake user name and password to prevent prompt and fail quick.
u.User = url.UserPassword("fake_user", "")
}
remoteAddr = u.String()
} else if !user.CanImportLocal() {
@ -81,12 +84,13 @@ func (f MigrateRepoForm) ParseRemoteAddr(user *models.User) (string, error) {
}
type RepoSettingForm struct {
RepoName string `binding:"Required;AlphaDashDot;MaxSize(100)"`
Description string `binding:"MaxSize(255)"`
Website string `binding:"Url;MaxSize(100)"`
Branch string
Interval int
Private bool
RepoName string `binding:"Required;AlphaDashDot;MaxSize(100)"`
Description string `binding:"MaxSize(255)"`
Website string `binding:"Url;MaxSize(100)"`
Branch string
Interval int
MirrorAddress string
Private bool
// Advanced settings
EnableWiki bool

File diff suppressed because one or more lines are too long

View File

@ -116,6 +116,7 @@ func Toggle(options *ToggleOptions) macaron.Handler {
ctx.Handle(500, "AutoSignIn", err)
return
} else if succeed {
log.Trace("Auto-login succeed: %s", ctx.Session.Get("uname"))
ctx.Redirect(setting.AppSubUrl + ctx.Req.RequestURI)
return
}

View File

@ -129,6 +129,7 @@ func RepoAssignment(args ...bool) macaron.Handler {
return
}
ctx.Data["MirrorInterval"] = ctx.Repo.Mirror.Interval
ctx.Data["Mirror"] = ctx.Repo.Mirror
}
ctx.Repo.Repository = repo