-
Notifications
You must be signed in to change notification settings - Fork 103
Allow starting over from verification page #9445
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
Closed
Closed
Changes from all commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
099c1ad
Allow starting over from verification page
dd7551c
Allow starting over from verification page
38b5bac
reverting unnecessary changes to useAuthStore
88ffc26
Format frontend
couchersbot[bot] a11a8ce
Merge branch 'develop' into web/bug/signupchangeemail
nc225 98f4ddb
specifically clearing flowToken on restart
910ee53
Format frontend
couchersbot[bot] 296cec6
use function signupFlowRestartSignup
aacce90
Format frontend
couchersbot[bot] 3d2a518
add more error handling
29a63a3
add more error handling
4953dd6
Format frontend
couchersbot[bot] f7e846e
add more error handling
bf27d5c
Format frontend
couchersbot[bot] 9fac54b
add type for e
0bde6e8
Merge branch 'develop' into web/bug/signupchangeemail
nc225 f9f936d
Merge branch 'develop' into web/bug/signupchangeemail
nc225 8284bb2
changed 2-->resendLink
9cf499d
use new link reference system
0bf8c49
use new link reference system
d91faf9
use new link reference system
15a62af
Format frontend
couchersbot[bot] cf0bd19
Merge branch 'develop' into web/bug/signupchangeemail
nc225 c0935c8
allow signup restart by deleting flowtoken
ee7a25e
Format frontend
couchersbot[bot] a184337
updating signuptest to show test email
dc1b505
Format frontend
couchersbot[bot] 20a7e15
simplifying resendVerification functions
ab3a37e
Format frontend
couchersbot[bot] e45fd1b
using testEmail variable
e4b3c7b
revise restartSignup process to use authStore
cbf2d14
Format frontend
couchersbot[bot] a9d1321
clean up and use clearer names
f16f5d5
changing signup_flows: adding signup_cancelled and adjusting username…
aeabf2b
Generate migrations
couchersbot[bot] f720035
Format backend
couchersbot[bot] f88240c
adding signup_cancelled
f1c3642
adding signup_cancelled
c254b07
Format backend
couchersbot[bot] 00e80bd
Format frontend
couchersbot[bot] e3a0bf0
update migration files
5cf0bab
Format backend
couchersbot[bot] 3950d0d
update upgrade and downgrade to add signup_cancelled
68ae9d1
add signup_cancelled to auth flow for correct error handling
f747dcf
fall back to old email message if email is not stored
5d471d0
fall back to old email message if email is not stored
c605f7f
remove email_token invalidation here since this happens in auth.py in…
f5fc917
rework to prevent blocking usernames
528576c
rework to prevent blocking usernames
cbd9a5c
draft new approach to email change during signup
f7b98a1
Format backend
couchersbot[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,13 @@ | ||
| NEXT_PUBLIC_COUCHERS_ENV=preview | ||
| NEXT_PUBLIC_BASE_URL="https://next.couchershq.org" | ||
| NEXT_PUBLIC_API_BASE_URL="https://next.couchershq.org/api" | ||
| NEXT_PUBLIC_MEDIA_BASE_URL="https://dev-user-media.couchershq.org" | ||
| NEXT_PUBLIC_CONSOLE_BASE_URL="https://next-console.couchershq.org" | ||
| NEXT_PUBLIC_COUCHERS_ENV=dev | ||
| NEXT_PUBLIC_BASE_URL="/" | ||
| NEXT_PUBLIC_API_BASE_URL="http://localhost:8888" | ||
| NEXT_PUBLIC_MEDIA_BASE_URL="http://localhost:5001" | ||
| NEXT_PUBLIC_CONSOLE_BASE_URL="http://localhost:10027" | ||
| NEXT_PUBLIC_IS_POST_BETA_ENABLED=true | ||
| NEXT_PUBLIC_NOMINATIM_URL="https://nominatim.openstreetmap.org/" | ||
| NEXT_PUBLIC_IS_VERIFICATION_ENABLED=true | ||
| NEXT_PUBLIC_IS_COMMUNITIES_PART2_ENABLED=true | ||
| NEXT_PUBLIC_STRIPE_KEY="pk_test_51KEzByIfR5z29g5khFE5samD8XKOGLcCrM1lhCkfOomGPUFAEYOw8uAqI2Nkv33wYdPM2FgTQNTC07IiNfHY1kLJ00Jqm8Ppai" | ||
| NEXT_PUBLIC_GLOBAL_MESSAGE_URL="https://gm.couchershq.org/next.json" | ||
| NEXT_PUBLIC_GLOBAL_MESSAGE_URL="https://gm.couchershq.org/localdev.json" | ||
| NEXT_PUBLIC_GROWTHBOOK_API_HOST="https://gbapi.couchershq.org" | ||
| NEXT_PUBLIC_GROWTHBOOK_CLIENT_KEY="sdk-f8lwseEODN02p" | ||
| # When enabled, flags resolve from app/web/feature-flags.dev.json instead of GrowthBook (dev/testing) | ||
| NEXT_PUBLIC_FEATURE_FLAGS_OVERRIDE="1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| import { styled, Typography, useMediaQuery, useTheme } from "@mui/material"; | ||
| import { useMutation } from "@tanstack/react-query"; | ||
| import Alert from "components/Alert"; | ||
| import Button from "components/Button"; | ||
| import TextField from "components/TextField"; | ||
| import { useAuthContext } from "features/auth/AuthProvider"; | ||
| import { Empty } from "google-protobuf/google/protobuf/empty_pb"; | ||
| import { RpcError } from "grpc-web"; | ||
| import { useTranslation } from "i18n"; | ||
| import { AUTH, GLOBAL } from "i18n/namespaces"; | ||
| import { useState } from "react"; | ||
| import { useForm } from "react-hook-form"; | ||
| import { service } from "service"; | ||
| import { lowercaseAndTrimField } from "utils/validation"; | ||
|
|
||
| const StyledForm = styled("form")(({ theme }) => ({ | ||
| marginTop: theme.spacing(2), | ||
| marginBottom: theme.spacing(2), | ||
| display: "flex", | ||
| flexDirection: "column", | ||
| gap: theme.spacing(1), | ||
| alignItems: "flex-start", | ||
| width: "100%", | ||
| [theme.breakpoints.up("md")]: { | ||
| width: "15.5rem", | ||
| }, | ||
| })); | ||
|
|
||
| interface ChangeSignupEmailFormData { | ||
| newSignupEmail: string; | ||
| } | ||
|
|
||
| interface ChangeSignupEmailProps { | ||
| email: string; | ||
| className?: string; | ||
| } | ||
|
|
||
| export default function ChangeSignupEmail({ className }: ChangeSignupEmailProps) { | ||
| const { t } = useTranslation([AUTH, GLOBAL]); | ||
| const { authActions, authState } = useAuthContext(); | ||
| const theme = useTheme(); | ||
| const isMdOrWider = useMediaQuery(theme.breakpoints.up("md")); | ||
|
|
||
| const [changedEmail, setChangedEmail] = useState<boolean>(false); | ||
|
|
||
| const { handleSubmit, register, reset: resetForm } = useForm<ChangeSignupEmailFormData>(); | ||
| const onSubmit = handleSubmit(({ newSignupEmail }) => { | ||
| const sanitizedEmail = lowercaseAndTrimField(newSignupEmail); | ||
| setChangedEmail(true); | ||
| changeSignupEmail({ newSignupEmail: sanitizedEmail }); | ||
| }); | ||
|
|
||
| const { | ||
| error: changeSignupEmailError, | ||
| isPending: isChangeSignupEmailLoading, | ||
| isSuccess: isChangeSignupEmailSuccess, | ||
| mutate: changeSignupEmail, | ||
| } = useMutation<Empty, RpcError, ChangeSignupEmailFormData>({ | ||
| mutationFn: async ({ newSignupEmail }) => { | ||
| await service.auth.signupFlowChangeEmail(authState.flowState!.flowToken, lowercaseAndTrimField(newSignupEmail)); | ||
| }, | ||
| onSuccess: (_, { newSignupEmail }) => { | ||
| const sanitizedEmail = lowercaseAndTrimField(newSignupEmail); | ||
| authActions.assignSignupEmail(sanitizedEmail); | ||
| resetForm(); | ||
| }, | ||
| }); | ||
|
|
||
| return ( | ||
| <div className={className}> | ||
| <Typography variant="body1" gutterBottom> | ||
| {!changedEmail ? t("Mistype your email address? Change it here:") : ""} | ||
| </Typography> | ||
| <> | ||
| {changeSignupEmailError && <Alert severity="error">{changeSignupEmailError.message}</Alert>} | ||
| {isChangeSignupEmailSuccess && ( | ||
| <Alert severity="success">{t("auth:change_signup_email_form.success_message")}</Alert> | ||
| )} | ||
| {!changedEmail ? ( | ||
| <StyledForm onSubmit={onSubmit}> | ||
| <TextField | ||
| id="newSignupEmail" | ||
| {...register("newSignupEmail", { required: true })} | ||
| label={t("auth:change_signup_email_form.new_email")} | ||
| name="newSignupEmail" | ||
| fullWidth | ||
| /> | ||
| <Button fullWidth={!isMdOrWider} loading={isChangeSignupEmailLoading} type="submit"> | ||
| {t("auth:change_signup_email_form.signup_change_email")} | ||
| </Button> | ||
| </StyledForm> | ||
| ) : ( | ||
| <></> | ||
| )} | ||
| </> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.