Fork me on GitHub
#biff
<
2023-05-19
>
Epidiah Ravachol15:05:25

I'm having a little trouble with reCAPTCHA and I'm not sure how to debug it. Basically, I've got both the sign-in process that sends the 6-digit code and the sign-up process that sends the link. When I test the sign-in, it seems to be working. When I test the sign-up, I always fail the recaptcha. After failing the recaptcha, if I click over to the sign-in side of things and try that, it will fail, too, until I close the tab and reopen. Then I'm back to sign-in working and sign-up failing. Well, as always, merely typing this in made me realize the root of my problem. duckie I'm using hx-boost: https://htmx.org/attributes/hx-boost/ And it trips me up once in a while, because it uses htmx magic to replace the innerHTML of the <body>. I don't know exactly how this messed up the recaptcha script, but when I added {:hx-boost "false"} to my sign-up and sign-in links, it cleared up. So, just in case someone else is encountering a similar issue, there you have it!

Jacob O'Bryant15:05:58

ah good to know! I think the example project doesn't run into this since it only uses htmx after you've signed in

Epidiah Ravachol15:05:40

It made for a nice brain teaser! I have the hx-boost attribute in the body of every page, which I was enjoying because I could do something like make a button that toggles a dark mode class on the body and the class would persist from page to page. But like I said, it does trip me up from time to time.

Jacob O'Bryant16:05:27

for dark mode you can use local storage to persist the setting. There's a snippet for that in platypub somewhere

Jacob O'Bryant16:05:44

(the script is inlined so it executes sooner)

Epidiah Ravachol17:05:02

I need to spend some time digging through platypub. I have a feeling it already does a lot of the things I'm going to want to do. Like, at some point, I'm going to have to figure out how to upload and display images.

Jacob O'Bryant17:05:51

ah yes there's code for that already :) that would be a good candidate for a how-to article

2
Epidiah Ravachol17:05:49

I would very much dig that!

👌 2