fix installer

This commit is contained in:
Daniel Noulet 2026-10-02 21:45:42 +02:00
parent 46030a5b14
commit c2091e746a
19 changed files with 264 additions and 73 deletions

View file

@ -70,6 +70,11 @@ func (s *Server) passwordLogin(w http.ResponseWriter, r *http.Request) {
http.NotFound(w, r)
return
}
tenantSlug := s.requestTenantSlug(r.Host)
if tenantSlug == "" {
http.NotFound(w, r)
return
}
r.Body = http.MaxBytesReader(w, r.Body, 16<<10)
if err := r.ParseForm(); err != nil {
writeError(w, http.StatusBadRequest, "invalid login request")
@ -107,6 +112,14 @@ func (s *Server) passwordLogin(w http.ResponseWriter, r *http.Request) {
if err != nil {
password.Verify(s.loginGuard.dummyHash, passwordValue)
}
if valid {
tenantAllowed, accessErr := s.store.HasTenantAccess(r.Context(), user.ID, tenantSlug)
if accessErr != nil {
s.internalError(w, "check password user tenant access", accessErr)
return
}
valid = tenantAllowed
}
if !valid {
s.loginGuard.fail(guardKey, now)
var userID *string