Commit 4b93ef49 by John Jarvis

errors for login and reg

parent f2abc3c3
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
(function() { (function() {
$(document).delegate('#login-form', 'ajax:success', function(data, json, xhr) { $(document).delegate('#login-form', 'ajax:success', function(data, json, xhr) {
if(json.success) { if(json.success) {
$('.message.submission-error').removeClass('is-shown');
var u=decodeURI(window.location.search); var u=decodeURI(window.location.search);
next=u.split("next=")[1] next=u.split("next=")[1]
if (next) { if (next) {
...@@ -42,7 +43,10 @@ ...@@ -42,7 +43,10 @@
} else { } else {
location.href="${reverse('dashboard')}"; location.href="${reverse('dashboard')}";
} }
} } else {
$('.message.submission-error').addClass('is-shown');
$('.message.submission-error .message-copy').html(json.value);
}
}); });
})(this) })(this)
</script> </script>
......
...@@ -61,21 +61,7 @@ ...@@ -61,21 +61,7 @@
<div role="alert" class="status message submission-error"> <div role="alert" class="status message submission-error">
<h3 class="message-title">The following errors occured while processing your registration: </h3> <h3 class="message-title">The following errors occured while processing your registration: </h3>
<ul class="message-copy"> <ul class="message-copy"> </ul>
<li>You must accept the terms of service.</li>
<li>You must accept the terms of service.</li>
<li>Your username must be a minimum of 2 characters long (e.g. "edx").</li>
</ul>
</div>
<div role="alert" class="status message submission-error">
<h3 class="message-title">The following errors occured while processing your registration: </h3>
<p class="message-copy">To enroll, you must follow the honor code</p>
</div>
<div role="alert" class="status message system-error">
<h3 class="message-title">We're sorry, our systems seem to be having trouble processing your registration</h3>
<p class="message-copy">Someone has been made aware of this issue. Please try again shortly. Please <a href="">contact us</a> about any concerns you have.</p>
</div> </div>
<p class="instructions"> <p class="instructions">
...@@ -242,8 +228,9 @@ ...@@ -242,8 +228,9 @@
if(json.success) { if(json.success) {
location.href="${reverse('dashboard')}"; location.href="${reverse('dashboard')}";
} else { } else {
$('.status.message.submission-error').addClass('is-shown');
$('.status.message.submission-error .message-copy').html(json.value).stop().css("display", "block");
$(".field-error").removeClass('field-error'); $(".field-error").removeClass('field-error');
$('#register_error').html(json.value).stop().css("display", "block");
$("[data-field='"+json.field+"']").addClass('field-error') $("[data-field='"+json.field+"']").addClass('field-error')
} }
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment