Skip to content

Commit 37e70e0

Browse files
committed
Avoid cycle-redirecting user/login page (#28636)
1 parent 683b95f commit 37e70e0

File tree

5 files changed

+1
-13
lines changed

5 files changed

+1
-13
lines changed

models/auth/source.go

-3
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,6 @@ func ActiveSources(tp Type) ([]*Source, error) {
275275
// IsSSPIEnabled returns true if there is at least one activated login
276276
// source of type LoginSSPI
277277
func IsSSPIEnabled() bool {
278-
if !db.HasEngine {
279-
return false
280-
}
281278
sources, err := ActiveSources(SSPI)
282279
if err != nil {
283280
log.Error("ActiveSources: %v", err)

models/db/engine.go

-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ var (
2727
x *xorm.Engine
2828
tables []any
2929
initFuncs []func() error
30-
31-
// HasEngine specifies if we have a xorm.Engine
32-
HasEngine bool
3330
)
3431

3532
// Engine represents a xorm engine or session.

modules/setting/server.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,7 @@ func loadServerFrom(rootCfg ConfigProvider) {
343343
LandingPageURL = LandingPageOrganizations
344344
case "login":
345345
LandingPageURL = LandingPageLogin
346-
case "":
347-
case "home":
346+
case "", "home":
348347
LandingPageURL = LandingPageHome
349348
default:
350349
LandingPageURL = LandingPage(landingPage)

routers/common/db.go

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ func InitDBEngine(ctx context.Context) (err error) {
3737
log.Info("Backing off for %d seconds", int64(setting.Database.DBConnectBackoff/time.Second))
3838
time.Sleep(setting.Database.DBConnectBackoff)
3939
}
40-
db.HasEngine = true
4140
config.SetDynGetter(system_model.NewDatabaseDynKeyGetter())
4241
return nil
4342
}

routers/web/auth/auth.go

-4
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@ const (
4545

4646
// AutoSignIn reads cookie and try to auto-login.
4747
func AutoSignIn(ctx *context.Context) (bool, error) {
48-
if !db.HasEngine {
49-
return false, nil
50-
}
51-
5248
uname := ctx.GetSiteCookie(setting.CookieUserName)
5349
if len(uname) == 0 {
5450
return false, nil

0 commit comments

Comments
 (0)