VRFS-3321 : Disable create account submit button until successful recaptcha callback. Re-disable if captcha expires.
This commit is contained in:
parent
a467388ac8
commit
f2ce59005a
|
|
@ -127,7 +127,7 @@
|
||||||
|
|
||||||
<div class="field recaptcha">
|
<div class="field recaptcha">
|
||||||
<% if Rails.application.config.recaptcha_enable %>
|
<% if Rails.application.config.recaptcha_enable %>
|
||||||
<div id="recaptcha_select" name="recaptcha_response_field" class="g-recaptcha" data-sitekey="<%=Rails.application.config.recaptcha_public_key%>">
|
<div id="recaptcha_select" name="recaptcha_response_field" class="g-recaptcha" data-sitekey="<%=Rails.application.config.recaptcha_public_key%>" data-callback="recaptcha_success" data-expired-callback="recaptcha_expired">
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -138,7 +138,7 @@
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<%= f.submit "CREATE ACCOUNT", class: "button-orange" %>
|
<%= f.submit "CREATE ACCOUNT", class: "button-orange disabled", id:"create-account-submit"%>
|
||||||
<%= link_to "CANCEL", root_path, :class=>'button-grey' %>
|
<%= link_to "CANCEL", root_path, :class=>'button-grey' %>
|
||||||
</div>
|
</div>
|
||||||
<br style="clear:both;"/><br/>
|
<br style="clear:both;"/><br/>
|
||||||
|
|
@ -163,6 +163,14 @@
|
||||||
|
|
||||||
window.signup.handle_register_as_changes()
|
window.signup.handle_register_as_changes()
|
||||||
|
|
||||||
|
function recaptcha_success(response) {
|
||||||
|
$("#create-account-submit").removeClass("disabled")
|
||||||
|
}
|
||||||
|
|
||||||
|
function recaptcha_expired(response) {
|
||||||
|
$("#create-account-submit").addClass("disabled")
|
||||||
|
}
|
||||||
|
|
||||||
function get_first_error(field) {
|
function get_first_error(field) {
|
||||||
if (errors[field] && errors[field].length > 0) {
|
if (errors[field] && errors[field].length > 0) {
|
||||||
return errors[field][0]
|
return errors[field][0]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue