diff --git a/components/form/fields.tsx b/components/form/fields.tsx index ad81c400..e3eb99cb 100644 --- a/components/form/fields.tsx +++ b/components/form/fields.tsx @@ -100,18 +100,15 @@ export const PasswordField = forwardRef(funct return ; }); -export const EmailInput = forwardRef(function EmailInput( - props, - ref -) { +export const EmailInput = forwardRef(function EmailInput(props, ref) { return ( - ); diff --git a/components/ui/AuthContainer.tsx b/components/ui/AuthContainer.tsx new file mode 100644 index 00000000..253ea3fe --- /dev/null +++ b/components/ui/AuthContainer.tsx @@ -0,0 +1,40 @@ +import React from "react"; + +import Loader from "@components/Loader"; +import { HeadSeo } from "@components/seo/head-seo"; + +interface Props { + title: string; + description: string; + footerText?: React.ReactNode | string; + showLogo?: boolean; + heading?: string; + loading?: boolean; +} + +export default function AuthContainer(props: React.PropsWithChildren) { + return ( +
+ +
+ {props.showLogo && ( + Cal.com Logo + )} + {props.heading && ( +

{props.heading}

+ )} +
+ {props.loading && ( +
+ +
+ )} +
+
+ {props.children} +
+
{props.footerText}
+
+
+ ); +} diff --git a/pages/auth/forgot-password/index.tsx b/pages/auth/forgot-password/index.tsx index 22ea1a78..6eadf2e6 100644 --- a/pages/auth/forgot-password/index.tsx +++ b/pages/auth/forgot-password/index.tsx @@ -1,13 +1,14 @@ import debounce from "lodash/debounce"; import { GetServerSidePropsContext } from "next"; import { getCsrfToken } from "next-auth/react"; +import Link from "next/link"; import React, { SyntheticEvent } from "react"; import { getSession } from "@lib/auth"; import { useLocale } from "@lib/hooks/useLocale"; import { EmailField } from "@components/form/fields"; -import { HeadSeo } from "@components/seo/head-seo"; +import AuthContainer from "@components/ui/AuthContainer"; import Button from "@components/ui/Button"; export default function ForgotPassword({ csrfToken }: { csrfToken: string }) { @@ -72,64 +73,56 @@ export default function ForgotPassword({ csrfToken }: { csrfToken: string }) { const Success = () => { return (
-

{t("done")}

-

{t("check_email_reset_password")}

- {error &&

{error.message}

} +

{t("check_email_reset_password")}

+ {error &&

{error.message}

}
); }; return ( -
- -
-
- {success && } - {!success && ( - <> -
-

- {t("forgot_password")} -

-

{t("reset_instructions")}

- {error &&

{error.message}

} -
-
- - - -
- - - -
- - - )} -
-
-
+ + {t("already_have_an_account")}{" "} + + {t("login_instead")} + + + }> + {success && } + {!success && ( + <> +
+

{t("reset_instructions")}

+ {error &&

{error.message}

} +
+
+ + +
+ +
+ + + )} +
); } diff --git a/pages/auth/login.tsx b/pages/auth/login.tsx index ae5b387a..14d78579 100644 --- a/pages/auth/login.tsx +++ b/pages/auth/login.tsx @@ -12,9 +12,9 @@ import { trpc } from "@lib/trpc"; import { inferSSRProps } from "@lib/types/inferSSRProps"; import AddToHomescreen from "@components/AddToHomescreen"; -import Loader from "@components/Loader"; -import { EmailInput } from "@components/form/fields"; -import { HeadSeo } from "@components/seo/head-seo"; +import { EmailField, PasswordField, TextField } from "@components/form/fields"; +import AuthContainer from "@components/ui/AuthContainer"; +import Button from "@components/ui/Button"; import { IS_GOOGLE_LOGIN_ENABLED } from "@server/lib/constants"; import { ssrInit } from "@server/lib/ssr"; @@ -97,150 +97,123 @@ export default function Login({ }); return ( -
- - - {isSubmitting && ( -
- -
- )} - -
- Cal.com Logo -

- {t("sign_in_account")} -

-
- -
-
-
- -
- -
- setEmail(e.currentTarget.value)} - className="block w-full px-3 py-2 placeholder-gray-400 border rounded-sm shadow-sm appearance-none border-neutral-300 focus:outline-none focus:ring-neutral-900 focus:border-neutral-900 sm:text-sm" - /> -
+ <> + + {t("dont_have_an_account")} {/* replace this with your account creation flow */} + + {t("create_an_account")} + + + }> + + +
+ +
+ setEmail(e.currentTarget.value)} + />
+
-
-
-
- -
- -
-
- setPassword(e.currentTarget.value)} - className="block w-full px-3 py-2 placeholder-gray-400 border rounded-sm shadow-sm appearance-none border-neutral-300 focus:outline-none focus:ring-neutral-900 focus:border-neutral-900 sm:text-sm" - /> -
+
+ + setPassword(e.currentTarget.value)} + /> +
- {secondFactorRequired && ( -
- -
- setCode(e.currentTarget.value)} - className="block w-full px-3 py-2 placeholder-gray-400 border rounded-sm shadow-sm appearance-none border-neutral-300 focus:outline-none focus:ring-neutral-900 focus:border-neutral-900 sm:text-sm" - /> -
-
- )} - -
- -
- - {errorMessage &&

{errorMessage}

} - - {isGoogleLoginEnabled && ( -
- -
+ {secondFactorRequired && ( + setCode(e.currentTarget.value)} + /> )} - {isSAMLLoginEnabled && ( -
- +
- // hosted solution, fetch tenant and product from the backend - mutation.mutate({ - email, - }); + {errorMessage &&

{errorMessage}

} + + {isGoogleLoginEnabled && ( +
+ +
+ )} + {isSAMLLoginEnabled && ( +
+ -
- )} -
-
- {t("dont_have_an_account")} {/* replace this with your account creation flow */} - - {t("create_an_account")} - -
-
+ + // hosted solution, fetch tenant and product from the backend + mutation.mutate({ + email, + }); + } + }}> + {t("signin_with_saml")} + +
+ )} + -
+ ); } diff --git a/pages/auth/logout.tsx b/pages/auth/logout.tsx index a92bb201..e8d2bcc8 100644 --- a/pages/auth/logout.tsx +++ b/pages/auth/logout.tsx @@ -7,7 +7,8 @@ import { useEffect } from "react"; import { useLocale } from "@lib/hooks/useLocale"; import { inferSSRProps } from "@lib/types/inferSSRProps"; -import { HeadSeo } from "@components/seo/head-seo"; +import AuthContainer from "@components/ui/AuthContainer"; +import Button from "@components/ui/Button"; import { ssrInit } from "@server/lib/ssr"; @@ -23,40 +24,24 @@ export default function Logout(props: Props) { const { t } = useLocale(); return ( -
- -
- -
-
-
- -
-
- -
-

{t("hope_to_see_you_soon")}

-
-
-
-
- - - {t("go_back_login")} - - + +
+
+ +
+
+ +
+

{t("hope_to_see_you_soon")}

-
+ + + + ); } diff --git a/public/static/locales/en/common.json b/public/static/locales/en/common.json index 5a56a0f1..1a8a14b0 100644 --- a/public/static/locales/en/common.json +++ b/public/static/locales/en/common.json @@ -158,6 +158,7 @@ "30min_meeting": "30 Min Meeting", "secret_meeting": "Secret Meeting", "login_instead": "Login instead", + "already_have_an_account": "Already have an account?", "create_account": "Create Account", "confirm_password": "Confirm password", "create_your_account": "Create your account",