feat: require support master password (C2s33131782*) to reveal passwords via eye icon
This commit is contained in:
@@ -13,7 +13,9 @@ import {
|
||||
Sparkles,
|
||||
CheckCircle2,
|
||||
AlertCircle,
|
||||
Info
|
||||
Info,
|
||||
Lock,
|
||||
Unlock
|
||||
} from 'lucide-react';
|
||||
import {
|
||||
CATEGORIES,
|
||||
@@ -25,6 +27,7 @@ import {
|
||||
import PortalItemCard from './PortalItemCard';
|
||||
import ModalPortalItem from './ModalPortalItem';
|
||||
import ModalConfirm from '../wpp/ModalConfirm';
|
||||
import ModalSupportAuth from './ModalSupportAuth';
|
||||
|
||||
export default function CustomerPortal() {
|
||||
const [items, setItems] = useState([]);
|
||||
@@ -33,6 +36,14 @@ export default function CustomerPortal() {
|
||||
const [copiedWhatsapp, setCopiedWhatsapp] = useState(false);
|
||||
const [toasts, setToasts] = useState([]);
|
||||
|
||||
// Estado de Autenticação da Equipe de Suporte
|
||||
const [isSupportUnlocked, setIsSupportUnlocked] = useState(false);
|
||||
const [authModal, setAuthModal] = useState({
|
||||
isOpen: false,
|
||||
title: '',
|
||||
onSuccess: null
|
||||
});
|
||||
|
||||
// Modals state
|
||||
const [isModalItemOpen, setIsModalItemOpen] = useState(false);
|
||||
const [itemToEdit, setItemToEdit] = useState(null);
|
||||
@@ -66,6 +77,25 @@ export default function CustomerPortal() {
|
||||
}, 3500);
|
||||
};
|
||||
|
||||
// Solicitação de autenticação de suporte para ver senhas
|
||||
const handleRequestSupportAuth = (onSuccess, title) => {
|
||||
setAuthModal({
|
||||
isOpen: true,
|
||||
title: title || 'este acesso',
|
||||
onSuccess
|
||||
});
|
||||
};
|
||||
|
||||
const handleSessionUnlock = () => {
|
||||
setIsSupportUnlocked(true);
|
||||
showToast('Modo de suporte autenticado para esta sessão!', 'success');
|
||||
};
|
||||
|
||||
const handleLockSupport = () => {
|
||||
setIsSupportUnlocked(false);
|
||||
showToast('Modo de suporte bloqueado. Senhas protegidas.', 'info');
|
||||
};
|
||||
|
||||
// Salvar Item (Criar ou Editar)
|
||||
const handleSaveItem = (itemData) => {
|
||||
let updated;
|
||||
@@ -270,6 +300,30 @@ export default function CustomerPortal() {
|
||||
<RotateCcw size={14} />
|
||||
<span>Restaurar Padrão</span>
|
||||
</button>
|
||||
|
||||
{/* Botão de Autenticação / Status do Suporte */}
|
||||
{isSupportUnlocked ? (
|
||||
<button
|
||||
type="button"
|
||||
className="btn-portal-tool"
|
||||
style={{ color: '#38bdf8', borderColor: '#0284c7', background: 'rgba(2, 132, 199, 0.15)' }}
|
||||
onClick={handleLockSupport}
|
||||
title="Modo suporte autenticado. Clique para bloquear."
|
||||
>
|
||||
<Unlock size={14} />
|
||||
<span>Suporte Ativo (Bloquear)</span>
|
||||
</button>
|
||||
) : (
|
||||
<button
|
||||
type="button"
|
||||
className="btn-portal-tool"
|
||||
onClick={() => handleRequestSupportAuth(handleSessionUnlock, 'painel de suporte')}
|
||||
title="Autenticar equipe de suporte para visualizar senhas"
|
||||
>
|
||||
<Lock size={14} />
|
||||
<span>Autenticar Suporte</span>
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -300,6 +354,8 @@ export default function CustomerPortal() {
|
||||
<PortalItemCard
|
||||
key={item.id}
|
||||
item={item}
|
||||
isSupportUnlocked={isSupportUnlocked}
|
||||
onRequestSupportAuth={handleRequestSupportAuth}
|
||||
onEdit={(it) => {
|
||||
setItemToEdit(it);
|
||||
setIsModalItemOpen(true);
|
||||
@@ -341,6 +397,15 @@ export default function CustomerPortal() {
|
||||
type={confirmModal.type}
|
||||
/>
|
||||
|
||||
{/* Modal de Autenticação de Suporte (Senha Padrão C2s33131782*) */}
|
||||
<ModalSupportAuth
|
||||
isOpen={authModal.isOpen}
|
||||
onClose={() => setAuthModal(prev => ({ ...prev, isOpen: false }))}
|
||||
onSuccess={authModal.onSuccess}
|
||||
targetTitle={authModal.title}
|
||||
onSessionUnlock={handleSessionUnlock}
|
||||
/>
|
||||
|
||||
{/* Toasts */}
|
||||
<div className="wpp-toasts-container">
|
||||
{toasts.map(t => (
|
||||
|
||||
Reference in New Issue
Block a user