From e963efeecc6a9054631c2ba6463868fa01f39a16 Mon Sep 17 00:00:00 2001 From: Zachary Huff Date: Sun, 3 Dec 2023 17:27:07 -0500 Subject: [PATCH] Fix fast login paths in auth state --- auth/state.go | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/auth/state.go b/auth/state.go index ca47084c..5b6dfd19 100644 --- a/auth/state.go +++ b/auth/state.go @@ -72,8 +72,12 @@ func GetState() (state *State) { func GetFastAdminPath() (path string) { if !settings.Local.NoLocalAuth || !settings.Auth.FastLogin || - len(settings.Auth.Providers) != 1 { + len(settings.Auth.Providers) == 0 { + return + } + + if len(settings.Auth.Providers) > 1 { googleOnly := true for _, provider := range settings.Auth.Providers { if provider.Type != Google { @@ -100,24 +104,24 @@ func GetFastAdminPath() (path string) { } func GetFastUserPath() (path string) { - if settings.Auth.ForceFastUserLogin { - if len(settings.Auth.Providers) != 1 { - googleOnly := true - for _, provider := range settings.Auth.Providers { - if provider.Type != Google { - googleOnly = false - break - } - } + if settings.Auth.FastLogin && settings.Auth.ForceFastUserLogin && + len(settings.Auth.Providers) != 0 { + } else if !settings.Local.NoLocalAuth || !settings.Auth.FastLogin || + len(settings.Auth.Providers) == 0 { + + return + } - if !googleOnly { - return + if len(settings.Auth.Providers) > 1 { + googleOnly := true + for _, provider := range settings.Auth.Providers { + if provider.Type != Google { + googleOnly = false + break } } - } else { - if !settings.Local.NoLocalAuth || !settings.Auth.FastLogin || - len(settings.Auth.Providers) != 1 { + if !googleOnly { return } }