mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-21 23:20:24 +00:00
feat: make MFA status visible in WebAdmin (#844)
Signed-off-by: Tim Birkett <tim.birkett@sainsburys.co.uk>
This commit is contained in:
parent
9abd186166
commit
a87aa9b98e
4 changed files with 15 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
<th>ID</th>
|
||||
<th>Username</th>
|
||||
<th>Status</th>
|
||||
{{if .HasMFA }}<th>MFA</th>{{end}}
|
||||
<th>Permissions</th>
|
||||
<th>Other</th>
|
||||
</tr>
|
||||
|
@ -42,6 +43,7 @@
|
|||
<td>{{.ID}}</td>
|
||||
<td>{{.Username}}</td>
|
||||
<td>{{if eq .Status 1 }}Active{{else}}Inactive{{end}}</td>
|
||||
{{if $.HasMFA }}<td>{{if .Filters.TOTPConfig.Enabled }}Enabled{{else}}-{{end}}</td>{{end}}
|
||||
<td>{{.GetPermissionsAsString}}</td>
|
||||
<td>{{.GetInfoString}}</td>
|
||||
</tr>
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
<th>ID</th>
|
||||
<th>Username</th>
|
||||
<th>Status</th>
|
||||
{{if .HasMFA }}<th>MFA</th>{{end}}
|
||||
<th>Bandwidth</th>
|
||||
<th>Quota</th>
|
||||
<th>Other</th>
|
||||
|
@ -43,6 +44,7 @@
|
|||
<td>{{.ID}}</td>
|
||||
<td>{{.Username}}</td>
|
||||
<td>{{.GetStatusAsString}}</td>
|
||||
{{if $.HasMFA }}<td>{{.GetMFAStatusAsString}}</td>{{end}}
|
||||
<td>{{.GetBandwidthAsString}}</td>
|
||||
<td>{{.GetQuotaSummary}}</td>
|
||||
<td>{{.GetInfoString}}</td>
|
||||
|
|
Loading…
Reference in a new issue