|
@@ -83,7 +83,7 @@ MaterioUser = function(){
|
|
|
dataType:'json',
|
|
|
url: Drupal.settings.basePath+Drupal.settings.pathPrefix+"materio_user/register/submit",
|
|
|
data: $('#user-register-form', $modal).serialize(),
|
|
|
- success: function(data) { onUserLoginRegisterSubmit(data, destination);},
|
|
|
+ success: function(data) { onUserLoginRegisterSubmit($('#user-register-form'), data, destination);},
|
|
|
error: function() {trace('error');}
|
|
|
});
|
|
|
return false;
|
|
@@ -96,7 +96,7 @@ MaterioUser = function(){
|
|
|
dataType:'json',
|
|
|
url: Drupal.settings.basePath+Drupal.settings.pathPrefix+"materio_user/login/submit",
|
|
|
data: $('#user-login', $modal).serialize(),
|
|
|
- success: function(data){ onUserLoginRegisterSubmit(data, destination); },
|
|
|
+ success: function(data){ onUserLoginRegisterSubmit($('#user-login'), data, destination); },
|
|
|
error: function() { trace('error'); }
|
|
|
});
|
|
|
return false;
|
|
@@ -115,12 +115,12 @@ MaterioUser = function(){
|
|
|
});
|
|
|
};
|
|
|
|
|
|
- function onUserLoginRegisterSubmit(data, destination){
|
|
|
+ function onUserLoginRegisterSubmit($form, data, destination){
|
|
|
cleanModalErrors();
|
|
|
if(data.errors != null){
|
|
|
for(field in data.errors){
|
|
|
- $('#user-login input[name='+field+']', '.modal-content').addClass('error');
|
|
|
- $('.modal-content').prepend($('<div>').addClass('message-error').html(data.errors[field]));
|
|
|
+ $('input[name='+field+']', $form).addClass('error');
|
|
|
+ $form.prepend($('<div>').addClass('message-error').html(data.errors[field]));
|
|
|
}
|
|
|
}else{
|
|
|
window.location.pathname = destination;
|