|
|
|
@ -52,7 +52,9 @@ export default function ProfileSettings() {
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
passwordConfirmRef.current!.setCustomValidity(
|
|
|
|
|
password === confirmPassword ? "" : "Les mots de passe ne correspondent pas !"
|
|
|
|
|
password === confirmPassword
|
|
|
|
|
? ""
|
|
|
|
|
: "Les mots de passe ne correspondent pas !",
|
|
|
|
|
)
|
|
|
|
|
}, [confirmPassword, password])
|
|
|
|
|
|
|
|
|
@ -110,9 +112,8 @@ export default function ProfileSettings() {
|
|
|
|
|
autoComplete="username"
|
|
|
|
|
required
|
|
|
|
|
placeholder="Nom d'utilisateur"
|
|
|
|
|
|
|
|
|
|
value={name}
|
|
|
|
|
onChange={e => setName(e.target.value)}
|
|
|
|
|
onChange={(e) => setName(e.target.value)}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<label htmlFor="email">Adresse email</label>
|
|
|
|
@ -124,9 +125,8 @@ export default function ProfileSettings() {
|
|
|
|
|
placeholder={"Adresse email"}
|
|
|
|
|
autoComplete="email"
|
|
|
|
|
required
|
|
|
|
|
|
|
|
|
|
value={email}
|
|
|
|
|
onChange={e => setEmail(e.target.value)}
|
|
|
|
|
onChange={(e) => setEmail(e.target.value)}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<label htmlFor="password">Mot de passe</label>
|
|
|
|
@ -137,12 +137,13 @@ export default function ProfileSettings() {
|
|
|
|
|
type="password"
|
|
|
|
|
placeholder={"Mot de passe"}
|
|
|
|
|
autoComplete="new-password"
|
|
|
|
|
|
|
|
|
|
value={password}
|
|
|
|
|
onChange={e => setPassword(e.target.value)}
|
|
|
|
|
onChange={(e) => setPassword(e.target.value)}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<label htmlFor="confirmPassword">Confirmez le mot de passe</label>
|
|
|
|
|
<label htmlFor="confirmPassword">
|
|
|
|
|
Confirmez le mot de passe
|
|
|
|
|
</label>
|
|
|
|
|
<input
|
|
|
|
|
ref={passwordConfirmRef}
|
|
|
|
|
className="settings-input"
|
|
|
|
@ -151,14 +152,13 @@ export default function ProfileSettings() {
|
|
|
|
|
type="password"
|
|
|
|
|
autoComplete="new-password"
|
|
|
|
|
placeholder={"Confirmation du mot de passe"}
|
|
|
|
|
|
|
|
|
|
value={confirmPassword}
|
|
|
|
|
onChange={e => setConfirmPassword(e.target.value)}
|
|
|
|
|
onChange={(e) =>
|
|
|
|
|
setConfirmPassword(e.target.value)
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<button
|
|
|
|
|
className="settings-button"
|
|
|
|
|
type="submit">
|
|
|
|
|
<button className="settings-button" type="submit">
|
|
|
|
|
Mettre à jour
|
|
|
|
|
</button>
|
|
|
|
|
</form>
|
|
|
|
@ -207,11 +207,12 @@ function ProfileImageInputPopup({ show, onHide }: ProfileImageInputPopupProps) {
|
|
|
|
|
if (e.key === "Escape") onHide()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
window.addEventListener('keyup', onKeyUp)
|
|
|
|
|
return () => window.removeEventListener('keyup', onKeyUp)
|
|
|
|
|
window.addEventListener("keyup", onKeyUp)
|
|
|
|
|
return () => window.removeEventListener("keyup", onKeyUp)
|
|
|
|
|
}, [onHide])
|
|
|
|
|
|
|
|
|
|
const handleForm = useCallback(async (e: FormEvent) => {
|
|
|
|
|
const handleForm = useCallback(
|
|
|
|
|
async (e: FormEvent) => {
|
|
|
|
|
e.preventDefault()
|
|
|
|
|
|
|
|
|
|
const url = urlRef.current!.value
|
|
|
|
@ -225,7 +226,9 @@ function ProfileImageInputPopup({ show, onHide }: ProfileImageInputPopupProps) {
|
|
|
|
|
setUser({ ...user!, profilePicture: url })
|
|
|
|
|
setErrorMessages([])
|
|
|
|
|
onHide()
|
|
|
|
|
}, [fetcher, onHide, setUser, user])
|
|
|
|
|
},
|
|
|
|
|
[fetcher, onHide, setUser, user],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if (!show) return <></>
|
|
|
|
|
|
|
|
|
@ -243,7 +246,9 @@ function ProfileImageInputPopup({ show, onHide }: ProfileImageInputPopupProps) {
|
|
|
|
|
{msg}
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
<label id="profile-picture-popup-subtitle" htmlFor="profile-picture">
|
|
|
|
|
<label
|
|
|
|
|
id="profile-picture-popup-subtitle"
|
|
|
|
|
htmlFor="profile-picture">
|
|
|
|
|
Saisissez le lien vers votre nouvelle photo de profil
|
|
|
|
|
</label>
|
|
|
|
|
<input
|
|
|
|
@ -260,7 +265,7 @@ function ProfileImageInputPopup({ show, onHide }: ProfileImageInputPopupProps) {
|
|
|
|
|
required
|
|
|
|
|
placeholder={"lien vers une image"}
|
|
|
|
|
value={link}
|
|
|
|
|
onChange={e => setLink(e.target.value)}
|
|
|
|
|
onChange={(e) => setLink(e.target.value)}
|
|
|
|
|
/>
|
|
|
|
|
<div id="profile-picture-popup-footer">
|
|
|
|
|
<button className={"settings-button"} onClick={onHide}>
|
|
|
|
|