Skip to content
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

Automatically validate the email verification code #2312

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion frontend/src/components/signup/CodeInputStep.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable react/jsx-props-no-spreading */
import React, { useState } from "react";
import React, { useState, useEffect } from "react";
import ReactCodeInput from "react-code-input";
import { useTranslation } from "react-i18next";

Expand Down Expand Up @@ -50,6 +50,7 @@ interface CodeInputStepProps {
email: string;
incrementStep: () => void;
setCode: (value: string) => void;
code: string;
codeError: boolean;
isCodeInputCheckLoading: boolean;
}
Expand All @@ -67,6 +68,7 @@ export default function CodeInputStep({
email,
incrementStep,
setCode,
code,
codeError,
isCodeInputCheckLoading
}: CodeInputStepProps): JSX.Element {
Expand All @@ -85,6 +87,10 @@ export default function CodeInputStep({
}, 2000);
};

useEffect(() => {
if (code.length === 6 && code != "123456") incrementStep();
}, [code]);

return (
<div className="mx-auto h-full w-full pb-4 md:px-8">
<p className="text-md flex justify-center text-bunker-200">{t("signup.step2-message")}</p>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/pages/signup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export default function SignUp() {
email={email}
incrementStep={incrementStep}
setCode={setCode}
code={code}
codeError={codeError}
isCodeInputCheckLoading={isCodeInputCheckLoading}
/>
Expand Down