do not log the user when reseting password

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1301144 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-03-15 18:57:02 +00:00
parent 69c540f321
commit cd25a9c99f
2 changed files with 42 additions and 11 deletions

View File

@ -50,6 +50,6 @@
</form> </form>
</div> </div>
<div class="modal-footer" id="modal-password-change-footer"> <div class="modal-footer" id="modal-password-change-footer">
<button class="btn primary" onclick="return" id="modal-change-password-ok">${$.i18n.prop('register')}</button> <button class="btn btn-primary" onclick="return" id="modal-change-password-ok">${$.i18n.prop('ok')}</button>
</div> </div>
</div> </div>

View File

@ -412,9 +412,40 @@ $(function() {
resetPasswordForm=function(key){ resetPasswordForm=function(key){
$.log("resetPasswordForm:"+key); $.log("resetPasswordForm:"+key);
validateKey(key,false); changePasswordBox(null,false,null,function(){
$.log("resetPasswordForm#validateKey ok"); $.log("ok chgt pwd")
//displaySearch(); $.log("user.js#changePassword");
var valid = $("#password-change-form").valid();
if (valid==false) {
return;
}
var url = 'restServices/redbackServices/passwordService/changePasswordWithKey?';
url += "password="+$("#passwordChangeFormNewPassword").val();
url += "&passwordConfirmation="+$("#passwordChangeFormNewPasswordConfirm").val();
url += "&key="+key;
$.log("url:"+url);
$.ajax({
url: url,
success: function(result){
$.log("changePassword#success result:"+result);
var user = mapUser(result);
if (user) {
window.modalChangePasswordBox.modal('hide');
displaySuccessMessage($.i18n.prop('change.password.success.section.title'));
} else {
displayErrorMessage("issue appended");
}
window.modalChangePasswordBox.modal('hide');
},
error: function(result) {
var obj = jQuery.parseJSON(result.responseText);
displayRedbackError(obj,"modal-password-change-content");
}
});
}
);
} }
passwordReset=function(){ passwordReset=function(){
@ -496,7 +527,7 @@ $(function() {
* @param previousPassword display and validate previous password text field * @param previousPassword display and validate previous password text field
* @param registration are we in registration mode ? * @param registration are we in registration mode ?
*/ */
changePasswordBox=function(previousPassword,registration,user){ changePasswordBox=function(previousPassword,registration,user,okFn){
screenChange(); screenChange();
$.log("changePasswordBox previousPassword:"+previousPassword+",registration:"+registration+",user:"+user); $.log("changePasswordBox previousPassword:"+previousPassword+",registration:"+registration+",user:"+user);
if (previousPassword==true){ if (previousPassword==true){
@ -513,7 +544,11 @@ $(function() {
}) })
$("#modal-password-change").delegate("#modal-change-password-ok", "click keydown keypress", function(e) { $("#modal-password-change").delegate("#modal-change-password-ok", "click keydown keypress", function(e) {
e.preventDefault(); e.preventDefault();
changePassword(previousPassword,registration,user); if ( $.isFunction(okFn)){
okFn();
} else {
changePassword(previousPassword,registration,user);
}
}); });
} }
window.modalChangePasswordBox.modal('show'); window.modalChangePasswordBox.modal('show');
@ -649,8 +684,8 @@ $(function() {
var user = mapUser(result); var user = mapUser(result);
if (user) { if (user) {
window.modalChangePasswordBox.modal('hide'); window.modalChangePasswordBox.modal('hide');
$.log("changePassword#sucess,registration:"+registration);
if (registration==true) { if (registration==true) {
$.log("changePassword#sucess,registration:"+registration);
displaySuccessMessage($.i18n.prop('change.password.success.section.title')) displaySuccessMessage($.i18n.prop('change.password.success.section.title'))
loginCall(user.username(), $("#passwordChangeFormNewPassword").val(),successLoginCallbackFn); loginCall(user.username(), $("#passwordChangeFormNewPassword").val(),successLoginCallbackFn);
} else { } else {
@ -659,10 +694,6 @@ $(function() {
} else { } else {
displayErrorMessage("issue appended"); displayErrorMessage("issue appended");
} }
},
complete: function(){
$("#small-spinner").remove();
window.modalChangePasswordBox.modal('hide'); window.modalChangePasswordBox.modal('hide');
}, },
error: function(result) { error: function(result) {