Skip to content

Commit

Permalink
Fix fast login in auth state
Browse files Browse the repository at this point in the history
  • Loading branch information
zachhuff386 committed Dec 2, 2023
1 parent 2311f0e commit 0b4bae8
Showing 1 changed file with 35 additions and 53 deletions.
88 changes: 35 additions & 53 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,36 +104,25 @@ 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 {

if !googleOnly {
return
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 {

googleOnly := true
for _, provider := range settings.Auth.Providers {
if provider.Type != Google {
googleOnly = false
break
}
}

if !googleOnly {
return
}
if !googleOnly {
return
}
}

Expand All @@ -146,36 +139,25 @@ func GetFastUserPath() (path string) {
}

func GetFastServicePath() (path string) {
if settings.Auth.ForceFastServiceLogin {
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.ForceFastServiceLogin &&
len(settings.Auth.Providers) != 0 {
} else if !settings.Local.NoLocalAuth || !settings.Auth.FastLogin ||
len(settings.Auth.Providers) == 0 {

if !googleOnly {
return
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 {

googleOnly := true
for _, provider := range settings.Auth.Providers {
if provider.Type != Google {
googleOnly = false
break
}
}

if !googleOnly {
return
}
if !googleOnly {
return
}
}

Expand Down

0 comments on commit 0b4bae8

Please sign in to comment.