File tree Expand file tree Collapse file tree 6 files changed +7
-18
lines changed Expand file tree Collapse file tree 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 {
261261// IsSSPIEnabled returns true if there is at least one activated login
262262// source of type LoginSSPI
263263func IsSSPIEnabled (ctx context.Context ) bool {
264- if ! db .HasEngine {
265- return false
266- }
267-
268264 exist , err := db .Exist [Source ](ctx , FindSourcesOptions {
269265 IsActive : util .OptionalBoolTrue ,
270266 LoginType : SSPI ,
271267 }.ToConds ())
272268 if err != nil {
273- log .Error ("Active SSPI Sources : %v" , err )
269+ log .Error ("IsSSPIEnabled: failed to query active SSPI sources : %v" , err )
274270 return false
275271 }
276272 return exist
Original file line number Diff line number Diff line change 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.
Original file line number Diff line number Diff line change @@ -341,8 +341,7 @@ func loadServerFrom(rootCfg ConfigProvider) {
341341 LandingPageURL = LandingPageOrganizations
342342 case "login" :
343343 LandingPageURL = LandingPageLogin
344- case "" :
345- case "home" :
344+ case "" , "home" :
346345 LandingPageURL = LandingPageHome
347346 default :
348347 LandingPageURL = LandingPage (landingPage )
Original file line number Diff line number Diff line change @@ -47,8 +47,6 @@ func GetContextData(c context.Context) ContextData {
4747
4848func CommonTemplateContextData () ContextData {
4949 return ContextData {
50- "IsLandingPageOrganizations" : setting .LandingPageURL == setting .LandingPageOrganizations ,
51-
5250 "ShowRegistrationButton" : setting .Service .ShowRegistrationButton ,
5351 "ShowMilestonesDashboardPage" : setting .Service .ShowMilestonesDashboardPage ,
5452 "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) {
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}
Original file line number Diff line number Diff line change @@ -45,10 +45,6 @@ const (
4545
4646// autoSignIn reads cookie and try to auto-login.
4747func autoSignIn (ctx * context.Context ) (bool , error ) {
48- if ! db .HasEngine {
49- return false , nil
50- }
51-
5248 isSucceed := false
5349 defer func () {
5450 if ! isSucceed {
@@ -145,7 +141,11 @@ func CheckAutoLogin(ctx *context.Context) bool {
145141
146142 if isSucceed {
147143 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 )
149149 return true
150150 }
151151
You can’t perform that action at this time.
0 commit comments