disabled submit on registration to avoid duplicate account creation
This commit is contained in:
parent
f881f8b638
commit
0c71144833
@ -83,6 +83,11 @@ MaterioUser = function(){
|
||||
|
||||
$("#user-register-form #edit-submit, #user-register-form #edit-submit--2", $modal).click(function(event){
|
||||
event.preventDefault();
|
||||
|
||||
// disable submit button to avoid duplicate user creation
|
||||
// console.log('click', this);
|
||||
$(this).attr('disabled', 'true');
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType:'json',
|
||||
@ -120,12 +125,21 @@ MaterioUser = function(){
|
||||
};
|
||||
|
||||
function onUserLoginRegisterSubmit($form, data, destination){
|
||||
// console.log('data', data);
|
||||
cleanModalErrors();
|
||||
if(data.errors != null){
|
||||
for(field in data.errors){
|
||||
$('input[name='+field+']', $form).addClass('error');
|
||||
$form.prepend($('<div>').addClass('message-error').html(data.errors[field]));
|
||||
}
|
||||
|
||||
(function($form){
|
||||
setTimeout(function(){
|
||||
console.log('enabled');
|
||||
$('input[type=submit]', $form).removeAttr('disabled');
|
||||
}, 0.5*1000);
|
||||
})($form);
|
||||
|
||||
}else{
|
||||
// trace('destination = '+destination);
|
||||
window.location.pathname = destination;
|
||||
|
14
js/materio_user.min.js
vendored
14
js/materio_user.min.js
vendored
@ -453,6 +453,11 @@ MaterioUser = function(){
|
||||
|
||||
$("#user-register-form #edit-submit, #user-register-form #edit-submit--2", $modal).click(function(event){
|
||||
event.preventDefault();
|
||||
|
||||
// disable submit button to avoid duplicate user creation
|
||||
// console.log('click', this);
|
||||
$(this).attr('disabled', 'true');
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType:'json',
|
||||
@ -490,12 +495,21 @@ MaterioUser = function(){
|
||||
};
|
||||
|
||||
function onUserLoginRegisterSubmit($form, data, destination){
|
||||
// console.log('data', data);
|
||||
cleanModalErrors();
|
||||
if(data.errors != null){
|
||||
for(field in data.errors){
|
||||
$('input[name='+field+']', $form).addClass('error');
|
||||
$form.prepend($('<div>').addClass('message-error').html(data.errors[field]));
|
||||
}
|
||||
|
||||
(function($form){
|
||||
setTimeout(function(){
|
||||
console.log('enabled');
|
||||
$('input[type=submit]', $form).removeAttr('disabled');
|
||||
}, 0.5*1000);
|
||||
})($form);
|
||||
|
||||
}else{
|
||||
// trace('destination = '+destination);
|
||||
window.location.pathname = destination;
|
||||
|
Loading…
x
Reference in New Issue
Block a user