WebAdmin: allow to create admins with an unusable password

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2025-01-25 16:40:53 +01:00
parent 48258f6e67
commit 70f8b4d495
2 changed files with 5 additions and 8 deletions

View File

@@ -3111,7 +3111,11 @@ func (s *httpdServer) handleWebAddAdminPost(w http.ResponseWriter, r *http.Reque
s.renderAddUpdateAdminPage(w, r, &admin, err, true)
return
}
if admin.Password == "" && s.binding.isWebAdminLoginFormDisabled() {
if admin.Password == "" {
// Administrators can be used with OpenID Connect or for authentication
// via API key, in these cases the password is not necessary, we create
// a non-usable one. This feature is only useful for WebAdmin, in REST
// API you can create an unusable password externally.
admin.Password = util.GenerateUniqueID()
}
ipAddr := util.GetIPFromRemoteAddress(r.RemoteAddr)