diff --git a/dataprovider/user.go b/dataprovider/user.go index 2cf24b97..b3bbb6c7 100644 --- a/dataprovider/user.go +++ b/dataprovider/user.go @@ -1331,6 +1331,15 @@ func (u *User) GetBandwidthAsString() string { return result } +// GetMFAStatusAsString returns MFA status +func (u *User) GetMFAStatusAsString() string { + result := "-" + if u.Filters.TOTPConfig.Enabled { + result = strings.Join(u.Filters.TOTPConfig.Protocols, ", ") + } + return result +} + // GetInfoString returns user's info as string. // Storage provider, number of public keys, max sessions, uid, // gid, denied and allowed IP/Mask are returned diff --git a/httpd/webadmin.go b/httpd/webadmin.go index 148b6e77..c51f59cc 100644 --- a/httpd/webadmin.go +++ b/httpd/webadmin.go @@ -130,6 +130,7 @@ type basePage struct { CSRFToken string HasDefender bool HasExternalLogin bool + HasMFA bool LoggedAdmin *dataprovider.Admin Branding UIBranding } @@ -485,6 +486,7 @@ func (s *httpdServer) getBasePageData(title, currentURL string, r *http.Request) Version: version.GetAsString(), LoggedAdmin: getAdminFromToken(r), HasDefender: common.Config.DefenderConfig.Enabled, + HasMFA: len(mfa.GetAvailableTOTPConfigNames()) > 0, HasExternalLogin: isLoggedInWithOIDC(r), CSRFToken: csrfToken, Branding: s.binding.Branding.WebAdmin, diff --git a/templates/webadmin/admins.html b/templates/webadmin/admins.html index 6370523f..ecfbec79 100644 --- a/templates/webadmin/admins.html +++ b/templates/webadmin/admins.html @@ -32,6 +32,7 @@ ID Username Status + {{if .HasMFA }}MFA{{end}} Permissions Other @@ -42,6 +43,7 @@ {{.ID}} {{.Username}} {{if eq .Status 1 }}Active{{else}}Inactive{{end}} + {{if $.HasMFA }}{{if .Filters.TOTPConfig.Enabled }}Enabled{{else}}-{{end}}{{end}} {{.GetPermissionsAsString}} {{.GetInfoString}} diff --git a/templates/webadmin/users.html b/templates/webadmin/users.html index 69796594..72b78314 100644 --- a/templates/webadmin/users.html +++ b/templates/webadmin/users.html @@ -32,6 +32,7 @@ ID Username Status + {{if .HasMFA }}MFA{{end}} Bandwidth Quota Other @@ -43,6 +44,7 @@ {{.ID}} {{.Username}} {{.GetStatusAsString}} + {{if $.HasMFA }}{{.GetMFAStatusAsString}}{{end}} {{.GetBandwidthAsString}} {{.GetQuotaSummary}} {{.GetInfoString}}