ChangeSecurityQuestionDialogCtrl.js revision 2d7019e19039fd083850f76e54b6b26a7b06a8f2
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright © 2011 ForgeRock AS. All rights reserved.
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*/
/*global $, define*/
"app/util/Validators"],
function(changeSecurityQuestionDialogView, userDelegate, messagesCtrl, Validator, Condition, validators) {
obj.validators = [];
obj.profileCtrl = null;
});
});
};
enableSaveButton = function() {
return false;
});
};
disableSaveButton = function() {
};
$.ajax({
type : "GET",
url : "data/secquestions.json",
dataType : "json",
},
}
});
};
};
obj.registerValidators = function() {
obj.validators[0] = new Validator([obj.view.getAnswer()], [new Condition('not-empty', validators.notEmptyValidator)], 'change', 'simple', obj.validateForm);
obj.validators[1] = new Validator([obj.view.getQuestion()], [new Condition('not-empty', validators.notEmptyValidator)], 'change', 'simple', obj.validateForm);
obj.validators[2] = new Validator([obj.view.getPassword()], [new Condition('correctPassword', function(input) {
return "Invalid password";
}
};
obj.validateForm = function() {
var i, allOk = true;
allOk = false;
break;
}
}
if (allOk) {
} else if (!allOk) {
}
return allOk;
};
// TODO not in use anymore
// obj.afterSaveButtonClicked = function() {
// for (k = 0; k < obj.validators.length; k++) {
// obj.validators[k].validate();
// }
// var flds = new Array("securityquestion","securityanswer");
// var vals = new Array(obj.view.getQuestion().val(), obj.view.getAnswer().val());
// if (obj.validateForm() == true) {
// obj.delegate.changeFields(obj.user, flds, vals,
// function(r) {
// obj.messages.displayMessage('info','Security question has been changed');
// //updating in profile
// obj.profileCtrl.getUser().securityquestion = obj.view.getQuestion().val();
// obj.profileCtrl.getUser().securityanswer = obj.view.getAnswer().val();
// obj.view.close();
// }, function(r) {
// obj.messages.displayMessage('error', 'Unknown error');
// obj.view.close();
// });
// }
// }
return obj;
});