Reset captcha when captcha error is returned in registration form (#4238)

This commit is contained in:
Adrian Gruntkowski 2024-06-18 09:36:52 +02:00 committed by GitHub
parent 1c820ba2af
commit fe9f7349e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -144,7 +144,9 @@ defmodule PlausibleWeb.Live.RegisterForm do
>
</div>
<%= if @captcha_error do %>
<div class="text-red-500 text-xs italic mt-3"><%= @captcha_error %></div>
<div class="text-red-500 text-xs italic mt-3" x-data x-init="hcaptcha.reset()">
<%= @captcha_error %>
</div>
<% end %>
<script
phx-update="ignore"
@ -256,7 +258,12 @@ defmodule PlausibleWeb.Live.RegisterForm do
password_strength = Auth.User.password_strength(changeset)
{:noreply, assign(socket, form: to_form(changeset), password_strength: password_strength)}
{:noreply,
assign(socket,
form: to_form(changeset),
password_strength: password_strength,
captcha_error: nil
)}
end
def handle_event(