mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Bug fix on organization
This commit is contained in:
@@ -218,6 +218,8 @@ func InstallPost(ctx *middleware.Context, form auth.InstallForm) {
|
||||
|
||||
setting.Cfg.SetValue("", "RUN_MODE", "prod")
|
||||
|
||||
setting.Cfg.SetValue("log", "MODE", "file")
|
||||
|
||||
setting.Cfg.SetValue("security", "INSTALL_LOCK", "true")
|
||||
|
||||
os.MkdirAll("custom/conf", os.ModePerm)
|
||||
|
@@ -142,8 +142,9 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) {
|
||||
ctx.Data["Title"] = ctx.Tr("new_migrate")
|
||||
|
||||
ctxUser := ctx.User
|
||||
if orgId := com.StrTo(ctx.Query("org")).MustInt64(); orgId > 0 {
|
||||
org, err := models.GetUserById(orgId)
|
||||
// Not equal means current user is an organization.
|
||||
if form.Uid != ctx.User.Id {
|
||||
org, err := models.GetUserById(form.Uid)
|
||||
if err != nil && err != models.ErrUserNotExist {
|
||||
ctx.Handle(500, "GetUserById", err)
|
||||
return
|
||||
|
@@ -119,9 +119,22 @@ func SettingsPost(ctx *middleware.Context, form auth.RepoSettingForm) {
|
||||
if ctx.Repo.Repository.Name != form.RepoName {
|
||||
ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_repo_name"), SETTINGS_OPTIONS, nil)
|
||||
return
|
||||
} else if !ctx.Repo.Owner.ValidtePassword(ctx.Query("password")) {
|
||||
ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_password"), SETTINGS_OPTIONS, nil)
|
||||
return
|
||||
}
|
||||
|
||||
if ctx.Repo.Owner.IsOrganization() {
|
||||
if !ctx.Repo.Owner.IsOrgOwner(ctx.User.Id) {
|
||||
ctx.Error(404)
|
||||
return
|
||||
}
|
||||
if !ctx.User.ValidtePassword(ctx.Query("password")) {
|
||||
ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_password"), SETTINGS_OPTIONS, nil)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
if !ctx.Repo.Owner.ValidtePassword(ctx.Query("password")) {
|
||||
ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_password"), SETTINGS_OPTIONS, nil)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if err := models.DeleteRepository(ctx.Repo.Owner.Id, ctx.Repo.Repository.Id, ctx.Repo.Owner.Name); err != nil {
|
||||
|
Reference in New Issue
Block a user