Skip to content

Commit 45e04c0

Browse files
committed
fix: merge fixes
2 parents e7b661f + 9d24901 commit 45e04c0

File tree

5 files changed

+139
-43
lines changed

5 files changed

+139
-43
lines changed

LEADERBOARD.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
Celebrate the remarkable contributions of our top contributors.
66

7-
| S/N | Rank | | Contributor | Merged PRs |
8-
| --- | ---- | ----------------------------------------------------------------------------------------------------- | --------------------------------------------------------- | ---------- |
9-
| 1 | 🥇 | <img src='https://avatars.githubusercontent.com/u/131811805?v=4' alt='Avatar' width='30' height='30'> | [Seyi-Amusan](https://github.com/Seyi-Amusan) | 12 |
10-
| 2 | 🥈 | <img src='https://avatars.githubusercontent.com/u/116392457?v=4' alt='Avatar' width='30' height='30'> | [alexgrate](https://github.com/alexgrate) | 6 |
11-
| 3 | 🥉 | <img src='https://avatars.githubusercontent.com/u/193773700?v=4' alt='Avatar' width='30' height='30'> | [aryadharmadhikari](https://github.com/aryadharmadhikari) | 4 |
12-
| 4 | 4 | <img src='https://avatars.githubusercontent.com/u/101010436?v=4' alt='Avatar' width='30' height='30'> | [MichaelOmoniyi](https://github.com/MichaelOmoniyi) | 3 |
13-
| 5 | 5 | <img src='https://avatars.githubusercontent.com/u/73708569?v=4' alt='Avatar' width='30' height='30'> | [Jonniie](https://github.com/Jonniie) | 1 |
14-
| 6 | 5 | <img src='https://avatars.githubusercontent.com/u/168524066?v=4' alt='Avatar' width='30' height='30'> | [kumaradarsh2](https://github.com/kumaradarsh2) | 1 |
7+
| S/N | Rank || Contributor | Merged PRs |
8+
|--| ---- | -- |----------- | ---------- |
9+
| 1 | 🥇 | <img src='https://avatars.githubusercontent.com/u/131811805?v=4' alt='Avatar' width='30' height='30'> | [Seyi-Amusan](https://github.com/Seyi-Amusan) | 13 |
10+
| 2 | 🥈 | <img src='https://avatars.githubusercontent.com/u/116392457?v=4' alt='Avatar' width='30' height='30'> | [alexgrate](https://github.com/alexgrate) | 6 |
11+
| 3 | 🥉 | <img src='https://avatars.githubusercontent.com/u/193773700?v=4' alt='Avatar' width='30' height='30'> | [aryadharmadhikari](https://github.com/aryadharmadhikari) | 4 |
12+
| 4 | 4 | <img src='https://avatars.githubusercontent.com/u/101010436?v=4' alt='Avatar' width='30' height='30'> | [MichaelOmoniyi](https://github.com/MichaelOmoniyi) | 3 |
13+
| 5 | 5 | <img src='https://avatars.githubusercontent.com/u/73708569?v=4' alt='Avatar' width='30' height='30'> | [Jonniie](https://github.com/Jonniie) | 1 |
14+
| 6 | 5 | <img src='https://avatars.githubusercontent.com/u/168524066?v=4' alt='Avatar' width='30' height='30'> | [kumaradarsh2](https://github.com/kumaradarsh2) | 1 |
1515

1616
A heartfelt **thank you** to all our fantastic contributors for their hard work and dedication! Together, we're making a difference in the open-source community.
1717

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,14 @@ We maintain a leaderboard to track your contributions and their impact on our pr
9393

9494
Thank you to all our fantastic contributors for their hard work and dedication! Here are our top 10 contributors:
9595

96-
| S/N | Rank | | Contributor | Merged PRs |
97-
| --- | ---- | ----------------------------------------------------------------------------------------------------- | --------------------------------------------------------- | ---------- |
98-
| 1 | 🥇 | <img src='https://avatars.githubusercontent.com/u/131811805?v=4' alt='Avatar' width='30' height='30'> | [Seyi-Amusan](https://github.com/Seyi-Amusan) | 12 |
99-
| 2 | 🥈 | <img src='https://avatars.githubusercontent.com/u/116392457?v=4' alt='Avatar' width='30' height='30'> | [alexgrate](https://github.com/alexgrate) | 6 |
100-
| 3 | 🥉 | <img src='https://avatars.githubusercontent.com/u/193773700?v=4' alt='Avatar' width='30' height='30'> | [aryadharmadhikari](https://github.com/aryadharmadhikari) | 4 |
101-
| 4 | 4 | <img src='https://avatars.githubusercontent.com/u/101010436?v=4' alt='Avatar' width='30' height='30'> | [MichaelOmoniyi](https://github.com/MichaelOmoniyi) | 3 |
102-
| 5 | 5 | <img src='https://avatars.githubusercontent.com/u/73708569?v=4' alt='Avatar' width='30' height='30'> | [Jonniie](https://github.com/Jonniie) | 1 |
103-
| 6 | 5 | <img src='https://avatars.githubusercontent.com/u/168524066?v=4' alt='Avatar' width='30' height='30'> | [kumaradarsh2](https://github.com/kumaradarsh2) | 1 |
96+
| S/N | Rank || Contributor | Merged PRs |
97+
|--| ---- | -- |----------- | ---------- |
98+
| 1 | 🥇 | <img src='https://avatars.githubusercontent.com/u/131811805?v=4' alt='Avatar' width='30' height='30'> | [Seyi-Amusan](https://github.com/Seyi-Amusan) | 13 |
99+
| 2 | 🥈 | <img src='https://avatars.githubusercontent.com/u/116392457?v=4' alt='Avatar' width='30' height='30'> | [alexgrate](https://github.com/alexgrate) | 6 |
100+
| 3 | 🥉 | <img src='https://avatars.githubusercontent.com/u/193773700?v=4' alt='Avatar' width='30' height='30'> | [aryadharmadhikari](https://github.com/aryadharmadhikari) | 4 |
101+
| 4 | 4 | <img src='https://avatars.githubusercontent.com/u/101010436?v=4' alt='Avatar' width='30' height='30'> | [MichaelOmoniyi](https://github.com/MichaelOmoniyi) | 3 |
102+
| 5 | 5 | <img src='https://avatars.githubusercontent.com/u/73708569?v=4' alt='Avatar' width='30' height='30'> | [Jonniie](https://github.com/Jonniie) | 1 |
103+
| 6 | 5 | <img src='https://avatars.githubusercontent.com/u/168524066?v=4' alt='Avatar' width='30' height='30'> | [kumaradarsh2](https://github.com/kumaradarsh2) | 1 |
104104

105105
Thank you to all our fantastic contributors for their hard work and dedication!
106106

src/app/reset-password/page.tsx

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/app/verify-reset-otp/page.tsx

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
"use client";
2+
3+
import { Suspense, useState } from "react";
4+
import { useRouter, useSearchParams } from "next/navigation";
5+
import { Button } from "@/components/ui/button";
6+
import { Input } from "@/components/ui/input";
7+
import { toast } from "sonner";
8+
9+
function VerifyResetOtpContent() {
10+
const router = useRouter();
11+
const searchParams = useSearchParams();
12+
const email = searchParams.get("email") || localStorage.getItem("resetEmail");
13+
14+
const [otp, setOtp] = useState("");
15+
const [loading, setLoading] = useState(false);
16+
17+
const handleSubmit = async (e: React.FormEvent) => {
18+
e.preventDefault();
19+
20+
if (!/^\d{6}$/.test(otp)) {
21+
toast.error("Please enter a valid 6-digit numeric code");
22+
return;
23+
}
24+
25+
if (!email) {
26+
toast.error(
27+
"Email not found. Please restart the password reset process.",
28+
);
29+
return;
30+
}
31+
32+
setLoading(true);
33+
34+
try {
35+
const response = await fetch(
36+
`${process.env.NEXT_PUBLIC_API_URL}/verify_reset_otp`,
37+
{
38+
method: "POST",
39+
headers: { "Content-Type": "application/json" },
40+
body: JSON.stringify({ email, otp }),
41+
},
42+
);
43+
44+
const data = await response.json();
45+
46+
if (response.ok) {
47+
localStorage.setItem("resetEmail", email);
48+
toast.success("OTP verified successfully!");
49+
router.push(`/new-password?email=${encodeURIComponent(email)}`);
50+
} else {
51+
const errorMsg = Array.isArray(data.detail)
52+
? data.detail[0]?.msg
53+
: typeof data.detail === "string"
54+
? data.detail
55+
: "Invalid or expired OTP";
56+
toast.error(errorMsg);
57+
}
58+
} catch (error) {
59+
console.error(error);
60+
toast.error("Network error. Please try again.");
61+
} finally {
62+
setLoading(false);
63+
}
64+
};
65+
66+
return (
67+
<main className="flex flex-col items-center justify-center min-h-screen bg-[#222222] px-4">
68+
<section className="w-full max-w-md text-center">
69+
<h2 className="text-2xl text-white mb-4">Verify Reset Code</h2>
70+
<p className="text-gray-400 mb-6">
71+
Enter the 6-digit code sent to your email.
72+
</p>
73+
74+
<form onSubmit={handleSubmit} className="space-y-4">
75+
<Input
76+
value={otp}
77+
onChange={(e) => setOtp(e.target.value)}
78+
placeholder="Enter OTP"
79+
maxLength={6}
80+
disabled={loading}
81+
className="border text-white h-12 text-center tracking-widest disabled:opacity-50"
82+
/>
83+
<Button
84+
type="submit"
85+
disabled={loading}
86+
className="w-full py-3 h-12 hover:bg-[#FF7A50]/90 text-white rounded-md text-sm leading-none"
87+
style={{ fontFamily: "var(--font-source-serif-pro)" }}
88+
>
89+
{loading ? "Verifying..." : "Verify Code"}
90+
</Button>
91+
</form>
92+
93+
<div className="mt-4 text-sm text-gray-400">
94+
Didn’t get a code?{" "}
95+
<a href="/forgot-password" className="text-[#FF7A50] font-semibold">
96+
Resend
97+
</a>
98+
</div>
99+
</section>
100+
</main>
101+
);
102+
}
103+
104+
export default function VerifyResetOtpPage() {
105+
return (
106+
<Suspense
107+
fallback={<div className="text-white text-center mt-10">Loading...</div>}
108+
>
109+
<VerifyResetOtpContent />
110+
</Suspense>
111+
);
112+
}

src/components/features/forgot-password/forgot-password-form.tsx

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { zodResolver } from "@hookform/resolvers/zod";
44
import { useForm } from "react-hook-form";
55
import { toast } from "sonner";
6-
import { z } from "zod";
6+
import { email, z } from "zod";
77

88
import { Button } from "@/components/ui/button";
99
import {
@@ -34,20 +34,19 @@ export const ForgotPasswordForm = () => {
3434
async function onSubmit(data: z.infer<typeof ForgotPasswordFormSchema>) {
3535
setIsLoading(true);
3636
try {
37-
const response = await fetch(
38-
`${process.env.NEXT_PUBLIC_API_URL}/reset-password`,
39-
{
40-
method: "POST",
41-
headers: { "Content-Type": "application/json" },
42-
body: JSON.stringify({ email: data.email }),
43-
},
44-
);
37+
const url = `${process.env.NEXT_PUBLIC_API_URL}/resend_otp?email=${encodeURIComponent(data.email)}`;
38+
const response = await fetch(url, { method: "POST" });
39+
40+
console.log("Endpoint:", url);
41+
console.log("Response:", response);
4542

4643
if (response.ok) {
4744
toast.success("Password reset link sent! Please check your email.");
48-
// Optionally store the email for the next step
49-
//localStorage.setItem("resetEmail", data.email);
50-
router.push("/verify-reset-otp");
45+
localStorage.setItem("resetEmail", data.email);
46+
router.push(
47+
`/verify-reset-otp?email=${encodeURIComponent(data.email)}`,
48+
);
49+
// router.push("/verify-reset-otp");
5150
} else {
5251
const errorData = await response.json();
5352
toast.error(

0 commit comments

Comments
 (0)