Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
Extra logging in app sign in, magic link local template
Richie McIlroy8d04a76e596d
diff --git a/apps/desktop/src/components/windows/inner/SignIn.tsx b/apps/desktop/src/components/windows/inner/SignIn.tsxindex 5774b1ad7..277e73dcb 100644--- a/apps/desktop/src/components/windows/inner/SignIn.tsx+++ b/apps/desktop/src/components/windows/inner/SignIn.tsx@@ -5,11 +5,11 @@ import { Logo } from "@/components/icons/Logo";import toast from "react-hot-toast";export const SignIn = () => {- const [email, setEmail] = useState("");+ const [email, setEmail] = useState<string>("");+ const [OTPcode, setOTPcode] = useState<string>("");const [enterCode, setEnterCode] = useState(false);- const [OTPcode, setOTPcode] = useState<number>();- const handleGoogleLogin = async () => {+ const handleLogin = async () => {const { error } = await supabase.auth.signInWithOtp({email: email,});@@ -24,9 +24,16 @@ export const SignIn = () => {};const verifyOTPCode = async () => {+ if (!email || !OTPcode) {+ toast.error(`Error: Email or OTP code is missing`);+ return;+ }++ console.log({ email, OTPcode });+const { error } = await supabase.auth.verifyOtp({email: email,- token: String(OTPcode),+ token: OTPcode,type: "email",});@@ -46,9 +53,7 @@ export const SignIn = () => {<div className="max-w-sm mx-auto flex items-center relative h-14 mb-8"><inputonChange={(e) => {- enterCode- ? setOTPcode(e.target.valueAsNumber)- : setEmail(e.target.value);+ enterCode ? setOTPcode(e.target.value) : setEmail(e.target.value);}}type={enterCode ? "number" : "email"}placeholder={enterCode ? "Enter code" : "Your email"}@@ -59,7 +64,7 @@ export const SignIn = () => {{enterCode === false ? (<div className="mt-3 text-center absolute right-0 h-full"><Button- handler={handleGoogleLogin}+ handler={handleLogin}variant="primary"label="Continue"className="h-full rounded-tr-full rounded-br-full min-w-[100px] border-none"@@ -81,7 +86,13 @@ export const SignIn = () => {type="button"className="underline text-sm"onClick={() => {- enterCode ? setEnterCode(false) : setEnterCode(true);+ if (enterCode) {+ setEmail("");+ setEnterCode(false);+ } else {+ setOTPcode("");+ setEnterCode(true);+ }}}>{enterCode ? "Don't have a code?" : "Already have a code?"}diff --git a/supabase/config.toml b/supabase/config.tomlindex ca2c9a453..75ae01b5a 100644--- a/supabase/config.toml+++ b/supabase/config.toml@@ -1,6 +1,6 @@# A string used to distinguish different Supabase projects on the same host. Defaults to the working# directory name when running `supabase init`.-project_id = "utils"+project_id = "cap"[api]# Port to use for the API URL.@@ -40,9 +40,9 @@ file_size_limit = "50MiB"[auth]# The base URL of your website. Used as an allow-list for redirects and for constructing URLs used# in emails.-site_url = "http://localhost:3000"+site_url = "http://localhost:1420"# A list of *exact* URLs that auth providers are permitted to redirect to post authentication.-additional_redirect_urls = ["https://localhost:3000"]+additional_redirect_urls = ["https://localhost:1420"]# How long tokens are valid for, in seconds. Defaults to 3600 (1 hour), maximum 604,800 seconds (one# week).jwt_expiry = 3600@@ -58,6 +58,14 @@ double_confirm_changes = true# If enabled, users need to confirm their email address before signing in.enable_confirmations = false+[auth.email.template.confirmation]+subject = "Your Cap Sign In"+content_path = "./supabase/templates/magic_link.html"++[auth.email.template.magic_link]+subject = "Your Cap Sign In"+content_path = "./supabase/templates/magic_link.html"+# Use an external OAuth provider. The full list of providers are: `apple`, `azure`, `bitbucket`,# `discord`, `facebook`, `github`, `gitlab`, `google`, `keycloak`, `linkedin`, `notion`, `twitch`,# `twitter`, `slack`, `spotify`, `workos`, `zoom`.diff --git a/supabase/templates/magic_link.html b/supabase/templates/magic_link.htmlnew file mode 100644index 000000000..288f8cf63--- /dev/null+++ b/supabase/templates/magic_link.html@@ -0,0 +1,6 @@+<html>+ <body>+ <h2>Your Cap Signin</h2>+ <p>Use code <strong>{{ .Token }} to sign in to Cap</strong></p>+ </body>+</html>