[MRM-1617] reset password link

display change password box after key validation.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1300944 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-03-15 12:01:07 +00:00
parent 7fd8be158e
commit 2eb122127b
3 changed files with 25 additions and 12 deletions

View File

@ -70,6 +70,11 @@ $(function() {
validateKey(validateMeId); validateKey(validateMeId);
return; return;
} }
var resetPassword= $.urlParam('resetPassword');
if (resetPassword){
resetPasswordForm(resetPassword);
return;
}
var browse = $.urlParam('browse'); var browse = $.urlParam('browse');
if (browse){ if (browse){

View File

@ -96,7 +96,7 @@ $(function() {
* validate a registration key and go to change password key * validate a registration key and go to change password key
* @param key * @param key
*/ */
validateKey=function(key) { validateKey=function(key,registration) {
// FIXME spinner display // FIXME spinner display
$.ajax({ $.ajax({
url: 'restServices/redbackServices/userService/validateKey/'+key, url: 'restServices/redbackServices/userService/validateKey/'+key,
@ -104,7 +104,7 @@ $(function() {
success: function(result){ success: function(result){
window.redbackModel.key=key; window.redbackModel.key=key;
$.log("validateKey#sucess"); $.log("validateKey#sucess");
changePasswordBox(false,true,null); changePasswordBox(false,registration?registration:true,null);
}, },
complete: function(){ complete: function(){
// hide spinner // hide spinner

View File

@ -410,6 +410,13 @@ $(function() {
$("#small-spinner").remove(); $("#small-spinner").remove();
} }
resetPasswordForm=function(key){
$.log("resetPasswordForm:"+key);
validateKey(key,false);
$.log("resetPasswordForm#validateKey ok");
displaySearch();
}
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){
@ -426,16 +433,17 @@ $(function() {
} }
$("#user-messages" ).html(mediumSpinnerImg()); $("#user-messages" ).html(mediumSpinnerImg());
$.ajax("restServices/redbackServices/userService/resetPassword/"+encodeURIComponent(username), { $.ajax("restServices/redbackServices/userService/resetPassword/"+encodeURIComponent(username), {
type: "GET", type: "GET",
success: function(result) { success: function(result) {
clearUserMessages(); clearUserMessages();
displaySuccessMessage( $.i18n.prop("password.reset.success")); displayInfoMessage($.i18n.prop("password.reset.success"));
}, },
error: function(result) { error: function(result) {
var obj = jQuery.parseJSON(result.responseText); clearUserMessages();
displayRedbackError(obj); var obj = jQuery.parseJSON(result.responseText);
} displayRedbackError(obj);
}); }
});
} }
/** /**