From 23bd07d564f18ce27beea333c0328141b104dec7 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Fri, 25 May 2012 14:38:35 +0000 Subject: 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 --- .../src/main/webapp/js/redback/user.js | 38 +++++++++++++++------- 1 file changed, 27 insertions(+), 11 deletions(-) (limited to 'archiva-modules/archiva-web') 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 9531b438c..635b76e27 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 @@ -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(){ var username = $("#user-login-form-username" ).val(); if(username.trim().length<1){ @@ -466,17 +471,28 @@ define("redback.user",["jquery","order!utils","i18n","jquery.validate","order!kn window.modalLoginWindow.modal('hide'); } $("#user-messages" ).html(mediumSpinnerImg()); - $.ajax("restServices/redbackServices/userService/resetPassword/"+encodeURIComponent(username), { - type: "GET", - success: function(result) { - clearUserMessages(); - displayInfoMessage($.i18n.prop("password.reset.success")); - }, - error: function(result) { - clearUserMessages(); - var obj = jQuery.parseJSON(result.responseText); - displayRedbackError(obj); - } + + $.ajax({ + url: "restServices/archivaServices/archivaAdministrationService/applicationUrl", + type: "GET", + dataType: 'text', + success: function(data){ + + $.ajax("restServices/redbackServices/userService/resetPassword", { + type: "POST", + 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); + } + }); + } }); } -- cgit v1.2.3