mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
remove old files
teacher/login teacher/register teacher/resetPassword
This commit is contained in:
parent
deaaa8bc9b
commit
dff86aa6e9
4 changed files with 0 additions and 260 deletions
|
|
@ -1,17 +0,0 @@
|
||||||
.login-links {
|
|
||||||
padding-top: 10px;
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-links a {
|
|
||||||
padding: 4px;
|
|
||||||
color: #333;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-links a:hover {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
@ -1,94 +0,0 @@
|
||||||
import { useNavigate, Link } from 'react-router-dom';
|
|
||||||
|
|
||||||
// JoinRoom.tsx
|
|
||||||
import React, { useEffect, useState } from 'react';
|
|
||||||
|
|
||||||
import './Login.css';
|
|
||||||
import { TextField } from '@mui/material';
|
|
||||||
import LoadingButton from '@mui/lab/LoadingButton';
|
|
||||||
|
|
||||||
import LoginContainer from '../../../components/LoginContainer/LoginContainer'
|
|
||||||
import ApiService from '../../../services/ApiService';
|
|
||||||
|
|
||||||
const Login: React.FC = () => {
|
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
const [email, setEmail] = useState('');
|
|
||||||
const [password, setPassword] = useState('');
|
|
||||||
|
|
||||||
const [connectionError, setConnectionError] = useState<string>('');
|
|
||||||
const [isConnecting] = useState<boolean>(false);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
return () => {
|
|
||||||
|
|
||||||
};
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const login = async () => {
|
|
||||||
const result = await ApiService.login(email, password);
|
|
||||||
|
|
||||||
if (result != true) {
|
|
||||||
setConnectionError(result);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
navigate("/teacher/Dashboard")
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
|
||||||
<LoginContainer
|
|
||||||
title='Login'
|
|
||||||
error={connectionError}>
|
|
||||||
|
|
||||||
<TextField
|
|
||||||
label="Email"
|
|
||||||
variant="outlined"
|
|
||||||
value={email}
|
|
||||||
onChange={(e) => setEmail(e.target.value)}
|
|
||||||
placeholder="Nom d'utilisateur"
|
|
||||||
sx={{ marginBottom: '1rem' }}
|
|
||||||
fullWidth
|
|
||||||
/>
|
|
||||||
|
|
||||||
<TextField
|
|
||||||
label="Mot de passe"
|
|
||||||
variant="outlined"
|
|
||||||
type="password"
|
|
||||||
value={password}
|
|
||||||
onChange={(e) => setPassword(e.target.value)}
|
|
||||||
placeholder="Nom de la salle"
|
|
||||||
sx={{ marginBottom: '1rem' }}
|
|
||||||
fullWidth
|
|
||||||
/>
|
|
||||||
|
|
||||||
<LoadingButton
|
|
||||||
loading={isConnecting}
|
|
||||||
onClick={login}
|
|
||||||
variant="contained"
|
|
||||||
sx={{ marginBottom: `${connectionError && '2rem'}` }}
|
|
||||||
disabled={!email || !password}
|
|
||||||
>
|
|
||||||
Login
|
|
||||||
</LoadingButton>
|
|
||||||
|
|
||||||
<div className="login-links">
|
|
||||||
|
|
||||||
<Link to="/teacher/resetPassword">
|
|
||||||
Réinitialiser le mot de passe
|
|
||||||
</Link>
|
|
||||||
|
|
||||||
<Link to="/teacher/register">
|
|
||||||
Créer un compte
|
|
||||||
</Link>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</LoginContainer>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Login;
|
|
||||||
|
|
@ -1,81 +0,0 @@
|
||||||
|
|
||||||
import { useNavigate } from 'react-router-dom';
|
|
||||||
|
|
||||||
// JoinRoom.tsx
|
|
||||||
import React, { useEffect, useState } from 'react';
|
|
||||||
|
|
||||||
import { TextField } from '@mui/material';
|
|
||||||
import LoadingButton from '@mui/lab/LoadingButton';
|
|
||||||
|
|
||||||
import LoginContainer from '../../../components/LoginContainer/LoginContainer'
|
|
||||||
import ApiService from '../../../services/ApiService';
|
|
||||||
|
|
||||||
const Register: React.FC = () => {
|
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
const [email, setEmail] = useState('');
|
|
||||||
const [password, setPassword] = useState('');
|
|
||||||
|
|
||||||
const [connectionError, setConnectionError] = useState<string>('');
|
|
||||||
const [isConnecting] = useState<boolean>(false);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
return () => {
|
|
||||||
|
|
||||||
};
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const register = async () => {
|
|
||||||
const result = await ApiService.register(email, password, "temp"); // "temp", car ce fichier n'est plus utilisé. il est déplacer dans /AuthManager
|
|
||||||
|
|
||||||
if (result != true) {
|
|
||||||
setConnectionError(result);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
navigate("/teacher/login")
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
|
||||||
<LoginContainer
|
|
||||||
title='Créer un compte'
|
|
||||||
error={connectionError}>
|
|
||||||
|
|
||||||
<TextField
|
|
||||||
label="Email"
|
|
||||||
variant="outlined"
|
|
||||||
value={email}
|
|
||||||
onChange={(e) => setEmail(e.target.value)}
|
|
||||||
placeholder="Adresse courriel"
|
|
||||||
sx={{ marginBottom: '1rem' }}
|
|
||||||
fullWidth
|
|
||||||
/>
|
|
||||||
|
|
||||||
<TextField
|
|
||||||
label="Mot de passe"
|
|
||||||
variant="outlined"
|
|
||||||
value={password}
|
|
||||||
type="password"
|
|
||||||
onChange={(e) => setPassword(e.target.value)}
|
|
||||||
placeholder="Mot de passe"
|
|
||||||
sx={{ marginBottom: '1rem' }}
|
|
||||||
fullWidth
|
|
||||||
/>
|
|
||||||
|
|
||||||
<LoadingButton
|
|
||||||
loading={isConnecting}
|
|
||||||
onClick={register}
|
|
||||||
variant="contained"
|
|
||||||
sx={{ marginBottom: `${connectionError && '2rem'}` }}
|
|
||||||
disabled={!email || !password}
|
|
||||||
>
|
|
||||||
S'inscrire
|
|
||||||
</LoadingButton>
|
|
||||||
|
|
||||||
</LoginContainer>
|
|
||||||
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Register;
|
|
||||||
|
|
@ -1,68 +0,0 @@
|
||||||
|
|
||||||
import { useNavigate } from 'react-router-dom';
|
|
||||||
|
|
||||||
// JoinRoom.tsx
|
|
||||||
import React, { useEffect, useState } from 'react';
|
|
||||||
|
|
||||||
import { TextField } from '@mui/material';
|
|
||||||
import LoadingButton from '@mui/lab/LoadingButton';
|
|
||||||
|
|
||||||
import LoginContainer from '../../../components/LoginContainer/LoginContainer'
|
|
||||||
import ApiService from '../../../services/ApiService';
|
|
||||||
|
|
||||||
const ResetPassword: React.FC = () => {
|
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
const [email, setEmail] = useState('');
|
|
||||||
|
|
||||||
const [connectionError, setConnectionError] = useState<string>('');
|
|
||||||
const [isConnecting] = useState<boolean>(false);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
return () => {
|
|
||||||
|
|
||||||
};
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const reset = async () => {
|
|
||||||
const result = await ApiService.resetPassword(email);
|
|
||||||
|
|
||||||
if (result != true) {
|
|
||||||
setConnectionError(result);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
navigate("/teacher/login")
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
|
||||||
<LoginContainer
|
|
||||||
title='Récupération du compte'
|
|
||||||
error={connectionError}>
|
|
||||||
|
|
||||||
<TextField
|
|
||||||
label="Email"
|
|
||||||
variant="outlined"
|
|
||||||
value={email}
|
|
||||||
onChange={(e) => setEmail(e.target.value)}
|
|
||||||
placeholder="Adresse courriel"
|
|
||||||
sx={{ marginBottom: '1rem' }}
|
|
||||||
fullWidth
|
|
||||||
/>
|
|
||||||
|
|
||||||
<LoadingButton
|
|
||||||
loading={isConnecting}
|
|
||||||
onClick={reset}
|
|
||||||
variant="contained"
|
|
||||||
sx={{ marginBottom: `${connectionError && '2rem'}` }}
|
|
||||||
disabled={!email}
|
|
||||||
>
|
|
||||||
Réinitialiser le mot de passe
|
|
||||||
</LoadingButton>
|
|
||||||
|
|
||||||
</LoginContainer>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default ResetPassword;
|
|
||||||
Loading…
Reference in a new issue