Skip to content
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

feat: create profile on signup and signin #48

Merged
merged 1 commit into from
Dec 22, 2024

Conversation

JacobLinCool
Copy link
Member

This pull request includes several changes to the authentication and profile management functionality. The main updates involve importing additional modules, verifying user tokens, creating default profiles, and validating profile data using a schema.

Authentication and Profile Management Updates:

  • src/routes/api/auth/signin/+server.ts: Added imports for adminDb and FieldValue from firebase-admin/firestore. Implemented logic to verify user tokens and create default profiles if they do not exist. Updated error message for sign-in failures. [1] [2]

  • src/routes/profile/+page.server.ts: Added import for ProfileSchema and FieldValue from firebase-admin/firestore. Implemented schema validation for profile data and updated the profile creation logic to use the validated data. [1] [2] [3]

@JacobLinCool JacobLinCool self-assigned this Dec 22, 2024
@Copilot Copilot bot review requested due to automatic review settings December 22, 2024 17:49

Choose a reason for hiding this comment

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

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

Comments suppressed due to low confidence (2)

src/routes/api/auth/signin/+server.ts:45

  • [nitpick] The error message 'Unauthorized request' is unclear. Consider providing a more descriptive message, such as 'Invalid credentials or user does not exist'.
console.error('Error during sign in:', error);

src/routes/profile/+page.server.ts:39

  • [nitpick] The error message "{ missing: true }" is unclear. It should provide more context, such as "Profile validation failed" or similar.
if (!profile.success) { return fail(400, { missing: true }); }
@JacobLinCool JacobLinCool merged commit 329cb67 into main Dec 22, 2024
1 check passed
@JacobLinCool JacobLinCool deleted the create-profile-on-signup branch December 22, 2024 17:52
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