Updated the register to allow the difference between a individual and corporate
This commit is contained in:
@@ -12,6 +12,7 @@ import Link from "next/link";
|
||||
import Input from "@/components/Low/Input";
|
||||
import clsx from "clsx";
|
||||
import {useRouter} from "next/router";
|
||||
import EmailVerification from "./(auth)/EmailVerification";
|
||||
|
||||
const EMAIL_REGEX = new RegExp(/^[a-zA-Z0-9]+(?:\.[a-zA-Z0-9]+)*@[a-zA-Z0-9]+(?:\.[a-zA-Z0-9]+)*$/g);
|
||||
|
||||
@@ -68,26 +69,6 @@ export default function Login() {
|
||||
.finally(() => setIsLoading(false));
|
||||
};
|
||||
|
||||
const sendEmailVerification = () => {
|
||||
setIsLoading(true);
|
||||
axios
|
||||
.post<{ok: boolean}>("/api/reset/sendVerification", {})
|
||||
.then(() => {
|
||||
toast.success("An e-mail has been sent, please make sure to check your spam folder!");
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
toast.error("Something went wrong, please logout and re-login.", {toastId: "send-verify-error"});
|
||||
})
|
||||
.finally(() => setIsLoading(false));
|
||||
};
|
||||
|
||||
const logout = async () => {
|
||||
axios.post("/api/logout").finally(() => {
|
||||
setTimeout(() => router.reload(), 500);
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
@@ -150,27 +131,7 @@ export default function Login() {
|
||||
</span>
|
||||
</>
|
||||
)}
|
||||
{user && !user.isVerified && (
|
||||
<>
|
||||
<div className="flex flex-col items-center gap-6 w-full -lg:px-8 lg:w-1/2 relative">
|
||||
<h4 className="font-semibold text-2xl text-mti-purple-light">Please confirm your account!</h4>
|
||||
<span className="text-center">
|
||||
An e-mail has been sent to <span className="italic text-mti-purple-light">{user.email}</span>, please click the
|
||||
link in it to confirm your account to be able to use the application. <br /> <br />
|
||||
Please refresh this page once it has been verified.
|
||||
</span>
|
||||
<Button className="mt-8 w-full" color="purple" disabled={isLoading} onClick={sendEmailVerification}>
|
||||
Resend e-mail
|
||||
</Button>
|
||||
</div>
|
||||
<Divider className="max-w-xs lg:max-w-md" />
|
||||
<span className="text-mti-gray-cool text-sm font-normal">
|
||||
<button className="text-mti-purple-light" onClick={logout}>
|
||||
Log out instead
|
||||
</button>
|
||||
</span>
|
||||
</>
|
||||
)}
|
||||
{user && !user.isVerified && <EmailVerification user={user} isLoading={isLoading} setIsLoading={setIsLoading} />}
|
||||
</section>
|
||||
</main>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user