[MRM-1674] While creating admin account, entering invalid password yields no error message.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1389629 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-09-24 22:19:58 +00:00
parent 1586580512
commit 28934df4ac
3 changed files with 20 additions and 6 deletions

View File

@ -37,11 +37,12 @@ function() {
displayErrorMessage($.i18n.prop('authz.karma.needed'));
},
500: function(data){
$.log("error 500:"+data.responseText);
removeSmallSpinnerImg();
removeMediumSpinnerImg("#main-content");
clearUserMessages();
displayRestError($.parseJSON(data.responseText));
$("#main-content" ).html("");
//$("#main-content" ).html("");
//displayErrorMessage($.i18n.prop('error.500'));
}
}

View File

@ -312,6 +312,10 @@ require(["jquery","jquery.tmpl","i18n"], function(jquery,jqueryTmpl,i18n) {
if (data.errorKey && data.errorKey.length>0){
displayErrorMessage($.i18n.prop( data.errorKey ),idToAppend);
} else if (data.errorMessages){
$.each(data.errorMessages, function(index, value) {
displayErrorMessage( $.i18n.prop(data.errorMessages[index].errorKey,data.errorMessages[index].args?data.errorMessages[index].args:null));
});
} else {
$.log("print data.errorMessage:"+data.errorMessage);
displayErrorMessage(data.errorMessage,idToAppend);

View File

@ -117,7 +117,7 @@ define("redback.user",["jquery","utils","i18n","jquery.validate","knockout","kno
});
};
this.createAdmin = function() {
this.createAdmin = function(succesCallbackFn,errorCallbackFn) {
$.log("user.js#createAdmin");
var valid = $("#user-create").valid();
$.log("create admin");
@ -142,10 +142,18 @@ define("redback.user",["jquery","utils","i18n","jquery.validate","knockout","kno
checkSecurityLinks();
}
loginCall(currentAdminUser.username(), currentAdminUser.password(),onSuccessCall);
if(succesCallbackFn){
succesCallbackFn();
}
return this;
} else {
displayErrorMessage("admin user not created");
}
},
error: function(data){
if(errorCallbackFn){
errorCallbackFn();
}
}
});
};
@ -261,10 +269,11 @@ define("redback.user",["jquery","utils","i18n","jquery.validate","knockout","kno
if(! $("#user-create" ).valid() ) {
return;
}
self.user.createAdmin();
// go to search when admin created
window.sammyArchivaApplication.setLocation("#search");
self.user.createAdmin(function(){
// go to search when admin created
window.sammyArchivaApplication.setLocation("#search");
}
);
}
}