File tree 6 files changed +7
-18
lines changed
6 files changed +7
-18
lines changed Original file line number Diff line number Diff line change @@ -261,16 +261,12 @@ func (opts FindSourcesOptions) ToConds() builder.Cond {
261
261
// IsSSPIEnabled returns true if there is at least one activated login
262
262
// source of type LoginSSPI
263
263
func IsSSPIEnabled (ctx context.Context ) bool {
264
- if ! db .HasEngine {
265
- return false
266
- }
267
-
268
264
exist , err := db .Exist [Source ](ctx , FindSourcesOptions {
269
265
IsActive : util .OptionalBoolTrue ,
270
266
LoginType : SSPI ,
271
267
}.ToConds ())
272
268
if err != nil {
273
- log .Error ("Active SSPI Sources : %v" , err )
269
+ log .Error ("IsSSPIEnabled: failed to query active SSPI sources : %v" , err )
274
270
return false
275
271
}
276
272
return exist
Original file line number Diff line number Diff line change 27
27
x * xorm.Engine
28
28
tables []any
29
29
initFuncs []func () error
30
-
31
- // HasEngine specifies if we have a xorm.Engine
32
- HasEngine bool
33
30
)
34
31
35
32
// Engine represents a xorm engine or session.
Original file line number Diff line number Diff line change @@ -341,8 +341,7 @@ func loadServerFrom(rootCfg ConfigProvider) {
341
341
LandingPageURL = LandingPageOrganizations
342
342
case "login" :
343
343
LandingPageURL = LandingPageLogin
344
- case "" :
345
- case "home" :
344
+ case "" , "home" :
346
345
LandingPageURL = LandingPageHome
347
346
default :
348
347
LandingPageURL = LandingPage (landingPage )
Original file line number Diff line number Diff line change @@ -47,8 +47,6 @@ func GetContextData(c context.Context) ContextData {
47
47
48
48
func CommonTemplateContextData () ContextData {
49
49
return ContextData {
50
- "IsLandingPageOrganizations" : setting .LandingPageURL == setting .LandingPageOrganizations ,
51
-
52
50
"ShowRegistrationButton" : setting .Service .ShowRegistrationButton ,
53
51
"ShowMilestonesDashboardPage" : setting .Service .ShowMilestonesDashboardPage ,
54
52
"ShowFooterVersion" : setting .Other .ShowFooterVersion ,
Original file line number Diff line number Diff line change @@ -37,7 +37,6 @@ func InitDBEngine(ctx context.Context) (err error) {
37
37
log .Info ("Backing off for %d seconds" , int64 (setting .Database .DBConnectBackoff / time .Second ))
38
38
time .Sleep (setting .Database .DBConnectBackoff )
39
39
}
40
- db .HasEngine = true
41
40
config .SetDynGetter (system_model .NewDatabaseDynKeyGetter ())
42
41
return nil
43
42
}
Original file line number Diff line number Diff line change @@ -45,10 +45,6 @@ const (
45
45
46
46
// autoSignIn reads cookie and try to auto-login.
47
47
func autoSignIn (ctx * context.Context ) (bool , error ) {
48
- if ! db .HasEngine {
49
- return false , nil
50
- }
51
-
52
48
isSucceed := false
53
49
defer func () {
54
50
if ! isSucceed {
@@ -145,7 +141,11 @@ func CheckAutoLogin(ctx *context.Context) bool {
145
141
146
142
if isSucceed {
147
143
middleware .DeleteRedirectToCookie (ctx .Resp )
148
- ctx .RedirectToFirst (redirectTo , setting .AppSubURL + string (setting .LandingPageURL ))
144
+ nextRedirectTo := setting .AppSubURL + string (setting .LandingPageURL )
145
+ if setting .LandingPageURL == setting .LandingPageLogin {
146
+ nextRedirectTo = setting .AppSubURL // do not cycle-redirect to the login page
147
+ }
148
+ ctx .RedirectToFirst (redirectTo , nextRedirectTo )
149
149
return true
150
150
}
151
151
You can’t perform that action at this time.
0 commit comments