Skip to content

feat(web): collect name during signup#958

Merged
AchoArnold merged 6 commits into
mainfrom
feat/signup-name
Jul 23, 2026
Merged

feat(web): collect name during signup#958
AchoArnold merged 6 commits into
mainfrom
feat/signup-name

Conversation

@AchoArnold

Copy link
Copy Markdown
Member

Summary

  • add a required Name field to email/password signup
  • persist the trimmed name to the Firebase user profile
  • clear stale form errors when switching auth modes
  • roll back account creation if profile setup fails

Validation

  • pnpm test
  • targeted ESLint, Prettier, and Stylelint checks
  • pnpm generate

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: cb465cbe-a93c-4c89-96f5-591e8f0908e3
@codacy-production

codacy-production Bot commented Jul 23, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 duplication

Metric Results
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@greptile-apps

greptile-apps Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a required Name field to the email/password signup flow in FirebaseAuth.vue, persisting the trimmed value to the Firebase user profile via updateProfile, and rolls back the newly created account with deleteUser if the profile update fails. It also introduces toggleAuthMode to clear stale form errors when switching between sign-in and sign-up.

  • A name field is collected at signup and written to displayName via updateProfile; if that call fails, deleteUser is called to clean up the orphaned account.
  • toggleAuthMode replaces the inline toggle so that clearErrors() is called on every mode switch.
  • The rollback logic has a gap: if deleteUser itself throws, the original updateProfile error is silently replaced by the deletion error and the orphaned account is left in Firebase.

Confidence Score: 3/5

The signup happy path works correctly, but the rollback block can leave orphaned accounts and surface a misleading error to the user.

When updateProfile fails, the code attempts to delete the newly created account. If that deletion also fails, the deleteUser exception replaces the original error in the outer catch, so the user sees a confusing message and the account remains in Firebase without a display name. On a subsequent retry with the same email, auth/email-already-in-use fires and the user cannot create a fresh account.

web/app/components/FirebaseAuth.vue — specifically the submitEmail rollback block around deleteUser.

Important Files Changed

Filename Overview
web/app/components/FirebaseAuth.vue Adds name collection during email signup, profile update via updateProfile, and account rollback via deleteUser on failure. The rollback logic has a flaw: if deleteUser itself throws, the original error is replaced and the orphaned Firebase account is not cleaned up.

Sequence Diagram

sequenceDiagram
    participant User
    participant Vue as FirebaseAuth.vue
    participant FB as Firebase Auth

    User->>Vue: Submit signup form (name/email/password)
    Vue->>Vue: validateLoginForm()
    alt validation fails
        Vue-->>User: Show field errors
    else validation passes
        Vue->>FB: createUserWithEmailAndPassword()
        FB-->>Vue: result.user
        Vue->>FB: updateProfile(result.user, displayName)
        alt updateProfile succeeds
            FB-->>Vue: ok
            Vue->>Vue: onSuccess(user, email)
            Vue-->>User: Redirect to target route
        else updateProfile fails
            FB-->>Vue: error A
            Vue->>FB: deleteUser(result.user)
            alt deleteUser succeeds
                FB-->>Vue: ok
                Vue->>Vue: handleError(error A)
                Vue-->>User: Show original error
            else deleteUser also fails
                FB-->>Vue: error B
                Vue->>Vue: handleError(error B)
                Vue-->>User: Wrong error shown, orphaned account remains
            end
        end
    end
Loading

Reviews (1): Last reviewed commit: "feat(web): collect name during signup" | Re-trigger Greptile

Comment thread web/app/components/FirebaseAuth.vue
Comment thread web/app/components/FirebaseAuth.vue Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the web auth flow to collect a user’s name during email/password sign-up and persist it to the Firebase profile, while also improving UX around auth-mode switching and attempting to roll back account creation if profile setup fails.

Changes:

  • Add a required Name field for email/password Sign Up and write it to user.displayName via updateProfile.
  • Clear stale form errors when toggling between Sign In and Sign Up.
  • Remove redirectPreferenceStore usage from MessageThreadHeader logout flow.

Reviewed changes

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

File Description
web/app/components/MessageThreadHeader.vue Removes redirect preference store usage and its logout reset.
web/app/components/FirebaseAuth.vue Adds name capture/validation on sign-up, updates Firebase profile, adds rollback attempt, and clears errors when switching auth modes.
Comments suppressed due to low confidence (1)

web/app/components/MessageThreadHeader.vue:74

  • Logout should clear the redirect-to-threads preference (localStorage-backed) to avoid carrying that preference into the next login session on the same browser.
  authStore.resetState()
  phonesStore.resetState()
  threadsStore.resetState()
  notificationsStore.addNotification({

Comment thread web/app/components/MessageThreadHeader.vue
Comment thread web/app/components/FirebaseAuth.vue
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: cb465cbe-a93c-4c89-96f5-591e8f0908e3
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: cb465cbe-a93c-4c89-96f5-591e8f0908e3

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (2)

web/app/components/FirebaseAuth.vue:144

  • Rollback after a failed updateProfile is only best-effort: if deleteUser fails, the code logs and then rethrows the original profile error, which can leave an orphaned account (contradicting the stated rollback behavior). Consider surfacing rollback failure explicitly (e.g., throw an error that indicates rollback failed, with the delete error as the cause).
      } catch (error) {
        try {
          await deleteUser(result.user)
        } catch (deleteError) {
          console.error(deleteError)

web/app/components/FirebaseAuth.vue:452

  • Placeholder text should use correct punctuation/grammar for “e.g.” (typically “e.g.,” in running text) to avoid a visible typo in the UI.
        placeholder="Enter your email address e.g john@gmail.com"

Comment thread web/app/components/FirebaseAuth.vue Outdated
density="comfortable"
class="mb-2"
persistent-placeholder
placeholder="Enter your full name e.g. John Doe"
@AchoArnold
AchoArnold merged commit 5dab6f8 into main Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants