Skip to content

Commit 7f2c8be

Browse files
Add email autofill from search params (#16936)
* Add email autofill from search params
1 parent f28d5f3 commit 7f2c8be

File tree

1 file changed

+12
-7
lines changed
  • airbyte-webapp/src/packages/cloud/views/auth/SignupPage/components

1 file changed

+12
-7
lines changed

airbyte-webapp/src/packages/cloud/views/auth/SignupPage/components/SignupForm.tsx

+12-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Field, FieldProps, Formik } from "formik";
22
import React, { useMemo } from "react";
33
import { FormattedMessage, useIntl } from "react-intl";
4+
import { useSearchParams } from "react-router-dom";
45
import styled from "styled-components";
56
import * as yup from "yup";
67

@@ -195,15 +196,19 @@ export const SignupForm: React.FC = () => {
195196
return yup.object().shape(shape);
196197
}, [showName, showCompanyName]);
197198

199+
const [params] = useSearchParams();
200+
const search = Object.fromEntries(params);
201+
202+
const initialValues = {
203+
name: `${search.firstname ?? ""} ${search.lastname ?? ""}`.trim(),
204+
companyName: search.company ?? "",
205+
email: search.email ?? "",
206+
password: "",
207+
news: true,
208+
};
198209
return (
199210
<Formik<FormValues>
200-
initialValues={{
201-
name: "",
202-
companyName: "",
203-
email: "",
204-
password: "",
205-
news: true,
206-
}}
211+
initialValues={initialValues}
207212
validationSchema={validationSchema}
208213
onSubmit={async (values, { setFieldError, setStatus }) =>
209214
signUp(values).catch((err) => {

0 commit comments

Comments
 (0)