AI Review Center
Commit Review Workspace ?
Select a commit on the left to inspect quality, security, business value, findings, and suggested code changes.
Project AI Score
?
63%
Quality Avg
?
68%
Security Avg
?
45%
Reviews
?
56
Review Result ?
jattin01/avriti · 09b81516
The commit adds client-side logic and UI for login, signup, and forgot password functionalities. Basic validation and user feedback are implemented. However, there are opportunities to improve error handling, security, and form usability. The commit message is misspelled and lacks detail.
Quality
?
75%
Security
?
55%
Business Value
?
70%
Maintainability
?
70%
Issues & Suggested Fixes
?
1AI detects the issue
2Shows file, line, or evidence
3Suggests the fix to apply
Typo And Lack Of Detail
Where
commit message
Issue / Evidence
typo and lack of detail
Suggested Fix
fix spelling to 'integrate login signup' and add more descriptive information about the changes made
Handlesubmit Function Lacks Disabled State...
Where
app/forgot-password/page.tsx:12
Issue / Evidence
handleSubmit function lacks disabled state when input is invalid
Suggested Fix
consider disabling submit when email is empty or invalid to improve UX and prevent unnecessary requests
Error Message Extraction Is Fragile
Where
app/forgot-password/page.tsx:37
Issue / Evidence
error message extraction is fragile
Suggested Fix
improve error parsing from API response to cover wider cases and avoid showing generic messages
Redundant Try Catch Around Localstorage Wi...
Where
app/login/page.tsx:31
Issue / Evidence
redundant try-catch around localStorage without logging
Suggested Fix
add at least a console warning or error to catch issues storing data
Missing Validation
Where
app/login/page.tsx:15-17
Issue / Evidence
password validation is minimal
Suggested Fix
consider more robust password strength validation to improve security
No Redirect Or Feedback After Successful R...
Where
app/register/page.tsx:48
Issue / Evidence
no redirect or feedback after successful registration before location change
Suggested Fix
consider adding a success message or confirmation UI for better UX
Missing Validation
Where
app/register/page.tsx:17-26
Issue / Evidence
validation is basic
Suggested Fix
add stronger validation especially to phone and password and confirmPassword mismatch edge cases
Empty Catch Block Ignoring Potential Error...
Where
app/register/page.tsx:41
Issue / Evidence
empty catch block ignoring potential errors with localStorage
Suggested Fix
add error handling or logging
Disabled State Controlled Only By Loading
Where
app/login/page.tsx:91 and app/forgot-password/page.tsx:90
Issue / Evidence
disabled state controlled only by loading
Suggested Fix
disable button also on invalid input fields to prevent user errors
Duplicate Logic
Where
app/register/page.tsx:74-76
Issue / Evidence
UI error message block repeated pattern could be refactored into a reusable component for better maintainability
Suggested Fix
Review and simplify this section.
Code Change Preview · app/forgot-password/page.tsx
?
Removed / Before Commit
Added / After Commit
+ "use client"; + + import { useState } from "react"; + import Link from "next/link"; + + export default function ForgotPasswordPage() { + const [email, setEmail] = useState(""); + const [loading, setLoading] = useState(false); + const [error, setError] = useState(""); + const [success, setSuccess] = useState(""); + + const handleSubmit = async () => { + setError(""); + setSuccess(""); + // Validation + if (!email.trim()) { + setError("Email address is required."); + return;
Removed / Before Commit
- const [password, setPassword] = useState(""); - const [showPassword, setShowPassword] = useState(false); - const [loading, setLoading] = useState(false); - const [focused, setFocused] = useState(""); - - const handleSubmit = () => { - setLoading(true); - // Simulate authentication and persist a simple user object - setTimeout(() => { - setLoading(false); - const username = email ? email.split("@")[0] : "user"; - try { - localStorage.setItem("avriti_user", JSON.stringify({ name: username, email })); - } catch (e) { - // ignore storage errors - } - // force a full reload so header reads updated localStorage - window.location.href = "/";
Added / After Commit
+ const [password, setPassword] = useState(""); + const [showPassword, setShowPassword] = useState(false); + const [loading, setLoading] = useState(false); + const [error, setError] = useState(""); + + const handleSubmit = async () => { + setError(""); + if (!email.trim()) { setError("Email is required."); return; } + if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) { setError("Enter a valid email address."); return; } + if (!password) { setError("Password is required."); return; } + if (password.length < 8) { setError("Password must be at least 8 characters."); return; } + setLoading(true); + try { + const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/customer/login`, { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ email, password }), + });
Removed / Before Commit
- const [showPassword, setShowPassword] = useState(false); - const [showConfirmPassword, setShowConfirmPassword] = useState(false); - const [loading, setLoading] = useState(false); - const [focused, setFocused] = useState(""); - - const handleSubmit = () => { - setLoading(true); - setTimeout(() => setLoading(false), 2000); - }; - - return ( - <div className="py-10 bg-[#F7F5F2] flex items-center justify-center px-4"> - <div className="w-full max-w-[380px]"> - {/* Logo / Brand */} - <div className="text-center mb-[20px]"> - <h1 className="text-[var(--color-primary-700)] font-serif text-[30px]"> - Create your account - </h1>
Added / After Commit
+ const [showPassword, setShowPassword] = useState(false); + const [showConfirmPassword, setShowConfirmPassword] = useState(false); + const [loading, setLoading] = useState(false); + const [error, setError] = useState(""); + const [fullName, setFullName] = useState(""); + const [phone, setPhone] = useState(""); + const handleSubmit = async () => { + setError(""); + if (!fullName.trim()) { setError("Full name is required."); return; } + + if (!email.trim()) { setError("Email is required."); return; } + if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) { setError("Enter a valid email address."); return; } + if (!password) { setError("Password is required."); return; } + if (password.length < 8) { setError("Password must be at least 8 characters."); return; } + if (!confirmPassword) { setError("Please confirm your password."); return; } + if (password !== confirmPassword) { setError("Passwords do not match."); return; } + if (phone && !/^[0-9]{10}$/.test(phone)) { setError("Enter a valid 10-digit phone number."); return; } + setLoading(true);
Removed / Before Commit
- - useEffect(() => { - try { - const raw = localStorage.getItem("avriti_user"); - if (raw) setUser(JSON.parse(raw)); - } catch (e) { - // ignore - } - }, []); - - useEffect(() => { - - const handleLogout = () => { - try { - localStorage.removeItem("avriti_user"); - } catch (e) {} - setUser(null); - setAcctOpen(false);
Added / After Commit
+ + useEffect(() => { + try { + const raw = localStorage.getItem("avriti_customer") || localStorage.getItem("avriti_user"); + if (raw) setUser(JSON.parse(raw)); + } catch {} + }, []); + + useEffect(() => { + + const handleLogout = () => { + try { + localStorage.removeItem("avriti_customer"); + localStorage.removeItem("avriti_user"); + } catch {} + setUser(null); + setAcctOpen(false); + };