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

Implement user login #861

Draft
wants to merge 34 commits into
base: main
Choose a base branch
from

Conversation

ShouvikGhosh2048
Copy link
Collaborator

Closes #766.

@ShouvikGhosh2048 ShouvikGhosh2048 marked this pull request as ready for review September 4, 2024 04:11
@ShouvikGhosh2048
Copy link
Collaborator Author

ShouvikGhosh2048 commented Sep 4, 2024

@otobot1 you can take a look at the workflow and styling. I'm left with server logging (and maybe converting the foreign key changes to a single transaction). /claim-user for claiming, /verify-claim for verifying the user.

@otobot1
Copy link
Member

otobot1 commented Sep 10, 2024

I should be able to take a look this weekend!

combine user-claim related pages into single folder
make explicit that we don't want people duplicating their ratings
Tweak UserClaim column and relation names
required by next.js pagesRouter
backend only. frontend tweaks forthcoming.
-split userClaim endpoints into a subrouter
-place the user and userClaim router files into a new folder
-tweak userClaim api to make userClaims non-public, as they don't need to be public
-tweak userClaim router for formatting and readability, and make it match existing routers more closely
-wrap the userClaim verification db calls into a transaction
-add check for claimedUser to verification endpoint
@otobot1 otobot1 marked this pull request as draft September 15, 2024 22:18
@otobot1 otobot1 marked this pull request as ready for review September 15, 2024 22:18
@otobot1
Copy link
Member

otobot1 commented Sep 15, 2024

Hey @ShouvikGhosh2048 . I didn't quite manage to get through the entire thing this weekend, but I think it's in a state where you can keep working on it. I'm happy with the tRPC api now (although we still need server logging), but I didn't have a chance to really look at or adjust the frontend to match the backend changes, so I've left the frontend in a broken state (sorry!). I'll get to it when I can, and will mark this as a draft again when I do.

In the meantime, please feel free to work on the remaining pages or any other backend stuff. If you'd like to work on the pages you already created, please mark this PR as a draft and also make both pages work with the backend changes.

@otobot1 otobot1 force-pushed the implement-user-login branch from d628306 to c1b21e9 Compare September 28, 2024 01:27
-i read somewhere that it's better and found it convincing at the time, but i can't recall why. i'll add a comment to this PR (celestemods-com#861) if i ever remember
change all `onUpdate: Restrict` to `onUpdate: Cascade`
@otobot1
Copy link
Member

otobot1 commented Sep 28, 2024

I made some progress on this tonight. I reviewed the new pages and I think I'm happy with how they work. I fixed all of the React errors and adjusted everything for the new API, but I'm still having permission errors that I haven't had a chance to figure out yet. I haven't been able to get either page to actually render on my end yet, so I may end up making some tweaks in the end. I also haven't had a chance to review the nextAuth changes, but I think any changes to that code will be minor.

@ShouvikGhosh2048 I'm done with my first-pass review, so I'm marking this as a draft again. To get this ready for merging, please:

  1. Get both of the new pages working (sorry for breaking them lol).
  2. Address the TODO!!! comments (only the ones with 3 exclamation marks).

I think that should be it, but I'm pretty tired at the moment. I may add another item or two in the next couple of days if I forgot something.

@otobot1 otobot1 marked this pull request as draft September 28, 2024 04:29
@otobot1
Copy link
Member

otobot1 commented Oct 25, 2024

This PR is basically ready to go - there are just a couple of minor tweaks and a handful of follow-up issues to create. Whichever one of us has time first can work on the remaining changes - just communicate so that we aren't duplicating work.

Required Changes:

  1. Move the user settings button.
    a. Remove the old button from the footer and move the remaining footer buttons so that the footer is visually balanced.
    b. Create a new user settings button next to the Login button.
    • The new button should still link to /coming-soon.
    • The button should be a gear icon.
  2. Style the CLAIM YOUR OLD USER link on the home page so that it's clear that it is clickable.
    a. Make the cursor change on hover to indicate that the link is clickable.
  3. Add server logging to all mutations in the UserClaim router.

Follow-Up Issues:

  1. Add server-side logic to the sign-in flow to check the user's accountStatus and return an error for non-active users.
    a. This will be required for v0.2.0.
  2. Remove unused procedures from the User router.
  3. Refactor the CLAIM YOUR OLD USER link on the home page that logged-out users see, and the Login button, to show a destination URL on hover like a normal link.
    a. This is low priority.
    b. If we need to fake this somehow, that's fine.
  4. Use the new satisfies keyword to explicitly link the selectObject constants and associated types in each tRPC router.
    a. See the RelatedUser type and relatedUserSelectObject constant in the UserClaim router.
  5. Determine if NextAuth is requesting the users' emails from Discord for user creation and/or sign-in and then discarding the info, or if we don't request it at all.
    a. High priority.
    b. We will need to include this info in our privacy policy.

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.

Implement User Logins
2 participants