* @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);
}
}
+ removeValidationErrorMessages=function(selector){
+ $(selector).find("div.control-group" ).removeClass( "error" );
+ $(selector).find("span.help-inline").remove();
+ }
+
appendArchivaVersion=function(){
return "_archivaVersion="+window.archivaRuntimeInfo.version;
}
}
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);
}
passwordReset();
});
-
-
}
+
/**
* callback success function on rest login call.
* modal close and hide/show some links (login,logout,register...)