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">
|
||||
<% 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>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
@ -138,7 +138,7 @@
|
|||
-->
|
||||
|
||||
<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' %>
|
||||
</div>
|
||||
<br style="clear:both;"/><br/>
|
||||
|
|
@ -163,6 +163,14 @@
|
|||
|
||||
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) {
|
||||
if (errors[field] && errors[field].length > 0) {
|
||||
return errors[field][0]
|
||||
|
|
@ -239,7 +247,7 @@
|
|||
recaptchaInput.closest('div.field').addClass('error')
|
||||
recaptchaInput.after("<div class='error-text'>" + recaptcha + "</div>")
|
||||
}
|
||||
|
||||
|
||||
if (musician_instruments) {
|
||||
var musicianInstrumentsInput = $('#instrument_selector');
|
||||
musicianInstrumentsInput.closest('div.ftue-instrumentlist-wrapper').addClass('error')
|
||||
|
|
|
|||
Loading…
Reference in New Issue