feat: the password is turned off by hand in the account, with a passkey in place; password change; tabs sized by their titles

This commit is contained in:
redtea committed 2026-10-14 20:46:35 +03:00
1 parent 67222e2e05
commit 6dd1120a41
9 files changed
+212 -25

No files matched your search

+5 -3
View File
@@ -90,8 +90,8 @@ func (s *Server) handleLoginSubmit(w http.ResponseWriter, r *http.Request) {
s.render(w, "login.html", map[string]any{"Error": "Неверный логин или пароль.", "Username": username})
return
}
// With a passkey on the account, the password alone does not do.
if s.db.CountAdminKeys(admin.ID) > 0 {
// An admin who turned the password off signs in with a passkey only.
if s.db.PasswordOff(admin.ID) {
s.render(w, "login.html", map[string]any{"Error": "Для этого аккаунта вход только по ключу доступа.", "Username": username})
return
}
@@ -378,9 +378,10 @@ func (s *Server) handleAgentRename(w http.ResponseWriter, r *http.Request) {
func (s *Server) handleSettings(w http.ResponseWriter, r *http.Request) {
admins, _ := s.db.ListAdmins()
keyCounts := map[int64]int{}
keyCounts, passOff := map[int64]int{}, map[int64]bool{}
for _, a := range admins {
keyCounts[a.ID] = s.db.CountAdminKeys(a.ID)
passOff[a.ID] = s.db.PasswordOff(a.ID)
}
host := s.db.HostAddress()
secret := s.db.EnrollSecret()
@@ -393,6 +394,7 @@ func (s *Server) handleSettings(w http.ResponseWriter, r *http.Request) {
"Secret": secret,
"Admins": admins,
"KeyCounts": keyCounts,
"PassOff": passOff,
"CSRF": csrfToken(r),
"InstallShort": fmt.Sprintf("wget -qO- %s/i/%s | sudo sh", host, code),
"InstallCurl": fmt.Sprintf("curl -fsSL %s/install.sh | sudo HOST=%s ENROLL_SECRET=%s sh", host, host, secret),