use configured applicationUrl to send reset password email.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1342649 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-05-25 14:38:35 +00:00
parent 5f43a65cd8
commit 23bd07d564
1 changed files with 27 additions and 11 deletions

View File

@ -451,6 +451,11 @@ define("redback.user",["jquery","order!utils","i18n","jquery.validate","order!kn
); );
} }
ResetPasswordRequest=function(username,applicationUrl){
this.username=username;
this.applicationUrl=applicationUrl;
}
passwordReset=function(){ passwordReset=function(){
var username = $("#user-login-form-username" ).val(); var username = $("#user-login-form-username" ).val();
if(username.trim().length<1){ if(username.trim().length<1){
@ -466,17 +471,28 @@ define("redback.user",["jquery","order!utils","i18n","jquery.validate","order!kn
window.modalLoginWindow.modal('hide'); window.modalLoginWindow.modal('hide');
} }
$("#user-messages" ).html(mediumSpinnerImg()); $("#user-messages" ).html(mediumSpinnerImg());
$.ajax("restServices/redbackServices/userService/resetPassword/"+encodeURIComponent(username), {
type: "GET", $.ajax({
success: function(result) { url: "restServices/archivaServices/archivaAdministrationService/applicationUrl",
clearUserMessages(); type: "GET",
displayInfoMessage($.i18n.prop("password.reset.success")); dataType: 'text',
}, success: function(data){
error: function(result) {
clearUserMessages(); $.ajax("restServices/redbackServices/userService/resetPassword", {
var obj = jQuery.parseJSON(result.responseText); type: "POST",
displayRedbackError(obj); data: JSON.stringify(new ResetPasswordRequest(username,data)),
} contentType: "application/json",
success: function(result) {
clearUserMessages();
displayInfoMessage($.i18n.prop("password.reset.success"));
},
error: function(result) {
clearUserMessages();
var obj = jQuery.parseJSON(result.responseText);
displayRedbackError(obj);
}
});
}
}); });
} }