]> source.dussan.org Git - archiva.git/commitdiff
use configured applicationUrl to send reset password email.
authorOlivier Lamy <olamy@apache.org>
Fri, 25 May 2012 14:38:35 +0000 (14:38 +0000)
committerOlivier Lamy <olamy@apache.org>
Fri, 25 May 2012 14:38:35 +0000 (14:38 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1342649 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js

index 9531b438ca0407fec6424fce77c1fe8ae1b5fab2..635b76e274f4973cd3a016ad7ac9bbb41b9055e9 100644 (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(){
     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);
+            }
+          });
+        }
     });
   }