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

Allow multiple project invites for one user #1043

Merged
merged 20 commits into from
Sep 27, 2024

Commits on Sep 27, 2024

  1. Allow users to accept multiple invitations

    Now that we use invitation links for both projects and orgs, it will
    start to become rather common for someone to receive an org invitation
    and a project invitation within the same few minutes. So we need to
    allow users to click on invitation links even if they already have a
    Lexbox account.
    rmunn committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    c6defcc View commit details
    Browse the repository at this point in the history
  2. Add check to prevent request forgery

    Without this check, it would be possible for someone who manages to
    intercept someone else's email (by social engineering or other means) to
    forge a project invitation request, reusing the still-valid JWT from the
    genuine user.
    rmunn committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    e330e2b View commit details
    Browse the repository at this point in the history
  3. Forbid changing email when accepting invite

    No backend checks yet, this is just frontend for now.
    rmunn committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    2c4a369 View commit details
    Browse the repository at this point in the history
  4. Better phrasing of one comment

    rmunn committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    2f50e02 View commit details
    Browse the repository at this point in the history
  5. Attempt to add GQL query for looking up user

    This fails: despite the AllowAnonymous, the GraphQL query is being
    rejected because the RegisterAccount audience is not allowed to use GQL
    queries. I'll need to find some other way to do this.
    rmunn committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    367ef4e View commit details
    Browse the repository at this point in the history
  6. Don't use GQL queries, use alternate page

    Instead of GQL queries to check if the user already exists, we put the
    logic into LoginController. This works: users can now receive multiple
    invitation links, and only see the registration page if they have not
    registered yet. If they have registered before, they're taken to an
    alternate URL that logs them in immediately.
    
    Still to do: ensure that the acceptInvitation backend doesn't throw an
    error if the user is already a member of the project, but just silently
    returns success if we're already in the desired state.
    rmunn committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    90c844b View commit details
    Browse the repository at this point in the history
  7. Don't error if same invite accepted twice

    If a user clicks the same invitation link twice, he should not get an
    error message, he should just be taken to his home page. He's already a
    member of the project, so trying to join the project should not error
    but just succeed silently.
    rmunn committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    dac00ce View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    c332eeb View commit details
    Browse the repository at this point in the history
  9. Center turnstile component in accept-quickly page

    This allows the turnstile component to double as a visual indicator to
    the user that things are progressing.
    rmunn committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    5d7705b View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    6845e94 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    3fe27a9 View commit details
    Browse the repository at this point in the history
  12. Address CodeQL security concern

    Ensure that LoginRedirect can never be used to redirect to a different
    site. In the future we may whitelist certain domains such as lexbox.org,
    but for now we just strip off the hostname and make sure it has to be a
    relative URL.
    rmunn committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    f956a60 View commit details
    Browse the repository at this point in the history
  13. First draft of redirecting server-side

    WIP. Not yet tested, probably not yet functional.
    rmunn committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    d64f87a View commit details
    Browse the repository at this point in the history
  14. Better approach than changing LoginRedirect

    Rather than redirect to the frontend and then query the backend to find
    out if the user already exists, let's redirect to a backend endpoint,
    which will then decide which frontend page to redirect to. A double
    redirect may not be ideal, but it's better than special-case code in
    the LoginRedirect method.
    rmunn committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    ebdc6a3 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    9d293ca View commit details
    Browse the repository at this point in the history
  16. Delete no-longer-needed frontend page

    Back to just a single frontend page for accepting invites — great.
    rmunn committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    7fa7a3b View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    23120bc View commit details
    Browse the repository at this point in the history
  18. Handle edge case of registering existing email

    This can only happen if an admin creates the account while the user was
    filling out the registration page, so this probably will never happen.
    rmunn committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    f431e9f View commit details
    Browse the repository at this point in the history
  19. Remove unneeded method parameters

    These services are already injected in the constructor
    rmunn committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    8b939a1 View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    208556f View commit details
    Browse the repository at this point in the history