diff --git a/repositories/tenantRepository.go b/repositories/tenantRepository.go index 72e44b9..5cf9cf0 100644 --- a/repositories/tenantRepository.go +++ b/repositories/tenantRepository.go @@ -350,8 +350,15 @@ func (r *tenantRepository) CreateTenantLocation(data models.Tenantlocations) err var user models.Tenantuser tx := r.db.Begin() - // Set status BEFORE insert - data.Status = "InActive" + // Default to Active if the caller didn't specify — matches + // tenantlocations' own gorm default and the primary-location behavior + // from tenant onboarding. Forcing InActive here used to also block the + // spawned manager login (AppLogin checks account status before it ever + // gets to the "no password set" branch), so a new store's login could + // never reach the password-setup screen. + if data.Status == "" { + data.Status = "Active" + } // Step 1: Insert into tenantlocations if err := tx.Create(&data).Error; err != nil { @@ -374,7 +381,7 @@ func (r *tenantRepository) CreateTenantLocation(data models.Tenantlocations) err user.Locationid = data.Locationid user.Applocationid = data.Applocationid user.Configid = 1 - user.Status = "InActive" + user.Status = data.Status user.Roleid = 0 user.Authmode = 0 user.Password = ""