[MRM-1617] reset password link

form and rest call done.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1300943 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-03-15 12:00:51 +00:00
parent 57fd4eae4d
commit 7fd8be158e
1 changed files with 37 additions and 1 deletions

View File

@ -333,11 +333,19 @@ $(function() {
customShowError("#user-login-form",validator,errorMap,errorMap);
}
});
$("#modal-login").delegate("#modal-login-ok", "click keydown keypress", function(e) {
$("#modal-login-ok").on("click", function(e) {
e.preventDefault();
login();
});
$("#modal-login-password-reset").on("click", function(e) {
e.preventDefault();
$.log("password reset");
passwordReset();
});
}
/**
@ -402,6 +410,34 @@ $(function() {
$("#small-spinner").remove();
}
passwordReset=function(){
var username = $("#user-login-form-username" ).val();
if(username.trim().length<1){
var errorList=[{
message: $.i18n.prop("username.cannot.be.empty"),
element: $("#user-login-form-username").get(0)
}];
customShowError("#user-login-form", null, null, errorList);
return;
}
if (window.modalLoginWindow){
window.modalLoginWindow.modal('hide');
}
$("#user-messages" ).html(mediumSpinnerImg());
$.ajax("restServices/redbackServices/userService/resetPassword/"+encodeURIComponent(username), {
type: "GET",
success: function(result) {
clearUserMessages();
displaySuccessMessage( $.i18n.prop("password.reset.success"));
},
error: function(result) {
var obj = jQuery.parseJSON(result.responseText);
displayRedbackError(obj);
}
});
}
/**
* validate login box before ajax call
*/