-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforgot-password.jsx
51 lines (44 loc) · 1.46 KB
/
forgot-password.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import React from 'react'
import { useState } from "react";
import { Link, useNavigate } from "react-router-dom";
import axios from 'axios'
function ForgotPassword() {
const [email, setEmail] = useState()
const navigate = useNavigate()
axios.defaults.withCredentials = true;
const handleSubmit = (e) => {
e.preventDefault()
axios.post('http://localhost:3001/forgot-password', {email})
.then(res => {
if(res.data.Status === "Success") {
navigate('/login')
}
}).catch(err => console.log(err))
}
return(
<div className="d-flex justify-content-center align-items-center bg-secondary vh-100">
<div className="bg-white p-3 rounded w-25">
<h4>Forgot Password</h4>
<form onSubmit={handleSubmit}>
<div className="mb-3">
<label htmlFor="email">
<strong>Email</strong>
</label>
<input
type="email"
placeholder="Enter Email"
autoComplete="off"
name="email"
className="form-control rounded-0"
onChange={(e) => setEmail(e.target.value)}
/>
</div>
<button type="submit" className="btn btn-success w-100 rounded-0">
Send
</button>
</form>
</div>
</div>
)
}
export default ForgotPassword;