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MAAM,YAAb,UACE,SAAC,EAAAC,MAAD,eAAOC,GAAG,YAAeL,EAAS,WAAlC,CAA8CM,YAAY,kBAG7DT,EAAAA,EAAAA,MAAYiB,qBACX,SAAC,EAAAZ,MAAD,CAAOC,MAAM,+CAAb,UACE,SAAC,EAAAC,MAAD,eAAOC,GAAG,qBAAwBL,EAAS,QAA3C,CAAoDM,YAAY,aAGpE,SAAC,EAAAJ,MAAD,CAAOC,MAAM,WAAWI,UAAWR,EAAOZ,SAAUqB,MAAOT,MAAAA,GAAF,UAAEA,EAAQZ,gBAAV,aAAE,EAAkBK,QAA7E,UACE,SAAC,IAAD,eACEa,GAAG,eACHU,WAAS,EACTC,aAAa,gBACThB,EAAS,WAAY,CAAES,SAAU,8BAGzC,SAAC,EAAAP,MAAD,CAAOC,MAAM,mBAAmBI,UAAWR,EAAOjB,QAAS0B,MAAOT,MAAAA,GAAF,UAAEA,EAAQjB,eAAV,aAAE,EAAiBU,QAAnF,UACE,SAAC,IAAD,eACEa,GAAG,uBACHW,aAAa,gBACThB,EAAS,UAAW,CACtBS,SAAU,iCACVQ,SAAWC,GAAMA,IAAMjB,IAAYd,UAAY,+BAKrD,UAAC,EAAAgC,gBAAD,kBACE,SAAC,EAAAC,OAAD,CAAQR,KAAK,SAAb,sBACA,SAAC,EAAAS,WAAD,CAAYC,KAAK,OAAOC,MAAM1B,EAAAA,EAAAA,MAAYC,UAAY,SAAtD,yCAYhB","sources":["webpack://grafana/./public/app/core/components/Signup/SignupPage.tsx"],"sourcesContent":["import React, { FC } from 'react';\n\nimport { getBackendSrv } from '@grafana/runtime';\nimport { Form, Field, Input, Button, HorizontalGroup, LinkButton, FormAPI } from '@grafana/ui';\nimport { getConfig } from 'app/core/config';\nimport { useAppNotification } from 'app/core/copy/appNotification';\nimport { GrafanaRouteComponentProps } from 'app/core/navigation/types';\n\nimport { InnerBox, LoginLayout } from '../Login/LoginLayout';\nimport { PasswordField } from '../PasswordField/PasswordField';\n\ninterface SignupDTO {\n name?: string;\n email: string;\n username: string;\n orgName?: string;\n password: string;\n code: string;\n confirm?: string;\n}\n\ninterface QueryParams {\n email?: string;\n code?: string;\n}\n\ninterface Props extends GrafanaRouteComponentProps<{}, QueryParams> {}\n\nexport const SignupPage: FC<Props> = (props) => {\n const notifyApp = useAppNotification();\n const onSubmit = async (formData: SignupDTO) => {\n if (formData.name === '') {\n delete formData.name;\n }\n delete formData.confirm;\n\n const response = await getBackendSrv()\n .post('/api/user/signup/step2', {\n email: formData.email,\n code: formData.code,\n username: formData.email,\n orgName: formData.orgName,\n password: formData.password,\n name: formData.name,\n })\n .catch((err) => {\n const msg = err.data?.message || err;\n notifyApp.warning(msg);\n });\n\n if (response.code === 'redirect-to-select-org') {\n window.location.assign(getConfig().appSubUrl + '/profile/select-org?signup=1');\n }\n window.location.assign(getConfig().appSubUrl + '/');\n };\n\n const defaultValues = {\n email: props.queryParams.email,\n code: props.queryParams.code,\n };\n\n return (\n <LoginLayout>\n <InnerBox>\n <Form defaultValues={defaultValues} onSubmit={onSubmit}>\n {({ errors, register, getValues }: FormAPI<SignupDTO>) => (\n <>\n <Field label=\"Your name\">\n <Input id=\"user-name\" {...register('name')} placeholder=\"(optional)\" />\n </Field>\n <Field label=\"Email\" invalid={!!errors.email} error={errors.email?.message}>\n <Input\n id=\"email\"\n {...register('email', {\n required: 'Email is required',\n pattern: {\n value: /^\\S+@\\S+$/,\n message: 'Email is invalid',\n },\n })}\n type=\"email\"\n placeholder=\"Email\"\n />\n </Field>\n {!getConfig().autoAssignOrg && (\n <Field label=\"Org. name\">\n <Input id=\"org-name\" {...register('orgName')} placeholder=\"Org. name\" />\n </Field>\n )}\n {getConfig().verifyEmailEnabled && (\n <Field label=\"Email verification code (sent to your email)\">\n <Input id=\"verification-code\" {...register('code')} placeholder=\"Code\" />\n </Field>\n )}\n <Field label=\"Password\" invalid={!!errors.password} error={errors?.password?.message}>\n <PasswordField\n id=\"new-password\"\n autoFocus\n autoComplete=\"new-password\"\n {...register('password', { required: 'Password is required' })}\n />\n </Field>\n <Field label=\"Confirm password\" invalid={!!errors.confirm} error={errors?.confirm?.message}>\n <PasswordField\n id=\"confirm-new-password\"\n autoComplete=\"new-password\"\n {...register('confirm', {\n required: 'Confirmed password is required',\n validate: (v) => v === getValues().password || 'Passwords must match!',\n })}\n />\n </Field>\n\n <HorizontalGroup>\n <Button type=\"submit\">Submit</Button>\n <LinkButton fill=\"text\" href={getConfig().appSubUrl + '/login'}>\n Back to login\n </LinkButton>\n </HorizontalGroup>\n </>\n )}\n </Form>\n </InnerBox>\n </LoginLayout>\n );\n};\n\nexport default SignupPage;\n"],"names":["SignupPage","props","notifyApp","useAppNotification","defaultValues","email","queryParams","code","Form","onSubmit","async","formData","name","confirm","getBackendSrv","post","username","orgName","password","catch","err","msg","data","message","warning","window","location","assign","getConfig","appSubUrl","errors","register","getValues","Field","label","Input","id","placeholder","invalid","error","required","pattern","value","type","autoAssignOrg","verifyEmailEnabled","autoFocus","autoComplete","validate","v","HorizontalGroup","Button","LinkButton","fill","href"],"sourceRoot":""}
|