LEARNER-4578: Adds in password validation on Studio

This commit is contained in:
Jeff LaJoie
2018-04-04 15:13:23 -04:00
parent 1c1b8451ba
commit aeb85c59d3
5 changed files with 58 additions and 0 deletions

View File

@@ -29,5 +29,31 @@ define(['jquery', 'jquery.cookie'], function($) {
}
});
});
$('input#password').blur(function() {
var $formErrors = $('#password_error'),
data = {
password: $('#password').val()
};
// Uninitialize the errors on blur
$formErrors.empty();
$formErrors.addClass('hidden');
$.ajax({
url: '/api/user/v1/validation/registration',
type: 'POST',
dataType: 'json',
data: data,
success: function(json) {
_.each(json.validation_decisions, function(value, key) {
if (key === 'password' && value) {
$formErrors.html(value);
$formErrors.removeClass('hidden');
}
});
}
});
});
};
});