️ Add support for using SES API (#573)

This commit is contained in:
Luke Vella 2023-03-16 16:04:54 +00:00 committed by GitHub
parent d5c3017a8b
commit 8ab67683cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 810 additions and 18 deletions

View file

@ -68,6 +68,22 @@ declare global {
* "true" to require authentication for creating new polls and accessing admin pages
*/
AUTH_REQUIRED?: string;
/**
* Determines what email provider to use. "smtp" or "ses"
*/
EMAIL_PROVIDER?: "smtp" | "ses";
/**
* AWS access key ID
*/
AWS_ACCESS_KEY_ID?: string;
/**
* AWS secret access key
*/
AWS_SECRET_ACCESS_KEY?: string;
/**
* AWS region
*/
AWS_REGION?: string;
}
}
}

View file

@ -19,9 +19,11 @@ export const UserDetailsForm: React.FunctionComponent<
handleSubmit,
register,
watch,
formState: { errors },
formState: { errors, isSubmitting, isSubmitSuccessful },
} = useForm<UserDetailsData>({ defaultValues });
const isWorking = isSubmitting || isSubmitSuccessful;
React.useEffect(() => {
if (onChange) {
const subscription = watch(onChange);
@ -44,6 +46,7 @@ export const UserDetailsForm: React.FunctionComponent<
className={clsx("input w-full", {
"input-error": errors.name,
})}
disabled={isWorking}
placeholder={t("namePlaceholder")}
{...register("name", { validate: requiredString })}
/>
@ -58,6 +61,7 @@ export const UserDetailsForm: React.FunctionComponent<
className={clsx("input w-full", {
"input-error": errors.contact,
})}
disabled={isWorking}
placeholder={t("emailPlaceholder")}
{...register("contact", {
validate: validEmail,