blob: c1750dc8144e5f9989d84a30d7c1b863ecea9112 (
plain) (
blame)
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
|
import React, { useState } from 'react';
import { sendPasswordResetEmail } from 'firebase/auth';
import { auth } from '../firebase';
const ResetPage = () => {
const [email, setEmail] = useState('');
const [message, setMessage] = useState('');
const [error, setError] = useState('');
const handleReset = async () => {
try {
await sendPasswordResetEmail(auth, email);
setMessage('Reset link sent to your email');
} catch (error) {
setError(error.message);
}
};
return (
<div className="container mx-auto flex items-center justify-center min-h-screen bg-gray-100">
<div className="bg-white p-6 rounded shadow-md w-full max-w-sm">
<h4 className="mb-4 text-center">Reset Password</h4>
<div className="mb-4">
<label>Email</label>
<input
type="email"
value={email}
onChange={(e) => setEmail(e.target.value)}
className="form-control"
/>
</div>
{error && <p className="text-danger">{error}</p>}
{message && <p className="text-success">{message}</p>}
<button onClick={handleReset} className="btn btn-primary w-full">Send Reset Link</button>
</div>
</div>
);
};
export default ResetPage;
|