fix: expose superadmin login option
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import React, { useState } from 'react';
|
||||
import { X, Loader2, GraduationCap, School, UserPlus } from 'lucide-react';
|
||||
import { X, Loader2, GraduationCap, School, ShieldCheck, UserPlus } from 'lucide-react';
|
||||
import { useAuth } from '../context/AuthContext';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { UserRole } from '../types';
|
||||
@@ -27,9 +27,9 @@ export const LoginModal: React.FC<LoginModalProps> = ({ isOpen, onClose }) => {
|
||||
setError('');
|
||||
setIsSubmitting(true);
|
||||
|
||||
if (isRegistering && role === 'professor') {
|
||||
if (isRegistering && role !== 'student') {
|
||||
setIsSubmitting(false);
|
||||
setError('Contas de instrutor são liberadas pelo administrador da plataforma.');
|
||||
setError('Contas de instrutor e administrador são liberadas pelo superadmin da plataforma.');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -45,11 +45,13 @@ export const LoginModal: React.FC<LoginModalProps> = ({ isOpen, onClose }) => {
|
||||
return;
|
||||
}
|
||||
|
||||
if (signedInUser.role !== 'superadmin' && signedInUser.role !== role) {
|
||||
if (signedInUser.role !== role) {
|
||||
logout();
|
||||
setError(role === 'professor'
|
||||
? 'Esta conta não possui acesso de instrutor.'
|
||||
: 'Esta conta possui acesso de instrutor. Selecione a opção Instrutor.');
|
||||
setError(role === 'superadmin'
|
||||
? 'Esta conta não possui acesso de administrador.'
|
||||
: role === 'professor'
|
||||
? 'Esta conta não possui acesso de instrutor.'
|
||||
: 'Esta conta possui outro nível de acesso. Selecione a opção correspondente.');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -72,7 +74,10 @@ export const LoginModal: React.FC<LoginModalProps> = ({ isOpen, onClose }) => {
|
||||
</div>
|
||||
|
||||
<div className="flex bg-black/40 p-1 rounded-[8px] mb-6 border border-white/5 relative">
|
||||
<div className={`absolute top-1 bottom-1 w-[calc(50%-4px)] bg-orange-500/20 rounded-[8px] transition-all duration-300 ease-out border border-orange-500/30 shadow-md ${role === 'student' ? 'left-1' : 'left-[calc(50%+4px)]'}`} />
|
||||
<div
|
||||
className="absolute top-1 bottom-1 w-[calc(33.333%-5px)] bg-orange-500/20 rounded-[8px] transition-all duration-300 ease-out border border-orange-500/30 shadow-md"
|
||||
style={{ transform: `translateX(${role === 'student' ? 0 : role === 'professor' ? 100 : 200}%)` }}
|
||||
/>
|
||||
<button type="button" onClick={() => setRole('student')} className={`flex-1 flex items-center justify-center gap-2 py-2.5 rounded-[8px] relative z-10 transition-colors duration-300 ${role === 'student' ? 'text-white font-semibold' : 'text-gray-400 hover:text-gray-300'}`}>
|
||||
<GraduationCap className="w-4 h-4" />
|
||||
<span className="text-body-sm font-semibold tracking-body-sm">Aluno</span>
|
||||
@@ -81,6 +86,10 @@ export const LoginModal: React.FC<LoginModalProps> = ({ isOpen, onClose }) => {
|
||||
<School className="w-4 h-4" />
|
||||
<span className="text-body-sm font-semibold tracking-body-sm">Instrutor</span>
|
||||
</button>
|
||||
<button type="button" onClick={() => setRole('superadmin')} className={`flex-1 flex items-center justify-center gap-2 py-2.5 rounded-[8px] relative z-10 transition-colors duration-300 ${role === 'superadmin' ? 'text-white font-semibold' : 'text-gray-400 hover:text-gray-300'}`}>
|
||||
<ShieldCheck className="w-4 h-4" />
|
||||
<span className="text-body-sm font-semibold tracking-body-sm">Admin</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<form onSubmit={handleSubmit} className="space-y-5">
|
||||
|
||||
Reference in New Issue
Block a user