diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js index 4f2c10c69..688bbd949 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js @@ -309,8 +309,7 @@ define("utils",["jquery","i18n","jquery.tmpl"], function() { * @param errorList */ customShowError=function(selector, validator, errorMap, errorList) { - $(selector).find("div.control-group" ).removeClass( "error" ); - $(selector).find("span.help-inline").remove(); + removeValidationErrorMessages(selector); for ( var i = 0; errorList[i]; i++ ) { var error = errorList[i]; var field = $(selector).find("#"+error.element.id); @@ -319,6 +318,11 @@ define("utils",["jquery","i18n","jquery.tmpl"], function() { } } + removeValidationErrorMessages=function(selector){ + $(selector).find("div.control-group" ).removeClass( "error" ); + $(selector).find("span.help-inline").remove(); + } + appendArchivaVersion=function(){ return "_archivaVersion="+window.archivaRuntimeInfo.version; } diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js index 635b76e27..c3137a1f9 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js @@ -326,12 +326,19 @@ define("redback.user",["jquery","order!utils","i18n","jquery.validate","order!kn } if (window.modalLoginWindow==null) { window.modalLoginWindow = $("#modal-login").modal(); - window.modalLoginWindow.bind('hidden', function () { - $("#modal-login-err-message").hide(); + window.modalLoginWindow.on('hidden', function () { + $("#modal-login-err-message").html(""); + removeValidationErrorMessages("#user-login-form"); + }); + // focus on user name + window.modalLoginWindow.on('shown', function (e) { + $("#user-login-form-username" ).focus(); }) } - $("#user-login-form").validate({ + var userLoginForm = $("#user-login-form"); + + userLoginForm.validate({ showErrors: function(validator, errorMap, errorList) { customShowError("#user-login-form",validator,errorMap,errorMap); } @@ -347,10 +354,9 @@ define("redback.user",["jquery","order!utils","i18n","jquery.validate","order!kn passwordReset(); }); - - } + /** * callback success function on rest login call. * modal close and hide/show some links (login,logout,register...)