import { useState } from 'react'; import { useForm } from 'react-hook-form'; import { Trans, t } from '@grafana/i18n'; import { getBackendSrv } from '@grafana/runtime'; import { Field, Input, Button, Legend, Container, LinkButton, Stack } from '@grafana/ui'; import { getConfig } from 'app/core/config'; import { useAppNotification } from 'app/core/copy/appNotification'; import { w3cStandardEmailValidator } from 'app/features/admin/utils'; interface EmailDTO { email: string; } export const VerifyEmail = () => { const notifyApp = useAppNotification(); const { handleSubmit, register, formState: { errors }, } = useForm(); const [emailSent, setEmailSent] = useState(false); const onSubmit = (formModel: EmailDTO) => { getBackendSrv() .post('/api/user/signup', formModel) .then(() => { setEmailSent(true); }) .catch((err) => { const msg = err.data?.message || err; notifyApp.warning(msg); }); }; if (emailSent) { return (

An email with a verification link has been sent to the email address. You should receive it shortly.

Complete signup
); } return (
Verify email Back to login
); };