Skip to content

Commit

Permalink
Avoid cycle-redirecting user/login page (go-gitea#28636)
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang committed Dec 30, 2023
1 parent 683b95f commit 37e70e0
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 13 deletions.
3 changes: 0 additions & 3 deletions models/auth/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,6 @@ func ActiveSources(tp Type) ([]*Source, error) {
// IsSSPIEnabled returns true if there is at least one activated login
// source of type LoginSSPI
func IsSSPIEnabled() bool {
if !db.HasEngine {
return false
}
sources, err := ActiveSources(SSPI)
if err != nil {
log.Error("ActiveSources: %v", err)
Expand Down
3 changes: 0 additions & 3 deletions models/db/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ var (
x *xorm.Engine
tables []any
initFuncs []func() error

// HasEngine specifies if we have a xorm.Engine
HasEngine bool
)

// Engine represents a xorm engine or session.
Expand Down
3 changes: 1 addition & 2 deletions modules/setting/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,7 @@ func loadServerFrom(rootCfg ConfigProvider) {
LandingPageURL = LandingPageOrganizations
case "login":
LandingPageURL = LandingPageLogin
case "":
case "home":
case "", "home":
LandingPageURL = LandingPageHome
default:
LandingPageURL = LandingPage(landingPage)
Expand Down
1 change: 0 additions & 1 deletion routers/common/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ func InitDBEngine(ctx context.Context) (err error) {
log.Info("Backing off for %d seconds", int64(setting.Database.DBConnectBackoff/time.Second))
time.Sleep(setting.Database.DBConnectBackoff)
}
db.HasEngine = true
config.SetDynGetter(system_model.NewDatabaseDynKeyGetter())
return nil
}
Expand Down
4 changes: 0 additions & 4 deletions routers/web/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ const (

// AutoSignIn reads cookie and try to auto-login.
func AutoSignIn(ctx *context.Context) (bool, error) {
if !db.HasEngine {
return false, nil
}

uname := ctx.GetSiteCookie(setting.CookieUserName)
if len(uname) == 0 {
return false, nil
Expand Down

0 comments on commit 37e70e0

Please sign in to comment.