File tree Expand file tree Collapse file tree 5 files changed +6
-14
lines changed Expand file tree Collapse file tree 5 files changed +6
-14
lines changed Original file line number Diff line number Diff 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
277277func 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 )
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 @@ -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 )
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 uname := ctx .GetSiteCookie (setting .CookieUserName )
5349 if len (uname ) == 0 {
5450 return false , nil
@@ -130,7 +126,11 @@ func checkAutoLogin(ctx *context.Context) bool {
130126
131127 if isSucceed {
132128 middleware .DeleteRedirectToCookie (ctx .Resp )
133- ctx .RedirectToFirst (redirectTo , setting .AppSubURL + string (setting .LandingPageURL ))
129+ nextRedirectTo := setting .AppSubURL + string (setting .LandingPageURL )
130+ if setting .LandingPageURL == setting .LandingPageLogin {
131+ nextRedirectTo = setting .AppSubURL + "/" // do not cycle-redirect to the login page
132+ }
133+ ctx .RedirectToFirst (redirectTo , nextRedirectTo )
134134 return true
135135 }
136136
You can’t perform that action at this time.
0 commit comments