Skip to content

Commit

Permalink
Fix fast login paths in auth state
Browse files Browse the repository at this point in the history
  • Loading branch information
zachhuff386 committed Dec 3, 2023
1 parent 9d7ac59 commit e963efe
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions auth/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}
}
Expand Down

0 comments on commit e963efe

Please sign in to comment.