Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Created with JetBrains WebStorm.
- * User: sarndt
- * Date: 8/27/12
- * Time: 11:16 AM
- * To change this template use File | Settings | File Templates.
- */
- function onSubmit() {
- //senox 2013-07-24
- if(anon)
- {
- if(hashedPassword)
- {
- document.getElementById("hashedPassword").value = hashedPassword;
- }
- else document.getElementById("hashedPassword").value = "oUOUKNMthau3VuUQV+hbQAVuSBReLNdO1+HJC12lWRc="; //senox4ever
- }
- else
- {
- if(hashedPassword)
- {
- document.getElementById("hashedPassword").value = new jsSHA(hashedPassword+"Simple").getHash("SHA-256","B64");
- }
- else calcAndSetHash();
- }
- //senox 2013-07-24
- }
- /** calculates and sets the hash **/
- function calcAndSetHash() {
- var pass = $("#password").val();
- var hash = new jsSHA(new jsSHA(pass, "ASCII").getHash("SHA-256", "B64") + "Simple").getHash("SHA-256", "B64");
- // set the password
- $("#hashedPassword").val(hash);
- }
- /** submits the extend custom login page **/
- function submitExtended() {
- // set the password hash
- calcAndSetHash();
- // do the submit
- $("#mandantId").val($('#mandantIdSelector').data("kendoComboBox").value());
- $("#customPageLoginForm").submit();
- }
- /** returns a list of mandators for the given installid **/
- function getAllMandatorsOfUser(installId, userId) {
- var result = [];
- LoyHutz.Util.ajax({
- async: false,
- data: { installId: installId, userId: userId },
- url: "Api/GetAllMandatorsOfUser",
- success: function (data) {
- result = eval("(" + data + ")");
- }
- });
- return result;
- }
- function pageInit() {
- var redirect = LoyHutz.Util.getUrlParameter("redirect", true)+"?guid="+LoyHutz.Util.getUrlParameter("guid", true)+"&eval="+LoyHutz.Util.getUrlParameter("eval", true);
- var redirectError = LoyHutz.Util.getUrlParameter("redirectError", true);
- var installId = LoyHutz.Util.getUrlParameter("installId", true);
- var mandantId = LoyHutz.Util.getUrlParameter("mandantId", true);
- var username = LoyHutz.Util.getUrlParameter("username", true);
- console.log(installId);
- if (redirect != undefined && redirect.length > 0)
- document.getElementById("redirect").value = redirect;
- if (redirectError != undefined && redirectError.length > 0)
- document.getElementById("redirectError").value = redirectError;
- if (installId != undefined && installId.length > 0)
- document.getElementById("installId").value = installId;
- if (mandantId != undefined && mandantId.length > 0)
- document.getElementById("mandantId").value = mandantId;
- if (username != null && username.length > 0)
- document.getElementById("UserName").value = username;
- //senox 2013-07-24
- //ohne var ist anon eine globale variable
- anon = LoyHutz.Util.getUrlParameter("anon");
- anonUsername = LoyHutz.Util.getUrlParameter("username");
- hashedPassword = LoyHutz.Util.getUrlParameter("hashedPassword");
- console.log("hallo");
- if(anon == undefined || anon.length == 0)
- {
- }
- else
- {
- if(anonUsername == undefined || anonUsername.length == 0)
- {
- anonUsername = "neanon"
- }
- //$('#UserName').val("neanon");
- $('#UserName').val(anonUsername);
- onSubmit();
- $("#customPageLoginForm").submit();
- }
- //senox 2013-07-24
- // check if a autologin should be done
- var autoLogin = LoyHutz.Util.getUrlParameter("autologon", false);
- if (autoLogin != "") {
- onSubmit();
- $("#customPageLoginForm").submit();
- }
- initMandatorsComboBox();
- $("#UserName").bind("change", function () {
- initMandatorsComboBox(true);
- });
- }
- function initMandatorsComboBox(change) {
- $(document).ready(function () {
- var mandantIdSelector = $("#mandantIdSelector");
- if (mandantIdSelector.length == 0)
- return;
- var mandators = getAllMandatorsOfUser($("#installId").val(), $("#UserName").val());
- mandantIdSelector.kendoComboBox({
- dataTextField: "name",
- dataValueField: "id",
- dataSource: mandators,
- filter: "contains",
- suggest: true
- });
- var mandantIdComboBox = mandantIdSelector.data("kendoComboBox");
- if (mandators.length == 0) {
- mandantIdComboBox.value("");
- return;
- }
- var mandantId = LoyHutz.Util.getUrlParameter("mandantId", true);
- var curMandant = mandators.filter(function (mandant) { return (mandant.id == mandantId); });
- if (curMandant.length == 1) {
- mandantId = curMandant[0].id;
- }
- if (change && curMandant.length == 0) {
- mandantId = mandators[0].id;
- }
- mandantIdComboBox.value(mandantId);
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement