Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ NEXT_PUBLIC_SITE_URL=http://localhost:3000

#APPWRITE
NEXT_PUBLIC_APPWRITE_ENDPOINT=https://cloud.appwrite.io/v1
NEXT_PUBLIC_APPWRITE_PROJECT=662cd3d0000d7d095714
APPWRITE_DATABASE_ID=662cd599000b133bfcd3

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello

APPWRITE_USER_COLLECTION_ID=662cd5bb002792396b02
APPWRITE_BANK_COLLECTION_ID=662cd610000e0e283eb4
APPWRITE_TRANSACTION_COLLECTION_ID=662cd5fb000ceb06e8a6
NEXT_APPWRITE_KEY=c78d74bfcb9364a868b588056cdb00bd7328ad2629f9d97682a877f8662776289426ab7a5dcc1ca6cb4c6946b5a341ca73cd09f18dd0c01a11454aa75cf85a3cc4b0cc5f5cbc8872368aab3d24a13ff35ca45fac080bf0d8f575d84dec72ad0446b13752978c44d379ca85bdb690b7aa0523b44d9058a6da51c474ba54aef2d7
NEXT_PUBLIC_APPWRITE_PROJECT=682ff311003bf6d4cdfc
APPWRITE_DATABASE_ID=682ff352001a95f2126c
APPWRITE_USER_COLLECTION_ID=68300f260032a585c91b
APPWRITE_BANK_COLLECTION_ID=68300f9f0001d878cde3
APPWRITE_TRANSACTION_COLLECTION_ID=682ff3d1001f7fc0be59
NEXT_APPWRITE_KEY=standard_654ea0773601948c1f65be78cd3cc97f34309ae701e533cef6b89450b648ee4b4536c06fc4acc904e87256db46660afac2fdc759f555d12d803e83cd8590cea7c2cfda5b0b9786c5983f7e9e03c5899d84ff52dc6e17bcc3f01484cb8e2407debe8945b9fe702afe40344c66b2ea1938defcc52a4651bce6d77fb6e38809e674

#PLAID
PLAID_CLIENT_ID=662e1e5fdca064001c3e0086
PLAID_SECRET=be405988983be57fe34bef8e9038b3
PLAID_CLIENT_ID=683351e645aadd0023b5cec4
PLAID_SECRET=93f87ee12cbbbaf3c7f08a206913b5
PLAID_ENV=sandbox
PLAID_PRODUCTS=auth,transactions,identity
PLAID_COUNTRY_CODES=US,CA

#DWOLLA
DWOLLA_KEY=qAN5xkFYOSQeUNpN7GSPcGPHH8nSpVrPKSL8Ye5mSSP5AzddNt
DWOLLA_SECRET=FI50i6NbUQ90106Bt1n9bH6aCNWhcs8Rliy7VRqrXgNbKtLy00
DWOLLA_KEY=bmAjEwHJYNTpW1HiHXPXsfQKeEyiRhvIIvZFmvHMLT6iZCcASY
DWOLLA_SECRET=2SlZNMBI0t9PkpbukqRHNF7wWoMdcdSRPW3cIEcT5Z4LXFJrDs

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello

DWOLLA_BASE_URL=https://api-sandbox.dwolla.com
Comment on lines 4 to 23
Copy link

@coderabbitai coderabbitai bot Jul 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Hard-coded credentials committed – immediate security leak

Real Appwrite, Plaid and Dwolla secrets are now in the repo.
Even though .env was added to .gitignore, committing it once exposes the keys permanently (git history & any fork/clone). Rotate every key that appears here and delete the file from the repo history (git filter-repo / BFG) before merging.

Replace the committed file with a public template and keep real secrets only in local/CI vaults:

-#APPWRITE
-NEXT_PUBLIC_APPWRITE_ENDPOINT=https://cloud.appwrite.io/v1
-NEXT_PUBLIC_APPWRITE_PROJECT=682ff311003bf6d4cdfc
-APPWRITE_DATABASE_ID=682ff352001a95f2126c
-APPWRITE_USER_COLLECTION_ID=68300f260032a585c91b
-APPWRITE_BANK_COLLECTION_ID=68300f9f0001d878cde3
-APPWRITE_TRANSACTION_COLLECTION_ID=682ff3d1001f7fc0be59
-NEXT_APPWRITE_KEY=standard_654ea0773601948c1f65be78cd3cc97f34309ae701e533cef6b89450b648ee4b4536c06fc4acc904e87256db46660afac2fdc759f555d12d803e83cd8590cea7c2cfda5b0b9786c5983f7e9e03c5899d84ff52dc6e17bcc3f01484cb8e2407debe8945b9fe702afe40344c66b2ea1938defcc52a4651bce6d77fb6e38809e674
-
-#PLAID
-PLAID_CLIENT_ID=683351e645aadd0023b5cec4
-PLAID_SECRET=93f87ee12cbbbaf3c7f08a206913b5
-
-#DWOLLA
-DWOLLA_KEY=bmAjEwHJYNTpW1HiHXPXsfQKeEyiRhvIIvZFmvHMLT6iZCcASY
-DWOLLA_SECRET=2SlZNMBI0t9PkpbukqRHNF7wWoMdcdSRPW3cIEcT5Z4LXFJrDs
+### EXAMPLE ONLY – DO NOT COMMIT REAL SECRETS ###
+#APPWRITE
+NEXT_PUBLIC_APPWRITE_ENDPOINT=https://cloud.appwrite.io/v1
+NEXT_PUBLIC_APPWRITE_PROJECT=<project_id>
+APPWRITE_DATABASE_ID=<db_id>
+APPWRITE_USER_COLLECTION_ID=<collection_id>
+APPWRITE_BANK_COLLECTION_ID=<collection_id>
+APPWRITE_TRANSACTION_COLLECTION_ID=<collection_id>
+NEXT_APPWRITE_KEY=<server_key>
+
+#PLAID
+PLAID_CLIENT_ID=<client_id>
+PLAID_SECRET=<secret>
+
+#DWOLLA
+DWOLLA_KEY=<key>
+DWOLLA_SECRET=<secret>

Action items:

  1. Revoke & regenerate all exposed keys immediately.
  2. Purge the file from git history.
  3. Commit a *.env.example (placeholders) only.
  4. Rely on vault/CI secrets injection for deployments.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#APPWRITE
NEXT_PUBLIC_APPWRITE_ENDPOINT=https://cloud.appwrite.io/v1
NEXT_PUBLIC_APPWRITE_PROJECT=662cd3d0000d7d095714
APPWRITE_DATABASE_ID=662cd599000b133bfcd3
APPWRITE_USER_COLLECTION_ID=662cd5bb002792396b02
APPWRITE_BANK_COLLECTION_ID=662cd610000e0e283eb4
APPWRITE_TRANSACTION_COLLECTION_ID=662cd5fb000ceb06e8a6
NEXT_APPWRITE_KEY=c78d74bfcb9364a868b588056cdb00bd7328ad2629f9d97682a877f8662776289426ab7a5dcc1ca6cb4c6946b5a341ca73cd09f18dd0c01a11454aa75cf85a3cc4b0cc5f5cbc8872368aab3d24a13ff35ca45fac080bf0d8f575d84dec72ad0446b13752978c44d379ca85bdb690b7aa0523b44d9058a6da51c474ba54aef2d7
NEXT_PUBLIC_APPWRITE_PROJECT=682ff311003bf6d4cdfc
APPWRITE_DATABASE_ID=682ff352001a95f2126c
APPWRITE_USER_COLLECTION_ID=68300f260032a585c91b
APPWRITE_BANK_COLLECTION_ID=68300f9f0001d878cde3
APPWRITE_TRANSACTION_COLLECTION_ID=682ff3d1001f7fc0be59
NEXT_APPWRITE_KEY=standard_654ea0773601948c1f65be78cd3cc97f34309ae701e533cef6b89450b648ee4b4536c06fc4acc904e87256db46660afac2fdc759f555d12d803e83cd8590cea7c2cfda5b0b9786c5983f7e9e03c5899d84ff52dc6e17bcc3f01484cb8e2407debe8945b9fe702afe40344c66b2ea1938defcc52a4651bce6d77fb6e38809e674
#PLAID
PLAID_CLIENT_ID=662e1e5fdca064001c3e0086
PLAID_SECRET=be405988983be57fe34bef8e9038b3
PLAID_CLIENT_ID=683351e645aadd0023b5cec4
PLAID_SECRET=93f87ee12cbbbaf3c7f08a206913b5
PLAID_ENV=sandbox
PLAID_PRODUCTS=auth,transactions,identity
PLAID_COUNTRY_CODES=US,CA
#DWOLLA
DWOLLA_KEY=qAN5xkFYOSQeUNpN7GSPcGPHH8nSpVrPKSL8Ye5mSSP5AzddNt
DWOLLA_SECRET=FI50i6NbUQ90106Bt1n9bH6aCNWhcs8Rliy7VRqrXgNbKtLy00
DWOLLA_KEY=bmAjEwHJYNTpW1HiHXPXsfQKeEyiRhvIIvZFmvHMLT6iZCcASY
DWOLLA_SECRET=2SlZNMBI0t9PkpbukqRHNF7wWoMdcdSRPW3cIEcT5Z4LXFJrDs
DWOLLA_BASE_URL=https://api-sandbox.dwolla.com
### EXAMPLE ONLY – DO NOT COMMIT REAL SECRETS ###
#APPWRITE
NEXT_PUBLIC_APPWRITE_ENDPOINT=https://cloud.appwrite.io/v1
NEXT_PUBLIC_APPWRITE_PROJECT=<project_id>
APPWRITE_DATABASE_ID=<db_id>
APPWRITE_USER_COLLECTION_ID=<collection_id>
APPWRITE_BANK_COLLECTION_ID=<collection_id>
APPWRITE_TRANSACTION_COLLECTION_ID=<collection_id>
NEXT_APPWRITE_KEY=<server_key>
#PLAID
PLAID_CLIENT_ID=<client_id>
PLAID_SECRET=<secret>
PLAID_ENV=sandbox
PLAID_PRODUCTS=auth,transactions,identity
PLAID_COUNTRY_CODES=US,CA
#DWOLLA
DWOLLA_KEY=<key>
DWOLLA_SECRET=<secret>
DWOLLA_BASE_URL=https://api-sandbox.dwolla.com
🤖 Prompt for AI Agents
In the .env file from lines 4 to 23, real sensitive credentials for Appwrite,
Plaid, and Dwolla are hard-coded and committed, causing a security leak.
Immediately revoke and regenerate all exposed keys, then remove the .env file
from the git history using tools like git filter-repo or BFG. Replace the
committed .env with a .env.example file containing placeholder values only, and
ensure real secrets are managed securely via local environment variables or
CI/CD vaults without committing them to the repository.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8816891687

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sujitgabbar220-debug I see you've provided the number "8816891687" but I'm not sure what this refers to. Could you clarify what this number represents? Is it:

  • A phone number for contact regarding the security issue?
  • An incident/ticket ID?
  • Some other reference number?

Meanwhile, I want to emphasize that the security issue with the exposed credentials in the .env file is critical and needs immediate attention. The API keys for Appwrite, Plaid, and Dwolla that are currently committed to the repository should be:

  1. Revoked immediately from their respective service dashboards
  2. Regenerated with new credentials
  3. Removed from git history using tools like git filter-repo
  4. Replaced with a template file containing placeholder values

Please let me know what the number refers to so I can assist you appropriately with both that matter and the security remediation.

DWOLLA_ENV=sandbox
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ yarn-error.log*

# local env files
.env*.local
.env

# vercel
.vercel
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ If you prefer visual learning, this is the perfect resource for you. Follow our

## <a name="introduction">🤖 Introduction</a>

Built with Next.js, Horizon is a financial SaaS platform that connects to multiple bank accounts, displays transactions in real-time, allows users to transfer money to other platform users, and manages their finances altogether.
Built with Next.js, Fundilar is a financial SaaS platform that connects to multiple bank accounts, displays transactions in real-time, allows users to transfer money to other platform users, and manages their finances altogether.

If you're getting started and need assistance or face any bugs, join our active Discord community with over **34k+** members. It's a place where people help each other out.

Expand Down
2 changes: 1 addition & 1 deletion app/(auth)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default function RootLayout({
<div className="auth-asset">
<div>
<Image
src="/icons/auth-image.svg"
src="/icons/100x80 v.png"
alt="Auth image"
width={500}
height={500}
Expand Down
2 changes: 1 addition & 1 deletion app/(root)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default async function RootLayout({

<div className="flex size-full flex-col">
<div className="root-layout">
<Image src="/icons/logo.svg" width={30} height={30} alt="logo" />
<Image src="/icons/logo.png" width={30} height={30} alt="logo" />
<div>
Comment on lines +22 to 23
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Alt text & asset check

alt="logo" is too generic and hurts a11y. Consider renaming to something descriptive such as alt="Fundilla logo".

Also verify the PNG actually exists under public/icons/logo.png; otherwise Next 13 build will fail.


🏁 Script executed:

#!/bin/bash
# Assert the file exists in the repo
fd -t f logo.png | head -n 5

Length of output: 52


Improve image alt text for accessibility

  • ✅ Asset verified: public/icons/logo.png exists.
  • 📝 Update the alt attribute to be more descriptive.

In app/(root)/layout.tsx around lines 22–23, change:

- <Image src="/icons/logo.png" width={30} height={30} alt="logo" />
+ <Image src="/icons/logo.png" width={30} height={30} alt="Fundilla logo" />
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<Image src="/icons/logo.png" width={30} height={30} alt="logo" />
<div>
<Image src="/icons/logo.png" width={30} height={30} alt="Fundilla logo" />
<div>
🤖 Prompt for AI Agents
In app/(root)/layout.tsx around lines 22 to 23, update the alt attribute of the
Image component from a generic "logo" to a more descriptive text that clearly
identifies the image, such as "Company logo" or a specific brand name, to
improve accessibility for screen readers.

<MobileNav user={loggedIn} />
</div>
Expand Down
6 changes: 3 additions & 3 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ const ibmPlexSerif = IBM_Plex_Serif({
})

export const metadata: Metadata = {
title: "Horizon",
description: "Horizon is a modern banking platform for everyone.",
title: "Fundilla",
description: "Fundilla is a modern banking platform for everyone.",
icons: {
icon: '/icons/logo.svg'
icon: '/icons/logo.png'
}
};

Expand Down
97 changes: 60 additions & 37 deletions components/AuthForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,58 +41,81 @@ const AuthForm = ({ type }: { type: string }) => {
},
})

// 2. Define a submit handler.
const onSubmit = async (data: z.infer<typeof formSchema>) => {
setIsLoading(true);


// Updated onSubmit function for AuthForm.tsx
const onSubmit = async (data: z.infer<typeof formSchema>) => {
setIsLoading(true);

try {
if(type === 'sign-up') {
const userData = {
firstName: data.firstName!,
lastName: data.lastName!,
address1: data.address1!,
city: data.city!,
state: data.state!,
postalCode: data.postalCode!,
dateOfBirth: data.dateOfBirth!,
ssn: data.ssn!,
email: data.email,
password: data.password
}

try {
// Sign up with Appwrite & create plaid token
const newUser = await signUp(userData);

if(type === 'sign-up') {
const userData = {
firstName: data.firstName!,
lastName: data.lastName!,
address1: data.address1!,
city: data.city!,
state: data.state!,
postalCode: data.postalCode!,
dateOfBirth: data.dateOfBirth!,
ssn: data.ssn!,
email: data.email,
password: data.password
}

const newUser = await signUp(userData);

if (newUser) {
setUser(newUser);
} else {
throw new Error('Failed to create user');
}
} catch (signUpError) {
console.error('Sign up failed:', signUpError);
// Show error message to user
alert('Sign up failed. Please try again.');
return;
}
}

if(type === 'sign-in') {
const response = await signIn({
email: data.email,
password: data.password,
})

if(response) router.push('/')
if(type === 'sign-in') {
try {
const response = await signIn({
email: data.email,
password: data.password,
});

if(response) {
router.push('/');
} else {
throw new Error('Sign in failed');
}
} catch (error) {
console.log(error);
} finally {
setIsLoading(false);
} catch (signInError) {
console.error('Sign in failed:', signInError);
// Show error message to user
alert('Sign in failed. Please check your credentials.');
return;
}
}
} catch (error) {
console.error('Authentication error:', error);
alert('An error occurred. Please try again.');
} finally {
setIsLoading(false);
}
}
Comment on lines +47 to +106
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Replace alert() with proper UI notifications

The error handling structure is much improved, but using alert() for error messages provides poor UX. Consider using a toast notification library or custom error components for better user experience.

-        alert('Sign up failed. Please try again.');
+        // Use a toast notification or error state
+        toast.error('Sign up failed. Please try again.');
-        alert('Sign in failed. Please check your credentials.');
+        // Use a toast notification or error state
+        toast.error('Sign in failed. Please check your credentials.');

Additionally, the outer catch block (lines 100-103) appears redundant since all error paths are already handled in the nested try-catch blocks. Consider removing it to simplify the code structure.

🤖 Prompt for AI Agents
In components/AuthForm.tsx from lines 47 to 106, replace all alert() calls used
for error messages with a proper UI notification system such as a toast
notification library or custom error components to improve user experience.
Also, remove the outer catch block around lines 100-103 since all errors are
already handled in the nested try-catch blocks, simplifying the code structure.


return (
<section className="auth-form">
<header className='flex flex-col gap-5 md:gap-8'>
<Link href="/" className="cursor-pointer flex items-center gap-1">
<Image
src="/icons/logo.svg"
width={34}
height={34}
alt="Horizon logo"
src="/icons/logo-light.png"
width={140}
height={90}
alt="Fundilla"
/>
<h1 className="text-26 font-ibm-plex-serif font-bold text-black-1">Horizon</h1>
{/* <h1 className="text-26 font-ibm-plex-serif font-bold text-black-1">Fundillar</h1> */}
</Link>
Comment on lines +113 to 119
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Multiple issues with the header block

  1. Brand spelling again differs (“Fundilla” in alt, commented “Fundillar”).
  2. Dead commented code clutters the component.
  3. 140 × 90 logo might blow up the layout on mobile; all other places keep the logo ~34 px.

Consider:

-            <Image 
-              src="/icons/logo-light.png"
-              width={140}
-              height={90}
-              alt="Fundilla"
-            />
-            {/* <h1 className="text-26 font-ibm-plex-serif font-bold text-black-1">Fundillar</h1> */}
+            <Image 
+              src="/icons/logo-light.png"
+              width={34}
+              height={34}
+              alt="Fundilla logo"
+            />
+            <h1 className="text-26 font-ibm-plex-serif font-bold text-black-1">Fundilla</h1>
🤖 Prompt for AI Agents
In components/AuthForm.tsx around lines 90 to 96, the header block has
inconsistent brand spelling between the alt text ("Fundilla") and the
commented-out heading ("Fundillar"), contains dead commented code, and uses a
large 140x90 logo size that may disrupt mobile layout. Fix this by unifying the
brand spelling consistently across alt text and any visible text, removing the
commented-out heading entirely to clean up the code, and resizing the logo to
approximately 34 pixels in height to match other instances and maintain
responsive design.


<div className="flex flex-col gap-1 md:gap-3">
Expand Down Expand Up @@ -171,6 +194,6 @@ const AuthForm = ({ type }: { type: string }) => {
)}
</section>
)
}
}

export default AuthForm
2 changes: 1 addition & 1 deletion components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const Footer = ({ user, type = 'desktop' }: FooterProps) => {
</div>

<div className="footer_image" onClick={handleLogOut}>
<Image src="icons/logout.svg" fill alt="jsm" />
<Image src="icons/logout.svg" fill alt="fundilla" />
</div>
</footer>
)
Expand Down
4 changes: 2 additions & 2 deletions components/MobileNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ const MobileNav = ({ user }: MobileNavProps) => {
<SheetContent side="left" className="border-none bg-white">
<Link href="/" className="cursor-pointer flex items-center gap-1 px-4">
<Image
src="/icons/logo.svg"
src="/icons/logo.png"
width={34}
height={34}
alt="Horizon logo"
alt="Fundilla"
/>
<h1 className="text-26 font-ibm-plex-serif font-bold text-black-1">Horizon</h1>
</Link>
Comment on lines +37 to 43
Copy link

@coderabbitai coderabbitai bot Jul 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Brand label still shows “Horizon”, breaking the new branding

The <h1> still hard-codes “Horizon” while the logo/alt text switched to “Fundilla”. That will confuse users and quickly looks like an oversight.

-            <h1 className="text-26 font-ibm-plex-serif font-bold text-black-1">Horizon</h1>
+            <h1 className="text-26 font-ibm-plex-serif font-bold text-black-1">Fundilla</h1>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
src="/icons/logo.png"
width={34}
height={34}
alt="Horizon logo"
alt="Fundilla"
/>
<h1 className="text-26 font-ibm-plex-serif font-bold text-black-1">Horizon</h1>
</Link>
src="/icons/logo.png"
width={34}
height={34}
alt="Fundilla"
/>
<h1 className="text-26 font-ibm-plex-serif font-bold text-black-1">Fundilla</h1>
</Link>
🤖 Prompt for AI Agents
In components/MobileNav.tsx around lines 37 to 43, the <h1> element still
hardcodes the text "Horizon" which conflicts with the updated branding to
"Fundilla". Update the <h1> text content to "Fundilla" to match the logo alt
text and maintain consistent branding.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hlo

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sujitgabbar220-debug Hello! 👋

Is there anything specific you'd like me to help you with regarding this pull request or the branding consistency issue I flagged in the MobileNav component?

Expand Down
6 changes: 3 additions & 3 deletions components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ const Sidebar = ({ user }: SiderbarProps) => {
<nav className="flex flex-col gap-4">
<Link href="/" className="mb-12 cursor-pointer flex items-center gap-2">
<Image
src="/icons/logo.svg"
src="/icons/logo.png"
width={34}
height={34}
alt="Horizon logo"
alt="Fundilla logo"
className="size-[24px] max-xl:size-14"
/>
<h1 className="sidebar-logo">Horizon</h1>
<h1 className="sidebar-logo">Fundilar</h1>
</Link>
Comment on lines +19 to 26
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Inconsistent brand spellings (“Fundilla” vs “Fundilar”)

The image alt says “Fundilla logo” but the heading says “Fundilar”. Decide on a single canonical brand name and use it everywhere to avoid user-visible typos.

🤖 Prompt for AI Agents
In components/Sidebar.tsx around lines 19 to 26, the brand name is
inconsistently spelled as "Fundilla" in the image alt text and "Fundilar" in the
heading. Choose the correct brand name and update both the alt attribute of the
image and the text inside the h1 element to use the same spelling consistently.


{sidebarLinks.map((item) => {
Expand Down
84 changes: 53 additions & 31 deletions lib/actions/user.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export const signIn = async ({ email, password }: signInProps) => {
}
}


export const signUp = async ({ password, ...userData }: SignUpParams) => {
const { email, firstName, lastName } = userData;

Expand All @@ -60,48 +61,69 @@ export const signUp = async ({ password, ...userData }: SignUpParams) => {
try {
const { account, database } = await createAdminClient();

// Step 1: Create user account
newUserAccount = await account.create(
ID.unique(),
email,
password,
`${firstName} ${lastName}`
);

if(!newUserAccount) throw new Error('Error creating user')

const dwollaCustomerUrl = await createDwollaCustomer({
...userData,
type: 'personal'
})

if(!dwollaCustomerUrl) throw new Error('Error creating Dwolla customer')
if(!newUserAccount) throw new Error('Error creating user account');

const dwollaCustomerId = extractCustomerIdFromUrl(dwollaCustomerUrl);

const newUser = await database.createDocument(
DATABASE_ID!,
USER_COLLECTION_ID!,
ID.unique(),
{
try {
// Step 2: Create Dwolla customer
const dwollaCustomerUrl = await createDwollaCustomer({
...userData,
userId: newUserAccount.$id,
dwollaCustomerId,
dwollaCustomerUrl
type: 'personal'
});

if(!dwollaCustomerUrl) throw new Error('Error creating Dwolla customer');

const dwollaCustomerId = extractCustomerIdFromUrl(dwollaCustomerUrl);

// Step 3: Create user document in database
const newUser = await database.createDocument(
DATABASE_ID!,
USER_COLLECTION_ID!,
ID.unique(),
{
...userData,
userId: newUserAccount.$id,
dwollaCustomerId,
dwollaCustomerUrl
}
);

// Step 4: Create session
const session = await account.createEmailPasswordSession(email, password);

cookies().set("appwrite-session", session.secret, {
path: "/",
httpOnly: true,
sameSite: "strict",
secure: true,
});

return parseStringify(newUser);

} catch (error) {
// If Dwolla or database creation fails, clean up the auth account
console.error('Error in signup process:', error);

// Clean up: Delete the created auth account
try {
await account.deleteIdentity(newUserAccount.$id);
} catch (cleanupError) {
console.error('Error cleaning up auth account:', cleanupError);
}
)

const session = await account.createEmailPasswordSession(email, password);

cookies().set("appwrite-session", session.secret, {
path: "/",
httpOnly: true,
sameSite: "strict",
secure: true,
});

throw error;
}

return parseStringify(newUser);
} catch (error) {
console.error('Error', error);
console.error('Error in signUp:', error);
throw error; // Re-throw to be handled by the calling function
}
}

Expand Down Expand Up @@ -138,7 +160,7 @@ export const createLinkToken = async (user: User) => {
client_user_id: user.$id
},
client_name: `${user.firstName} ${user.lastName}`,
products: ['auth'] as Products[],
products: ['auth', 'transactions'] as Products[],
language: 'en',
country_codes: ['US'] as CountryCode[],
}
Expand Down
Loading