Skip to content

[Bug]: PalsHub email sign-up/sign-in no longer claims success on failure#757

Merged
a-ghorbani merged 1 commit into
mainfrom
feature/TASK-20260601-1318
Jun 1, 2026
Merged

[Bug]: PalsHub email sign-up/sign-in no longer claims success on failure#757
a-ghorbani merged 1 commit into
mainfrom
feature/TASK-20260601-1318

Conversation

@a-ghorbani

Copy link
Copy Markdown
Owner

Problem

On the PalsHub Create Account / Sign In sheet, a failed email auth still showed a success alert. Entering a too-short password surfaced all three at once: the inline "Password should be at least 6 characters" banner, a toast error, and a false "Account Created — please check your email" alert. The account was never created.

Cause

AuthService.signUpWithEmail / signInWithEmail / resetPassword swallowed the Supabase error into this.error and returned void — they never threw or signalled failure. AuthSheet then fired its success alert unconditionally after the await (its catch only catches thrown errors, and these methods never throw).

Fix

  • The three email-auth methods now return a Promise<boolean> (true on success, false on error).
  • AuthSheet only shows the "Account Created" / "Welcome Back!" / "Password Reset" alert when the call actually succeeds. On failure the existing inline error banner remains the single error surface, and the sheet stays open so the user can correct the input.

Tests

  • Added false-case coverage: failed sign-in shows no "Welcome Back!", failed sign-up shows no "Account Created".
  • Updated the centralized auth mock to reflect the new boolean contract.
  • Full Jest suite green (3160 passed); no native changes.

Generated by PocketPal Dev Team

@a-ghorbani a-ghorbani added the bug Something isn't working label Jun 1, 2026
@a-ghorbani a-ghorbani requested a review from Copilot June 1, 2026 14:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes misleading success alerts in the PalsHub email auth sheet by making email auth APIs explicitly report success/failure and only showing success alerts when the underlying call succeeds.

Changes:

  • Update AuthService email auth methods (signInWithEmail, signUpWithEmail, resetPassword) to return Promise<boolean> indicating success.
  • Gate AuthSheet success alerts behind the returned boolean so failures only surface via the existing inline error banner.
  • Add Jest coverage for failure cases and update the centralized auth service mock to match the new boolean contract.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/services/palshub/AuthService.ts Email auth methods now return true/false instead of swallowing errors and returning void.
src/components/PalsHub/AuthSheet/AuthSheet.tsx Only shows “Account Created” / “Welcome Back!” / “Password Reset” alerts when the service reports success.
src/components/PalsHub/AuthSheet/__tests__/AuthSheet.test.tsx Adds tests ensuring success alerts are not shown when mocked email auth fails.
__mocks__/services/palshub/AuthService.js Updates mocked email auth methods to resolve true by default (new contract).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@a-ghorbani a-ghorbani merged commit c64ad2b into main Jun 1, 2026
5 checks passed
@a-ghorbani a-ghorbani deleted the feature/TASK-20260601-1318 branch June 1, 2026 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants