fix: context controller

This commit is contained in:
Stavros
2026-04-29 19:31:44 +03:00
parent 97d58b376d
commit 9a219046ac
2 changed files with 48 additions and 20 deletions
+27
View File
@@ -177,3 +177,30 @@ func (c *UserContext) GetName() string {
return ""
}
}
func (c *UserContext) ProviderName() string {
switch c.Provider {
case ProviderBasicAuth, ProviderLocal:
return "local"
case ProviderLDAP:
return "ldap"
case ProviderOAuth:
return c.OAuth.DisplayName // compatability
default:
return "unknown"
}
}
func (c *UserContext) TOTPPending() bool {
if c.Provider == ProviderLocal {
return c.Local.TOTPPending
}
return false
}
func (c *UserContext) OAuthName() string {
if c.Provider == ProviderOAuth {
return c.OAuth.DisplayName
}
return ""
}