-
Notifications
You must be signed in to change notification settings - Fork 40
feat(login): add back-to-home navigation link #130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -84,6 +84,15 @@ const AuthForm: React.FC<AuthFormProps> = ({ onAuthChange }) => { | |
| <div className="min-h-screen flex items-center justify-center px-4 py-12"> | ||
| <div className="max-w-md w-full"> | ||
| <div className="smoke-card p-8 relative smoke-effect"> | ||
| {/* β Back to Home */} | ||
| <button | ||
| type="button" | ||
| onClick={() => navigate("/")} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π Medium β The navigation to home (navigate("/")) is triggered directly in the onClick handler of a button without any confirmation or state check. If there is unsaved form data, the user may lose it without warning. Consider prompting the user for confirmation if there is unsaved input before navigating away from the form, or ensure form state is reset/handled appropriately on navigation. best-practices There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π‘ Suggestion β The navigation button uses navigate("/") to redirect users to the home page. If the navigate function or route handling is ever changed to accept user input or query parameters, this could introduce an open redirect vulnerability. Currently, the risk is low because the destination is hardcoded, but this pattern should be monitored if refactored. Ensure that all navigation destinations are hardcoded or validated, and never accept user-controlled input for navigation paths without strict allowlisting. security There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π‘ Suggestion β The new 'Back to Home' button uses navigate("/") without checking for unsaved form state or in-progress authentication. This could allow users to accidentally lose form input or interrupt an authentication process. Consider prompting the user for confirmation if there is unsaved input or an authentication process is ongoing (e.g., loading/otpLoading). bugs There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π‘ Suggestion β The onClick handler for the 'Back to Home' button is defined inline as an arrow function in JSX. This creates a new function instance on every render, which can cause unnecessary re-renders of child components if this button is ever memoized or passed as a prop. Define the navigation handler as a useCallback hook or a named function outside the render to avoid unnecessary function recreation on each render. performance |
||
| className="mb-4 inline-flex items-center text-sm text-gray-400 hover:text-alien-green transition-colors duration-300" | ||
| > | ||
| β Back to Home | ||
| </button> | ||
|
|
||
| <div className="text-center mb-8"> | ||
| <div className="w-16 h-16 bg-alien-green rounded-full flex items-center justify-center mx-auto mb-4 shadow-alien-glow"> | ||
| {isLogin ? ( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π‘ Suggestion β The new 'Back to Home' button introduces a navigation action, but there is no inline comment explaining its purpose or why it is conditionally rendered here. While the button is simple, a brief comment would help future maintainers understand its intent, especially since the rest of the form is complex and stateful.
Add an inline comment above the button to clarify its purpose, e.g., '// Navigates user back to the home page from the login/signup form'.
documentation