|
|
@ -4,7 +4,7 @@ import ProfilePDP from '../Components/ProfilePDP';
|
|
|
|
import SessionService from '../services/SessionService';
|
|
|
|
import SessionService from '../services/SessionService';
|
|
|
|
import AuthService from '../services/AuthService';
|
|
|
|
import AuthService from '../services/AuthService';
|
|
|
|
import { PlayerProps } from '../types/Player';
|
|
|
|
import { PlayerProps } from '../types/Player';
|
|
|
|
import { delay, update } from 'lodash';
|
|
|
|
import { delay, set, update } from 'lodash';
|
|
|
|
import { socket } from '../SocketConfig';
|
|
|
|
import { socket } from '../SocketConfig';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -28,6 +28,7 @@ import Button from 'react-bootstrap/Button';
|
|
|
|
import Alert from 'react-bootstrap/Alert';
|
|
|
|
import Alert from 'react-bootstrap/Alert';
|
|
|
|
import Modal from 'react-bootstrap/Modal';
|
|
|
|
import Modal from 'react-bootstrap/Modal';
|
|
|
|
import Form from 'react-bootstrap/Form';
|
|
|
|
import Form from 'react-bootstrap/Form';
|
|
|
|
|
|
|
|
import ProgressBar from 'react-bootstrap/ProgressBar';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//@ts-ignore
|
|
|
|
//@ts-ignore
|
|
|
@ -74,6 +75,8 @@ const Profile = () => {
|
|
|
|
// Etat du nouveau mot de passe
|
|
|
|
// Etat du nouveau mot de passe
|
|
|
|
const [confirmNewPassword, setConfirmNewPassword] = useState('');
|
|
|
|
const [confirmNewPassword, setConfirmNewPassword] = useState('');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const [ percent, setpercent] = useState(0);
|
|
|
|
const handleShowPasswordModal = () => {
|
|
|
|
const handleShowPasswordModal = () => {
|
|
|
|
setShowPasswordModal(true);
|
|
|
|
setShowPasswordModal(true);
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -91,6 +94,7 @@ const Profile = () => {
|
|
|
|
setShowWrongPassword(false);
|
|
|
|
setShowWrongPassword(false);
|
|
|
|
setShowCorrectPassword(true);
|
|
|
|
setShowCorrectPassword(true);
|
|
|
|
setDisableNextStep(false);
|
|
|
|
setDisableNextStep(false);
|
|
|
|
|
|
|
|
setpercent(25);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
else{
|
|
|
|
console.log('Ancien mot de passe incorrect.');
|
|
|
|
console.log('Ancien mot de passe incorrect.');
|
|
|
@ -103,6 +107,7 @@ const Profile = () => {
|
|
|
|
const handleChangeStep = () => {
|
|
|
|
const handleChangeStep = () => {
|
|
|
|
setShowWrongPassword(false);
|
|
|
|
setShowWrongPassword(false);
|
|
|
|
setShowCorrectPassword(false);
|
|
|
|
setShowCorrectPassword(false);
|
|
|
|
|
|
|
|
setpercent(50);
|
|
|
|
setStep(2)
|
|
|
|
setStep(2)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -114,7 +119,7 @@ const Profile = () => {
|
|
|
|
// SessionService.UpdatePassword(user?.pseudo, newPassword);
|
|
|
|
// SessionService.UpdatePassword(user?.pseudo, newPassword);
|
|
|
|
// user.password = newPassword;
|
|
|
|
// user.password = newPassword;
|
|
|
|
console.log('Changement de mot de passe');
|
|
|
|
console.log('Changement de mot de passe');
|
|
|
|
setShowPasswordModal(false);
|
|
|
|
setpercent(100);
|
|
|
|
setTimeout(async () => {
|
|
|
|
setTimeout(async () => {
|
|
|
|
setShowPasswordModal(false);
|
|
|
|
setShowPasswordModal(false);
|
|
|
|
}, 3000);
|
|
|
|
}, 3000);
|
|
|
@ -124,25 +129,28 @@ const Profile = () => {
|
|
|
|
setShowWrongPassword(true);
|
|
|
|
setShowWrongPassword(true);
|
|
|
|
setTimeout(async () => {
|
|
|
|
setTimeout(async () => {
|
|
|
|
setShowWrongPassword(false);
|
|
|
|
setShowWrongPassword(false);
|
|
|
|
}, 3000);
|
|
|
|
}, 1500);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//@ts-ignore
|
|
|
|
|
|
|
|
const handleConfirmNewPasswordChange = (e) => {
|
|
|
|
|
|
|
|
setConfirmNewPassword(e.target.value);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//@ts-ignore
|
|
|
|
//@ts-ignore
|
|
|
|
const handleOldPasswordChange = (e) => {
|
|
|
|
const handleOldPasswordChange = (e) => {
|
|
|
|
setOldPassword(e.target.value);
|
|
|
|
setOldPassword(e.target.value);
|
|
|
|
|
|
|
|
setpercent(13);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//@ts-ignore
|
|
|
|
//@ts-ignore
|
|
|
|
const handleNewPasswordChange = (e) => {
|
|
|
|
const handleNewPasswordChange = (e) => {
|
|
|
|
|
|
|
|
setpercent(63);
|
|
|
|
setNewPassword(e.target.value);
|
|
|
|
setNewPassword(e.target.value);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
//@ts-ignore
|
|
|
|
|
|
|
|
const handleConfirmNewPasswordChange = (e) => {
|
|
|
|
|
|
|
|
setConfirmNewPassword(e.target.value);
|
|
|
|
|
|
|
|
setpercent(75);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//* Gestion Modal de suppression :
|
|
|
|
//* Gestion Modal de suppression :
|
|
|
|
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
|
|
|
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
|
|
@ -237,8 +245,10 @@ const Profile = () => {
|
|
|
|
<Modal show={showPasswordModal} onHide={handleClosePasswordModal}>
|
|
|
|
<Modal show={showPasswordModal} onHide={handleClosePasswordModal}>
|
|
|
|
<Modal.Header closeButton>
|
|
|
|
<Modal.Header closeButton>
|
|
|
|
<Modal.Title>{`Étape ${step}`}</Modal.Title>
|
|
|
|
<Modal.Title>{`Étape ${step}`}</Modal.Title>
|
|
|
|
|
|
|
|
{/* <ProgressBar animated now={50*step} /> */}
|
|
|
|
</Modal.Header>
|
|
|
|
</Modal.Header>
|
|
|
|
<Modal.Body>
|
|
|
|
<Modal.Body>
|
|
|
|
|
|
|
|
<ProgressBar animated now={percent} />
|
|
|
|
{step === 1 && (
|
|
|
|
{step === 1 && (
|
|
|
|
<>
|
|
|
|
<>
|
|
|
|
<p>Entrez votre ancien mot de passe :</p>
|
|
|
|
<p>Entrez votre ancien mot de passe :</p>
|
|
|
|