mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-25 06:03:40 +09:00
refactor: "install" page (#39400)
1. remove useless options 2. set AppDataPath instead of repo root path 3. make "disable self-registration" default enabled 4. avoid writing corrupted ini file 5. avoid auto-sign-in the existing admin user
This commit is contained in:
+1
-12
@@ -7,7 +7,6 @@ import (
|
||||
"context"
|
||||
|
||||
"gitea.dev/models/db"
|
||||
"gitea.dev/modules/setting"
|
||||
)
|
||||
|
||||
// CheckDatabaseConnection checks the database connection
|
||||
@@ -45,15 +44,5 @@ func HasPostInstallationUsers(ctx context.Context) (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// if there are 2 or more users in database, we consider there are users created after installation
|
||||
threshold := 2
|
||||
if !setting.IsProd {
|
||||
// to debug easily, with non-prod RUN_MODE, we only check the count to 1
|
||||
threshold = 1
|
||||
}
|
||||
res, err := x.Table("user").Cols("id").Limit(threshold).Query()
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return len(res) >= threshold, nil
|
||||
return x.Table("user").Exist()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user