2025-02-19 21:27:53 -05:00
|
|
|
"use client";
|
|
|
|
|
2025-02-24 23:31:48 -05:00
|
|
|
import React, { useState } from "react";
|
2025-02-19 21:27:53 -05:00
|
|
|
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
|
|
|
import { Input } from "@/components/ui/input";
|
|
|
|
import { Button } from "@/components/ui/button";
|
|
|
|
import { Label } from "@/components/ui/label";
|
|
|
|
|
|
|
|
export function ChangePassword() {
|
|
|
|
const [newPassword, setNewPassword] = useState("");
|
|
|
|
const [loading, setLoading] = useState(false);
|
|
|
|
const [message, setMessage] = useState<string | null>(null);
|
|
|
|
|
|
|
|
const handlePasswordChange = async (e: React.FormEvent<HTMLFormElement>) => {
|
|
|
|
e.preventDefault();
|
|
|
|
setLoading(true);
|
|
|
|
setMessage(null);
|
|
|
|
await new Promise((resolve) => setTimeout(resolve, 5000));
|
|
|
|
setMessage("Password updated successfully.");
|
|
|
|
setLoading(false);
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Card>
|
|
|
|
<CardHeader>
|
|
|
|
<CardTitle>Change Password</CardTitle>
|
|
|
|
</CardHeader>
|
|
|
|
<CardContent>
|
|
|
|
<form onSubmit={handlePasswordChange} className="space-y-4">
|
|
|
|
<div className="space-y-2">
|
|
|
|
<Label htmlFor="new-password">New Password</Label>
|
|
|
|
<Input
|
|
|
|
id="new-password"
|
|
|
|
type="password"
|
|
|
|
value={newPassword}
|
|
|
|
onChange={(e) => setNewPassword(e.target.value)}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<Button type="submit" disabled={loading}>
|
|
|
|
{loading ? "Changing..." : "Change Password"}
|
|
|
|
</Button>
|
|
|
|
{message && <p className="text-sm text-center">{message}</p>}
|
|
|
|
</form>
|
|
|
|
</CardContent>
|
|
|
|
</Card>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ChangePassword;
|