chore: remove personal names from auth session and header avatar

This commit is contained in:
alireza 2026-08-27 11:25:16 +03:30
parent 2988788630
commit 719f18f553
2 changed files with 15 additions and 3 deletions

View File

@ -45,7 +45,7 @@ export const AppHeader: React.FC<AppHeaderProps> = ({
onNavigate('/login'); onNavigate('/login');
}; };
const initial = currentSession?.fullName?.trim().slice(0, 1) || 'د'; const initial = currentSession?.fullName?.trim().slice(0, 1) || 'ر';
// Alerts are the critical items in the nearest horizon, not a fixed list. // Alerts are the critical items in the nearest horizon, not a fixed list.
const alerts = items const alerts = items

View File

@ -1,6 +1,6 @@
import { UserSession, PersonaType } from '../types/futures'; import { UserSession, PersonaType } from '../types/futures';
const AUTH_STORAGE_KEY = 'ufr_auth_session_v1'; const AUTH_STORAGE_KEY = 'ufr_auth_session_v2';
export const PRESET_USERS: Record<PersonaType, UserSession> = { export const PRESET_USERS: Record<PersonaType, UserSession> = {
president: { president: {
@ -55,9 +55,21 @@ class AuthService {
private loadSession() { private loadSession() {
try { try {
// Clear legacy storage keys if present
if (typeof window !== 'undefined' && window.localStorage) {
localStorage.removeItem('ufr_auth_session_v1');
}
const stored = localStorage.getItem(AUTH_STORAGE_KEY); const stored = localStorage.getItem(AUTH_STORAGE_KEY);
if (stored) { if (stored) {
this.currentSession = JSON.parse(stored); const parsed = JSON.parse(stored);
if (parsed?.fullName && (parsed.fullName.includes('هرسیج') || parsed.fullName.includes('حسن') || parsed.fullName.includes('حسین'))) {
const role = (parsed.role as PersonaType) || 'president';
this.currentSession = PRESET_USERS[role] || PRESET_USERS.president;
this.saveSession();
} else {
this.currentSession = parsed;
}
} else { } else {
// Default authenticated persona for immediate institutional exploration // Default authenticated persona for immediate institutional exploration
this.currentSession = PRESET_USERS.president; this.currentSession = PRESET_USERS.president;