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

Update email action to invite users who don't have accounts #1002

Open
gabestein opened this issue Feb 27, 2025 · 4 comments
Open

Update email action to invite users who don't have accounts #1002

gabestein opened this issue Feb 27, 2025 · 4 comments
Assignees
Labels

Comments

@gabestein
Copy link
Member

gabestein commented Feb 27, 2025

Motivation

So an admin can send emails with forms to people who create discussions and thus are not (yet) members. In this case, it's to create a discussion verification flow for users where we're collecting email addresses on the front-end and want to create memberships for them as part of that flow.

The other cool thing this does is essentially allows you to create custom magic link flows for different workflows (via API or otherwise). E.g., you can have someone:

  1. Enter their email address on a public-facing site, which creates a pub
  2. Have that creation trigger a form invite that simply asks them to verify their account
  3. Have submitting that form trigger another form invite to fill out the original form

Requirements

  • If an email action containing an invite is sent to an email address field (as opposed to a member)...
    • If the member for that email already exists, it sends it to that user and allows them to login with the invite link as normal and then redirects them to fill out the form as usual
    • If the member does not exist, it creates an account for them and then sends a link that redirects them to fill out the invited form with the new created account
  • Invite can only be used to fill out form from newly created account/email

Acceptance Criteria

  • Action flow:
    • Action detects no account/member when run, and creates new account for specified email without sending a normal invite email
    • Action creates a form permission for the form/pub pair and the new account
    • Action rewrites form link from direct link to the form to a typical account setup invitation link, adding a redirectTo= parameter that redirects to the form with pub ID
    • User clicks on link, and is prompted to finish setting up account
    • After account setup, setup page reads redirect param and forwards logged in user to pub form
  • Update account setup page to accept redirect (if doesn't already)

Extra work

@gabestein
Copy link
Member Author

Let's discuss. Could also see accomplishing this by creating users via API or even action — maybe having a special function that can take an email field and either creates a new user from that field (and sets a member field to that user) or, if the user already exists, sets a member field to that user?

@gabestein
Copy link
Member Author

Another thought: can we solve this to some degree by implementing public forms? That is, a form that prompts a user to login or create an account, and then once they've done so, allows them to submit it? We need this for ICOR as well.

@gabestein gabestein changed the title Invite anonymous user to fill out form Allow someone who is not yet a member to fill out a form Mar 6, 2025
@gabestein gabestein changed the title Allow someone who is not yet a member to fill out a form Allow member invitations via API Mar 6, 2025
@gabestein
Copy link
Member Author

@tefkah we need your thoughts on this one -- the context is in the motivation. Basically, we want to be able to accept a discussion pub from someone with only an email address, but then give them the ability to see/edit the pub they created, and in this case, to trigger a workflow that sends them a form to verify the discussion.

@gabestein gabestein changed the title Allow member invitations via API Allow users who don't have accounts (yet) to fill out forms Mar 7, 2025
@gabestein
Copy link
Member Author

gabestein commented Mar 7, 2025

Another use-case for this popped up: ICOR wants to have a public form, and wants users to be able to save draft forms before they submit them. Yes, we should probably implement some kind of local auto-save, but a "native" PubPub way to do this would be to create a "save draft" button that creates the Pub and puts it in a draft stage, and allows the user to visit it again. In this case, it would also trigger an email to the user with an invite to the pub.

The problem we're facing in all of these cases is simply how to associate an email address to a user — either one that already exists, or by creating a new one. In the invited review case, the admins are responsible for creating the user, if they don't exist. But we need some way for "public" users to be able to do this, too.

For these cases, I'm increasingly leaning towards relying on existing mechanisms. For implementing public forms for the ICOR case, we could simply require a user create an account to fill them out, and then add them as a pub contributor.

For invitations, we could update the email action's invitation flow to process email fields such that it either adds the user as a Pub contributor member if it exists, or automatically creates an invitation and adds them if it doesn't.

@gabestein gabestein changed the title Allow users who don't have accounts (yet) to fill out forms Update email action to invite users who don't have accounts Mar 10, 2025
@3mcd 3mcd added the 2-day label Mar 10, 2025
@gabestein gabestein moved this from Refining to In Progress in PubPub Legacy & Platform Combined Workstreams Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

3 participants