clean css
This commit is contained in:
40
resources/js/pages/Auth/ForgotPassword.tsx
Normal file
40
resources/js/pages/Auth/ForgotPassword.tsx
Normal file
@@ -0,0 +1,40 @@
|
||||
import React, {FormEvent, SyntheticEvent, useState} from "react"
|
||||
import Field from "../../components/Field";
|
||||
import axios from "axios";
|
||||
import {useNavigate} from "react-router-dom";
|
||||
import useAuthUser from "../../hooks/AuthUser";
|
||||
|
||||
const ForgotPassword = () => {
|
||||
|
||||
const [email, setEmail] = useState('')
|
||||
const [message, setMessage] = useState(false)
|
||||
|
||||
const handleSubmit = async (event: FormEvent) => {
|
||||
event.preventDefault()
|
||||
try {
|
||||
await axios.get('/sanctum/csrf-cookie')
|
||||
const res = await axios.post('/api/forgot', {email})
|
||||
setMessage(true)
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
|
||||
return <div>
|
||||
<form onSubmit={handleSubmit} className="w-96 mx-auto mt-10 border shadow p-3">
|
||||
<h1 className="text-center">Connexion</h1>
|
||||
|
||||
{message && <p className="bg-green-600">Un email vous a été envoyer pour modifier le mot de passe.</p>}
|
||||
|
||||
<Field type="email"
|
||||
name="email"
|
||||
placeholder="Email"
|
||||
value={email}
|
||||
onChange={event => setEmail(event.target.value)}
|
||||
autoFocus>Email</Field>
|
||||
<button type="submit" className="mt-5 bg-blue-700 w-full block text-white px-5 py-2 text-lg rounded">Valider</button>
|
||||
</form>
|
||||
</div>
|
||||
}
|
||||
|
||||
export default ForgotPassword
|
||||
Reference in New Issue
Block a user