aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2016-06-24 11:43:52 +0200
committerJulien Lancelot <julien.lancelot@sonarsource.com>2016-06-29 08:39:32 +0200
commitcd8f9c0a390181fb1bf25a6e9e3bab509dd7ebc7 (patch)
treea418e068592b7c2952c9b07daaa5516ad3dfb100
parent9db7bb73afd9c35758ca7b66bc5b8ee8dfbfc073 (diff)
downloadsonarqube-cd8f9c0a390181fb1bf25a6e9e3bab509dd7ebc7.tar.gz
sonarqube-cd8f9c0a390181fb1bf25a6e9e3bab509dd7ebc7.zip
SONAR-7761 improve submitting of login form
-rw-r--r--server/sonar-web/src/main/js/libs/application.js4
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/sessions/_form.html.erb22
2 files changed, 15 insertions, 11 deletions
diff --git a/server/sonar-web/src/main/js/libs/application.js b/server/sonar-web/src/main/js/libs/application.js
index 43a1492ca2d..95e2b9685d5 100644
--- a/server/sonar-web/src/main/js/libs/application.js
+++ b/server/sonar-web/src/main/js/libs/application.js
@@ -187,7 +187,7 @@ function openModalWindow (url, options) {
return this.each(function () {
var obj = jQuery(this);
obj.submit(function () {
- jQuery('input[type=submit]', this).attr('disabled', 'disabled');
+ jQuery('input[type=submit], button', this).attr('disabled', 'disabled');
jQuery.ajax(jQuery.extend({
type: 'POST',
url: obj.attr('action'),
@@ -202,7 +202,7 @@ function openModalWindow (url, options) {
// Hide all loading images
jQuery('.loading-image').addClass('hidden');
// Re activate submit button
- jQuery('input[type=submit]', obj).removeAttr('disabled');
+ jQuery('input[type=submit], button', obj).removeAttr('disabled');
errorElt.show();
errorElt.html(jQuery('<div/>').html(xhr.responseText).text());
} else {
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/sessions/_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/sessions/_form.html.erb
index 26a6e7378dc..4495fffa997 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/sessions/_form.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/sessions/_form.html.erb
@@ -56,14 +56,18 @@
if (!returnToAnchor.val()) {
returnToAnchor.val(window.location.hash);
}
- })(window.jQuery);
- $j("#login_form").modalForm({
- success: function () {
- window.location = '<%= ApplicationController.root_context + h(@return_to) -%>' + $j('[name="return_to_anchor"]').val();
- },
- error: function () {
- jQuery('.alert').removeClass('hidden');
- }
- });
+ $("#login_form").modalForm({
+ success: function () {
+ window.location = '<%= h(@return_to) -%>' + $('[name="return_to_anchor"]').val();
+ },
+ error: function () {
+ $('.alert').removeClass('hidden');
+ $('button').prop('disabled', false);
+ },
+ statusCode: {
+ 401: null
+ }
+ });
+ })(window.jQuery);
</script>