[FEAT] Ruolo Consulente + Wizard Registrazione v2
- register.html: step 0 scelta profilo (Azienda / Consulente) - onboarding.html: wizard 4-step con P.IVA obbligatoria (auto-fetch CertiSource) - companies.html: nuova dashboard consulente con cards aziende e compliance score - common.js: org-switcher sidebar + role labels corretti per consulente - login.html: routing post-login (consulente → companies.html) - api.js: isConsultant(), setUserRole(), register con user_type - AuthController: user_type=consultant → role=consultant in users table - OnboardingController: multi-org per consulente, duplicate VAT check - 005_consultant_support.sql: aggiunge 'consultant' a user_organizations.role ENUM Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
ba21534e6a
commit
7080695d06
+7
-4
@@ -82,11 +82,14 @@
|
||||
const result = await api.login(email, password);
|
||||
|
||||
if (result.success) {
|
||||
// Controlla se l'utente ha un'organizzazione
|
||||
if (result.data.organizations && result.data.organizations.length > 0) {
|
||||
window.location.href = 'dashboard.html';
|
||||
} else {
|
||||
const isConsultant = result.data.user && result.data.user.role === 'consultant';
|
||||
const hasOrgs = result.data.organizations && result.data.organizations.length > 0;
|
||||
if (!hasOrgs) {
|
||||
window.location.href = 'onboarding.html';
|
||||
} else if (isConsultant) {
|
||||
window.location.href = 'companies.html';
|
||||
} else {
|
||||
window.location.href = 'dashboard.html';
|
||||
}
|
||||
} else {
|
||||
errorEl.textContent = result.message || 'Credenziali non valide.';
|
||||
|
||||
Reference in New Issue
Block a user