SecurityDialogCtrl.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(securityDialogView, userDelegate, messagesCtrl, Validator, Condition, AbstractDialogController, validators) {
obj.passwordValidators = [];
obj.passwordIsOk = false;
obj.passwordEmpty = true;
obj.questionValidators = [];
obj.questionIsOk = false;
obj.questionEmpty = true;
//TODO clear sensitive data after dialog close
obj.oldPassword = null;
obj.passwordValidators = [];
obj.passwordIsOk = false;
obj.passwordEmpty = true;
obj.questionValidators = [];
obj.questionEmpty = true;
obj.questionIsOk = false;
} else {
}
});
});
};
obj.getOldPassword = function() {
return obj.oldPassword;
};
obj.registerPasswordValidators = function() {
});
});
function(inputs) {
return "Passwords have to be equal.";
}
return "At least 8 characters length";
}
var reg = /[(A-Z)]+/;
return "At lest one capital letter";
}
return "At lest one number";
}
return "Not equal old password";
}
return "Not equal username";
}
} else {
return "At least 8 characters length";
}
var reg = /[(A-Z)]+/;
return "At lest one capital letter";
}
return "At lest one number";
}
return "Not equal username";
}
}
};
obj.passwordEmptyValidator = function() {
obj.passwordIsOk = false;
obj.passwordEmpty = true;
if( obj.questionIsOk === true) {
}
}
};
obj.questionEmptyValidator = function() {
obj.questionIsOk = false;
obj.passwordEmpty = true;
if( obj.passwordIsOk === true ) {
}
}
};
obj.registerSecurityValidators = function() {
obj.questionValidators[0] = new Validator([obj.view.getAnswer()], [new Condition('not-empty', validators.notEmptyValidator)],
obj.questionValidators[1] = new Validator([obj.view.getQuestion()], [new Condition('not-empty', validators.notEmptyValidator)],
};
$.ajax({
type : "GET",
url : "data/secquestions.json",
dataType : "json",
},
}
});
};
obj.validatePasswordForm = function() {
var i, allOk = true;
allOk = false;
break;
}
}
if (allOk) {
}
obj.passwordIsOk = true;
} else if (!allOk) {
obj.passwordIsOk = false;
}
return allOk;
};
obj.validateQuestionForm = function() {
var i, allOk = true;
allOk = false;
break;
}
}
if (allOk) {
}
obj.questionIsOk = true;
} else if (!allOk) {
obj.questionIsOk = false;
}
return allOk;
};
obj.afterSaveButtonClicked = function() {
if(obj.questionIsOk === true) {
patchDefinitionObject.push({replace: "securityanswer", value: obj.view.getAnswer().val().toLowerCase()});
}
if(obj.passwordIsOk === true) {
}
if(obj.questionIsOk === true) {
}
if(obj.passwordIsOk === true) {
}
}, function(r) {
});
}
};
return obj;
});