connexion avec o365
This commit is contained in:
@@ -9,8 +9,9 @@ const Login = () => {
|
||||
const [showPassword, setShowPassword] = useState(false);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [error, setError] = useState('');
|
||||
const { login } = useAuth();
|
||||
|
||||
const navigate = useNavigate();
|
||||
const { login, loginWithO365 } = useAuth();
|
||||
|
||||
const handleSubmit = async (e) => {
|
||||
e.preventDefault();
|
||||
@@ -33,8 +34,6 @@ const Login = () => {
|
||||
<div className="h-32 lg:h-auto lg:flex lg:w-1/2 bg-cover bg-center"
|
||||
style={{ backgroundImage: "url('/assets/ImageEnsup.png')" }}>
|
||||
<div className="w-full bg-black bg-opacity-40 flex items-center justify-center p-4">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -92,12 +91,28 @@ const Login = () => {
|
||||
className="absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-900"
|
||||
title={showPassword ? "Masquer le mot de passe" : "Afficher le mot de passe"}
|
||||
>
|
||||
{/* L'icône est choisie en fonction de l'état de showPassword */}
|
||||
|
||||
{showPassword ? <EyeOff className="w-5 h-5" /> : <Eye className="w-5 h-5" />}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mt-6 text-center">
|
||||
<button
|
||||
onClick={async () => {
|
||||
const success = await loginWithO365();
|
||||
if (success) {
|
||||
navigate('/dashboard');
|
||||
} else {
|
||||
setError("Erreur lors de la connexion Office 365");
|
||||
}
|
||||
}}
|
||||
type="button"
|
||||
className="w-full bg-gray-700 text-white py-3 rounded-lg font-medium hover:bg-green-700 transition-colors"
|
||||
>
|
||||
Se connecter avec Office 365
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{error && (
|
||||
<div className="p-2 lg:p-3 bg-red-50 border border-red-200 rounded-lg">
|
||||
<p className="text-red-600 text-xs lg:text-sm">{error}</p>
|
||||
@@ -119,4 +134,4 @@ const Login = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default Login;
|
||||
export default Login;
|
||||
|
||||
Reference in New Issue
Block a user