-
Notifications
You must be signed in to change notification settings - Fork 2
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/site creation form email #679
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have an example of a repo that has been created via this new form as a sanity check that this works?
const foundUser = await this.usersService.findByEmail(requesterEmail) | ||
if (!foundUser) { | ||
const foundRequester = await this.usersService.findByEmail(requesterEmail) | ||
if (!foundRequester) { | ||
const err = `Form submitter ${requesterEmail} is not an Isomer user. Register an account for this user and try again.` | ||
await this.sendCreateError(requesterEmail, repoName, submissionId, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry a bit confused, this is an error flow right? Why are we returning 200 res after sendCreateError?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This endpoint is only triggered by forms, which expects a 200 response, otherwise it could trigger a retry! The error handling is done separately via email
src/routes/formsgSiteCreation.ts
Outdated
@@ -51,6 +52,7 @@ export class FormsgRouter { | |||
const requesterEmail = getField(responses, REQUESTER_EMAIL_FIELD) | |||
const siteName = getField(responses, SITE_NAME_FIELD) | |||
const repoName = getField(responses, REPO_NAME_FIELD) | |||
const ownerEmail = getField(responses, OWNER_NAME_FIELD)?.toLowerCase() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: could we do a strip on the string?
worried if ops put space then the string equality operation fails and it registers as new email
(maybe this error case is captured downstream)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, added in 80cfbbd
* Feat: add findOrCreateByEmail * Feat: add site member instead of github team * Feat: update forms parsing * Fix: update infraService initialisation * Chore: remove unused createTeamOnGithub * nit: update variable name * chore: update todo with issue number * Fix: trim user input
This PR modifies our existing site creation form to utilise the new email login flow instead. Currently, our site creation form creates a new website, but does not assign site members to the new site - thus our creation flow currently creates an Amplify site that is accessed via Github login, with access manually granted to users via Github. This PR changes the creation flow to associate an existing isomer user to the specified site, or create a new isomer user using the specified email if no such user exists. A new form has also been created for both staging and production (staging form link). Note that the person filling in the form is still specified as the owner of the form.
Env var changes before merging:
SITE_CREATE_FORM_KEY
on production - we're using a new site create form (v3) just to be safe, so the form key needs to be swapped out to the new secret key