Files
Fuchs_Intranet/Fuchs/wwwroot/web/fisb.min.js
T
StefanandClaude Opus 5.5 4443bba63c
Playwright Tests / test (push) Canceled after 0s
fix(forms): never submit an invalid form; unlock password-change dialog
serializeObject() returns null for an invalid form, but most callers sent
the result anyway. Add $.fn.rejectInvalid (stop the spinner, let the
browser report the offending field) and use it at every call site.

Bugs fixed:
- Password change: on a mismatch the spinner kept running, and the custom
  validity on "npw" was never cleared, so the browser blocked every later
  submit even after the passwords matched. It is now cleared as soon as
  either password field is edited.
- sendForm: options.complete referenced an undefined jqXHR (ReferenceError)
  and an invalid form was posted with partial data.
- login.send: an invalid form threw a TypeError on qs.loginaccount.
- postXT({ form }): an invalid form was posted with empty data.
- Form dialogs without required fields had no "Bitte überprüfen Sie Ihre
  Eingaben" note, so a rejected submit showed nothing.

Hardening: null guards for the user, user-group, re-login, SMS password,
admin specialties and report-parameter submits.

Add e2e_tests/form-validation.cjs covering each path against the real
scripts; it fails on the previous code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 18:11:05 +02:00

1 line
22 KiB
JavaScript

var $t={lng:"de-DE",dn:["So","Mo","Di","Mi","Do","Fr","Sa"],mn:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],ma:["Jan","Feb","Mrz","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],datepattern:"(0[1-9]|1[0-9]|2[0-9]|3[01]).(0[1-9]|1[012]).[0-9]{4}",datetimepattern:"(0[1-9]|1[0-9]|2[0-9]|3[01]).(0[1-9]|1[012]).[0-9]{4}\\s([0-5][0-9]):([0-5][0-9])",dateplaceholder:"dd.MM.yyyy",datetimeplaceholder:"dd.MM.yyyy HH:mm",dateformat:"dd.MM.yyyy",datetimeformat:"dd.MM.yyyy HH:mm",f1:"Der Server hat einen Fehler gemeldet: \n",f2:"Bitte versuchen Sie es erneut.",m0:"Diese Internet-Seite benötigt einen html5-kompatiblen Browser.",m0b:"Unterstützt werden bspw: Internet Explorer ab Version 10, Firefox ab Version 31, Chrome ab Version 31, Safari ab Version 7, Opera ab Version 27",m1:"Dieser Datensatz ist momentan von jemand anderem zur Bearbeitung gesperrt.",m2:"Diese Funktion ist zur Zeit nicht verfügbar",t1:"Eingabe erforderlich.",t2:"Eingabe ist nicht erforderlich.",true:"Ja",false:"Nein",alert:"Hinweis",confirm:"Bestätigen",open:"Öffnen","not implemented":"Diese Funktion in zur Zeit noch nicht verfügbar.",l0:"Anmeldung",l1:"Email / Anmeldename",l2:"Email-Adresse / Anmeldename",l3:"Passwort",l4:"Benutzer",l5:"Wird vom System ermittelt...",l6:"Anmelden",l7:"Passwort vergessen?",l7a:'Die "Passwort vergessen"-Funktion läuft in zwei Schritten ab:\n \nIm ersten Schritt wird eine SMS mit einem Code an die hinterlegte Mobilfunk-Nummer versandt.\nIm zweiten Schritt geben Sie bitte diesen Code in das Formular ein und übermitteln es erneut.\n \nIn beiden Schritten wird aus Sicherheitsgründen kein Fehler angezeigt und auch dann ein erfolgreicher Versand bestätigt, wenn die Kombination aus Email-Adresse und Nachname nicht gefunden wurde und/oder der code falsch ist.',l8:"Keinen Account?",l9:"Anmeldenamen der Email-Adresse wurde nicht erkannt.",l10:"Nachname",l11:"Email-Adresse",l12:"Passwort zusenden",l13:"Das Passwort wurde erfolgreich verschickt",l14:"Das Passwort konnte nicht verschickt werden",l15:"Sie sind nicht berechtigt, diese Funktion auszuführen.",l16:"Sie müssen zunächst einen Account angeben.",l17:"Die Kombination aus Anmeldenamen und Passwort konnte nicht bestätigt werden.",l18:"Es gibt ein Problem mit dem Formular.\nEs kann momentan nicht verarbeitet und versendet werden.",name:"Name",submit:"Senden",cancel:"Abbrechen",noop:"Diese Funktion is noch nicht verfügar."};const isIE=/MSIE\/|Trident/gi.test(window.navigator.userAgent)||void 0!==window.document.documentMode,isfileapi=!!(window.File&&window.FileReader&&window.FileList&&window.Blob);var $ocms={auth:{},no:function(e){e.stopPropagation()},vmin:function(e){var t=$(window).width*(e||1),n=$(window).height*(e||1);return t<n?t:n},rpx:function(e){return e*parseFloat(getComputedStyle(document.documentElement).fontSize)},pattern:{date_ger:"^(0?[1-9]|[12][0-9]|3[01])[\\.\\-](0?[1-9]|1[012])[\\.\\-]\\d{4}$",date_us:"^(0?[1-9]|1[012])[\\\\](0?[1-9]|[12][0-9]|3[01])[\\\\]\\d{4}$",date_serial:"\\d{4}[\\-]^(0?[1-9]|1[012])[\\-](0?[1-9]|[12][0-9]|3[01])$"},rdm:function(e){var t="number"==typeof e?e:"string"==typeof e?parseInt(e):7;return!0!==isNaN(t)&&void 0!==t||(t=7),Math.random().toString(36).substring(t)},login:{},t:{dn:["So","Mo","Di","Mi","Do","Fr","Sa"],mn:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],ma:["Jan","Feb","Mrz","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"]},failure:function(e){alert($t.f1+"\n"+(e.internalText||""))},baseurl:"/do",url:e=>($ocms.baseurl+"/"+(e||"")).replace(/\/\//,"/"),cexi:null};function deepCopy(e){var t,n,i;if("object"!=typeof e||null===e)return e;for(i in t=Array.isArray(e)?[]:{},e)n=e[i],t[i]=deepCopy(n);return t}function fields_definition(e,t,n){this.label_sng=!0===Array.isArray(e)?"":e||"",this.label_pl=!0===Array.isArray(e)?"":t||"",this.fields=!0===Array.isArray(e)?e:n||[],this.itm=function(e){for(var t=0;t<this.fields.length;t++)if(this.fields[t].name===e)return this.fields[t];return null},this.lbl=function(e){for(var t={},n="string"==typeof e,i=0;i<this.fields.length;i++)if(!0===n){if(this.fields[i].name===e)return this.fields[i]}else t[this.fields[i].name]=this.fields[i].label;return!0===n?null:t},this.contains=function(e){for(var t=0;t<this.fields.length;t++)if(this.fields[t].name===e)return!0;return!1},this.rem=function(e){var t=!1,n=function(e){for(var n=0;n<this.fields.length;n++)if(this.fields[n].name===e){this.fields.splice(n,1),t=!0;break}};if("string"==typeof e)n.call(this,e);else if(!0===Array.isArray(e))for(var i=0;i<e.length;i++)n.call(this,e[i]);return t},this.replace=function(e,t){for(var n=0;n<this.fields.length;n++)if(this.fields[n].name===e)return this.fields.splice(n,1,t),t;return null},this.set=function(e,t,n){n=n||"value";for(var i=0;i<this.fields.length;i++)if(this.fields[i].name===e)return this.fields[i][n]=t,this.fields[i];return null},this.sets=function(e,t){if("object"==typeof t&&Object.keys(t).length>0)for(var n=0;n<this.fields.length;n++)if(this.fields[n].name===e)return $.extend(this.fields[n],t),this.fields[n];return null},this.applyValues=function(e){var t=this;return $.each(e||{},(function(e,n){t.set(e,n)})),t},this.clone=function(e){let t=[];if(Array.isArray(e||"")){let n,i;for(i in this.fields||[])n=this.fields[i],""!==(n.name||"")&&!0===e.includes(n.name)&&t.push(deepCopy(n))}else t=deepCopy(this.fields||[]);return new fields_definition(this.label_sng||"",this.label_pl||"",t)}}function rpx(e){return e*parseFloat(getComputedStyle(document.documentElement).fontSize)}function vw(e){return $(window).width()*(e||1)}function vh(e){return $(window).height()*(e||1)}function hh(){return $("header:first").height()||0}function ne(e,t){return""===(e||"")?t||"":e}function pad(e,t){return(e||"").toString().padStart(t,"0").substr(-1*t)}function twoDigitYear(e){var t=parseInt(e,10);return t+(t<70?2e3:1900)}function parseGermanDate(e){var t=e.match(/^(\d{1,2})\.(\d{1,2})\.(\d{2}|\d{4})(?:[\sT](\d{1,2}):(\d{2})(?::(\d{2}))?)?$/);if(null===t)return null;var n=2===t[3].length?twoDigitYear(t[3]):parseInt(t[3],10);return new Date(n,parseInt(t[2],10)-1,parseInt(t[1],10),parseInt(t[4]||"0",10),parseInt(t[5]||"0",10),parseInt(t[6]||"0",10))}function parseISO(e){let t=e||"";if(""===t)return null;if(!0===/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)/.test(t))return new Date(t);var n=parseGermanDate(t);if(null!==n)return n;var i=t.split(/\D/);return new Date(i[0],i[1]-1,i[2],i[3]||0,i[4]||0,i[5]||0)}function parseISOLocal(e){let t=e||"";if(""===t)return null;var n=parseGermanDate(t);if(null!==n)return n;var i=t.split(/\D/);return new Date(i[0],i[1]-1,i[2],i[3]||0,i[4]||0,i[5]||0)}function fnum(e,t){return new Intl.NumberFormat($t.lng||"de-DE",t||{}).format(e)}function fdt(e,t){if(void 0===e)return"";try{var n=t||"DD.MM.YYYY HH:mm";if("dts"===n&&(n="yyyy-MM-dd"),"iso"===n)return"string"==typeof e&&(e=parseISO(e)),e.toISOString();if("function"==typeof moment)return void 0!==e&&"string"==typeof e&&""!==e?moment(e).format(n):"";"string"==typeof e&&(e=parseISO(e));var i=function(e,t){var n="0000"+e.toString();return n.slice(n.length-(t||2))},r=n+"";return r=(r=(r=(r=(r=(r=(r=(r=(r=(r=r.replace(/ddd/gi,($t.dn||$ocms.t.dn)[e.getDay()])).replace(/dd/gi,i(e.getDate()))).replace(/MMMM/g,($t.mn||$ocms.t.mn)[e.getMonth()])).replace(/MMM/g,($t.ma||$ocms.t.ma)[e.getMonth()])).replace(/MM/g,i(e.getMonth()+1))).replace(/yyyy/gi,i(e.getFullYear(),4))).replace(/yy/gi,i(e.getFullYear()))).replace(/hh/gi,i(e.getHours()))).replace(/mm/g,i(e.getMinutes()))).replace(/ss/gi,i(e.getSeconds()))}catch(e){return""}}function jine(e,t){return e.map(((e,t)=>e||"")).filter(((e,t)=>""!==e)).join(t)}function parseDt(e,t,n){e=(e||"").substr(0,t.length);var i=t,r=e.length>0&&t.split(";").some((function(t){for(var n,r=/[^yMdhms0-9]/gi,o=!0;null!==(n=r.exec(t));)o=o&&t.substr(n.index,1)===e.substr(n.index,1);var a=e.length===t.length&&o;return!0===a&&(i=t),a}));if(!0===r){for(var o,a=[0,0,0,0,0,0,0],s=/(mm{1,2}|dd{1,2}|MM{1,2}|(yy){2,4}|ss{1,2}|hh{1,2})(?!\w)/g;null!==(o=s.exec(i));)a["yMdhms".indexOf(o[0].substr(0,1))]=parseInt(("yy"===o[0]?"20":"")+e.substr(o.index,o[0].length))-("M"===o[0].substr(0,1)?1:0);var l=new(Function.prototype.bind.apply(Date,[null].concat(a)));return"string"==typeof n?fdt(l,n):l}return!1}function bool(e,t){return"boolean"==typeof e?e:"boolean"==typeof t&&t}function booln(e,t){return"boolean"==typeof e?e:"number"==typeof e?1===e:"boolean"==typeof t&&t}Date.prototype.isValid=function(){return!isNaN(this)},Date.prototype.format=function(e){return fdt(this,e)},Date.prototype.addDays=function(e){return this.setDate(this.getDate()+e),this},Date.prototype.isBetween=function(e,t){return this>e&&this<t},Date.prototype.diff=function(e){var t=Math.abs(e-this);return Math.ceil(t/864e5)},Date.prototype.year=function(){return this.getFullYear()},Date.prototype.month=function(){return this.getMonth()+1},Date.prototype.date=function(){return this.getDate()},String.prototype.ne=function(e){let t=(this||"").trim();return""===t?e||"":t},String.prototype.eine=function(e,t){let n=(this||"").trim();return""===n?"":(e||"")+n+(t||"")};var h=void 0===window.location.hash;$ocms.getHash=h?function(){return document.URL.substr(document.URL.indexOf("#"))}:function(){return window.location.hash},$ocms.initNav=function(){$("body").click((function(e){$("#toggle-nav").removeClass("active")}));var e=$("#toggle-nav");$(".nav_menu").click((function(t){!0===e.hasClass("active")&&t.stopPropagation()})),e.click((function(e){e.stopPropagation(),$(this).toggleClass("active")}))},$ocms.initScroll=function(){let e=$("header").height();$("main > section");$(window).scroll((function(t){let n=$(window).scrollTop(),i=$("body");i.toggleClass("unfocus",n>vh()-1.2*e),i.toggleClass("btb",n>.5*vh()-e)}))},$ocms.cf_reset=function(){return $("#contentframe").empty()},function(e){e.fn.scrollTo=function(t){if(e(this).length>0){var n=e(this).offset().top||0;n>0&&e("html, body").animate({scrollTop:n-hh()},2e3)}},e.fn.ldng=function(t){var n=!0;return"boolean"==typeof t?n=t:"number"==typeof t&&(n=t>0),e(this).toggleClass("loading",n)},"function"!=typeof e.noop&&(e.noop=function(){}),e.fn.hasAttr=function(t){var n=e(this).attr(t);return void 0!==n&&!1!==n},e.fn.parseCssPx=function(t){try{return parseFloat(e(this).css(t).replace("px","")||0)}catch(e){return 0}},e.max=function(e,t){return isNaN(e)&&isNaN(t)?null:isNaN(e)&&!isNaN(t)?t:!isNaN(t)&&isNaN(t)||e>=t?e:t},e.min=function(e,t){return isNaN(e)&&isNaN(t)?null:isNaN(e)&&!isNaN(t)?t:!isNaN(t)&&isNaN(t)||e<=t?e:t},e.lim=function(e,t){return isNaN(e)?null:isNaN(t)?e:t<=e?t:e},e.fn.enterKey=function(t){return this.each((function(){e(this).keypress((function(e){"13"===(e.keyCode?e.keyCode:e.which).toString()&&t.call(this,e)}))}))}}(jQuery),$ocms.defaultTimeout=3e4,$ocms.AjaxEX=function(e){var t=this;t.responseText=t.responseText||"";var n=t.getResponseHeader("x-ocms-code")||"";t.internalCode=""!==n&&!1===isNaN(n)?parseInt(n):-1,t.isInternal=t.internalCode>-1,t.internalText=decodeURIComponent((t.getResponseHeader("x-ocms-desc")||"").replace(/\+/g,"%20")||"");var i=t.internalText||e,r=t.internalCode||t.status;t.logtext=i+" ("+r+")"},$ocms.postXTS=function(e){$ocms.postXT.call(this,$.extend(e,{sync:!0}))},$ocms.postXT=function(e){if((e=e||{}).trycount=e.trycount||0,""!==(e.url||"")){e.url=-1!==e.url.indexOf("&yy=")?e.url:e.url.indexOf("?")>-1?e.url+"&yy="+(new Date).getTime():e.url+"?yy="+(new Date).getTime();var t=e.context||this;switch(e.context=t,e.retryLimit=e.retryLimit||0,e.timeout=e.timeout||$ocms.defaultTimeout,e.timeout<100&&(e.timeout=1e3*e.timeout),e.data=e.data||{},e.contentType=e.contentType||"multipart/form-data; charset=UTF-8",e.islogin="boolean"==typeof e.islogin&&e.islogin,e.contentType){case"":case"json":e.contentType="application/json; charset=utf-8";break;case"form":e.contentType="application/x-www-form-urlencoded; charset=UTF-8";break;case"multi":e.contentType="multipart/form-data";break;case"text":e.contentType="text/plain; charset=UTF-8"}if(e.form instanceof jQuery){if(e.data=e.form.serializeObject(),null===e.data)return void e.form.rejectInvalid();e.contentType="form-data"}else e.lzw instanceof jQuery&&(e.data.lzw=$.ccLZW(e.lzw.serializeAnything(!0)).join(","));if("multipart/form-data"!==e.contentType.substr(0,19)&&"form-data"!==e.contentType.substr(0,9)||e.data instanceof FormData!=!1)e.data instanceof FormData&&(e.contentType=!1,e.processData=!1);else{e.contentType=!1;var n=new FormData;$.each(e.files||[],(function(e,t){n.append("upload_file",t)})),$.each(e.data||{},(function(e,t){n.append(e,t)})),e.data=n,e.processData=!1}var i={type:e.method||"post",url:e.url,data:e.data,processData:"boolean"!=typeof e.processData||e.processData,contentType:e.contentType,cache:e.cache||!1,timeout:e.timeout,beforeSend:function(n){$(e.loading).ldng(),$("body").addClass("ldng"),"function"==typeof e.beforesend&&e.beforesend.apply(t,[n])},success:function(n,i,r){"false"===n||"not authorized"===n?("function"==typeof e.error&&e.error.apply(t,[r,i,n]),"function"==typeof $.status&&$.status(i+" - "+n)):"function"==typeof e.success&&e.success.apply(t,[n,i,r])},error:function(n,i,r){if($ocms.AjaxEX.call(n,i),-1===e.url.indexOf("doc.ashx")||-1!==e.url.indexOf("ftest")){if(401===n.status&&111===n.internalCode&&!1===e.islogin&&"function"==typeof $ocms.login.dlg)$ocms.login.dlg({ajo:e});else if("timeout"===i||302===n.status)return e.tryCount++,e.tryCount<=e.retryLimit?void $ocms.postXT(e):void 0;"function"==typeof e.error?e.error.apply(t,[n,i,r]):"function"==typeof $ocms.failure?$ocms.failure.apply(t,[n]):"function"==typeof $.status&&$.status("Server error: "+i+" - "+r)}},dataType:e.datatype||"json",complete:function(n,i){"function"==typeof e.complete&&e.complete.apply(t,[n,i]),$(e.loading).ldng(0),$("body").removeClass("ldng");let r=$("body > .timer");if(r.length>0){let e=new Date(n.getResponseHeader("ocms_cec")||""),t=new Date(n.getResponseHeader("ocms_cex")||"");if(e.isValid()&&t.isValid()){let n=new Date,i=Math.abs(t-e);n.setMilliseconds(n.getMilliseconds()+i),r.data({cex:n,ctt:i}),$ocms.cex_timer()}}},context:t,async:!0};return"boolean"==typeof e.sync&&(i.async=!1===e.sync),!0==("boolean"==typeof e.contentType&&!1===e.contentType)&&(i.contentType=!1),$.ajax(i)}},$ocms.cex_timer=function(){$ocms.cexi||($ocms.cexi=setInterval($ocms.cex_timer,15e3));let e=$("body > .timer"),t=e.data("cex"),n=e.data("ctt"),i=new Date;if(t instanceof Date&&t.isValid()&&"number"==typeof n&&n>0&&t>i){let r=Math.abs(i-t)/n*100;e.css("width",r.toString()+"%"),r<98&&(!$ocms.cex_lp||Math.abs(i-$ocms.cex_lp)>6e5)&&$ocms.postXT({url:$ocms.url("ping"),success:()=>{$ocms.cex_lp=i},timeout:5e3,error:()=>{}})}},$ocms.vbl_send=function(e){var t=e.data||{};if(""!==(t.url||"")){var n=$("#contentframe form:first"),i={url:t.url,data:new FormData,success:function(e){"function"==typeof t.success?t.success(e):"string"==typeof t.success&&alert(t.success)},error:function(e,n,i){"function"==typeof t.error?t.error(i):"string"==typeof t.error&&alert(t.error)},complete:function(){n.ldng(0)}},r=!0;n.find("input").each((function(){var e=$(this),t=e.nza("name"),n=e.val(),o=$(this).prop("required")||!1;if(""!==t){var a=""!==n||!1===o;r=r&&a,!0===a?(i.data.append(t,n),e[0].setCustomValidity("")):""!==$(this).nza("ocms-nvnote")&&e[0].setCustomValidity($(this).nza("ocms-nvnote"))}})),!0===r&&(n.ldng(1),$ocms.postXT.call(this,i))}},function(e){e.fn.nza=function(t,n){var i=e(this).attr(t);return void 0!==i&&!1!==i?i:n||""},e.fn.serializeObject=function(t,n){var i=/\r?\n/g,r=/^(?:submit|button|image|reset|file)$/i,o=/^(?:input|select|textarea|keygen)/i,a=/^(?:checkbox|radio)$/i,s=bool((n=n||{}).typedvalues,!1),l={},c=e(this),d=c.find(':input:not([nosend],[type="file"])').addBack(":input"),u=!0;return e.each(d.not(".tinymce").get(),(function(n,c){var d=e(this),f=this,m=(this.type||"").toLowerCase(),p=d.prop("required")||!1;if(!0===(f.name&&!d.is(":disabled")&&o.test(f.nodeName)&&!r.test(m))){var h=d.val(),g=f.name,y=d.nza("data-format").split(":"),v=d.nza("pattern")||".*";if(!0===a.test(m)&&(h=f.checked?""!==h?h:"true":""),"date"===y[0].substr(0,4)&&y.length>1&&(""!==h||p))"boolean"==typeof(h=parseDt(h,y.slice(1).join(":")))&&(h=null),null===h&&"date"===d.prop("type").substr(0,4)&&!1===isNaN(new Date(d.val()))&&(h=new Date(d.val())),h instanceof Date==!0&&"function"==typeof h.getMonth?!1===s&&(h=fdt(h,"date"===y[0]?"dts":"iso")):h=null;else if(("number"===m||"float"===y[0]||"integer"===y[0])&&!0===s){let e,t=String(h).replace(",",".");e="integer"===y[0]?parseInt(t):parseFloat(t),h=isNaN(e)?h:e}if(!0===p&&(""===h||null==h||"string"==typeof h&&null===h.match(v))?(!0===bool(t,!1)&&f.setCustomValidity(d.nza("ocms-nvnote",$ocms.t.inv||"Invalid field")),h=null):!0===bool(t,!1)&&f.setCustomValidity(""),null!=h&&"string"==typeof h){let e=l[g];null!=e?Array.isArray(e)?e.push(h.replace(i,"\r\n")):l[g]=[e,h.replace(i,"\r\n")]:l[g]=h.replace(i,"\r\n")}else if(null!=h){let e=l[g];null!=e?Array.isArray(e)?e.push(h):l[g]=[e,h]:l[g]=h}else u=!1}})),d.filter(".tinymce").each((function(t,n){var i=e(this),r=((this.type||"").toLowerCase(),i.prop("required")||!1);try{var o=tinymce.get(e(n).attr("id"));if(o){var a=e(n).attr("name"),s=o.getContent();!1===r||""!==(s||"")?l[a]=s:u=!1}}catch(t){e.noop()}})),c.toggleClass("invalid",!u),u?l:null},e.fn.rejectInvalid=function(){var t=e(this).ldng(0),n=t.closest("form")[0]||t.find("form")[0];return n&&"function"==typeof n.reportValidity&&n.reportValidity(),t},e.fn.sendForm=function(t,n,i){var r=e(this);i=i||{};var o={url:t,success:function(e){if(i.response=e,"function"==typeof n)n(e);r.closest("div.modal").remove()},error:function(e,t,n){"function"==typeof i.error?i.error.call(this,e):$ocms.failure.call(this,e)},complete:function(e){r.ldng(0),"function"==typeof i.complete&&i.complete.call(this,e)}},a=r.serializeObject();if(null!==a){var s=r.find('input[type="file"]');o.data=new FormData,s.length>0&&e.each(s[0].files,(function(e,t){o.data.append(e,t),o.data.append("file_lastmodified",$ocms.isodt(t.lastModifiedDate))})),e.each(a,(function(e,t){o.data.append(e,t)})),r.ldng(),$ocms.postXT.call(this,o)}else r.rejectInvalid()},e.fn.checkValidity=function(){var t=e(this),n=!0;return t.each((function(e,t){n=n&&t.checkValidity()})),n},e.fn.wrap=function(t,n){var i=e(this),r=$$.dc(t).attr(n||{}).insertAfter(i);return i.append(r),r}}(jQuery),$ocms.logout=function(){$ocms.postXT({url:$ocms.url("logout"),complete:function(){window.location.reload()}})},$ocms.login={send:function(e){e.preventDefault();var t=$(this);if(!0===t.find("#dbtn-confirm").hasClass("disabled"))return!1;var n=t.serializeObject();return null===n?(t.rejectInvalid(),!1):(n.loginaccount=ne(n.loginaccount,$ocms.auth.account||$ocms.auth.requestedaccount||""),""===ne(n.loginaccount)&&!0===bool($ocms.auth.accountrequired,!0)?(alert($t.l16),!1):($ocms.postXT({url:$ocms.url("login"),data:n,success:function(){window.location.reload()}}),!1))},uichange:function(){let e=$(this),t=e.closest("form"),n=bool($ocms.auth.accountrequired,!0),i=ne(t.find('[name="loginaccount"]').val(),$ocms.auth.account||$ocms.auth.requestedaccount||"");if(""!==i||!1===n){var r=t.find('[name="userlogin"]').empty().val(""),o=t.find('[name="username"]').empty().val(""),a=$("#dlg_userlogin_sel").empty().val(""),s=e.val()||"";if(!1===e.checkValidity()&&""===s)return;var l=e.closest("table").ldng();$ocms.postXT.call(this,{url:$ocms.url("auth"),data:{userinfo:s,account:i||""},success:function(e,t,n){if(1===e.length){var i=e[0];r.val(i.login).change().attr("required","").removeAttr("nosend"),o.val(i.name).change().attr("required","").show(),a.removeAttr("required").attr("nosend","").hide()}else e.length>0?(o.hide().removeAttr("required"),r.removeAttr("required").attr("nosend",""),0===a.length&&(a=$("<select></select>").attr({name:"userlogin",size:e.length,id:"dlg_userlogin_sel",class:"form-control",required:""}).css({width:"100%","max-width":"100%",padding:"2px"}).insertAfter(o)),$.each(e,(function(e,t){var n=$("<option></option>").attr({value:t.login,style:"padding-top: 2px; padding-bottom: 5px;","border-bottom":"1px solid #EEE;"}).text(t.name).appendTo(a);e%2==0&&n.css({"background-color":"#F9F9F9"})})),a.attr("required","").removeAttr("nosend")):(a.hide().attr("nosend",""),o.attr("required","").show(),r.attr("required","").removeAttr("nosend"),alert($t.l9))},error:function(e){$ocms.failure.call(this,e)},complete:function(){l.ldng(0)}})}else alert($t.l18)},sendpassword:function(e){var t=$('<div class="modal"><div class="modal-dialog in" style="height: 500px; width: 600px;"><div class="modal-content" style="height: auto;" novalidate="true"><div class="modal-header"><h3>Vereinsmanager</h3></div></div><div class="modal-close"></div><div class="modal-content"><form role="form"><div class="modal-header"><h3></h3></div><div class="modal-body"><div class="frm"><div class="form-body stacked"><div class="form-group"><div class="form-itm"><label for="dlg_lastname">Nachname<span class="ind_required">*</span></label></div><div class="form-itm"><input id="dlg_lastname" name="lastname" type="string" class="form-control" required=""></div></div><div class="form-group"><div class="form-itm"><label for="dlg_email">Email<span class="ind_required">*</span></label></div><div class="form-itm"><input id="dlg_email" name="email" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,}$" type="string" class="form-control" required=""></div></div></div></div></div><div class="modal-footer"><div class="note_required"><span class="ind_required">*</span><span>Eingabe erforderlich</span></div><button type="submit" class="btn confirm" role="confirm">Senden</button></div><div class="modal-note"></div></form></div></div></div>'),n=t.find(".form-body"),i=null;t.find("form").submit((function(e){e.preventDefault();var r=$(this).serializeObject(!0),o=null===i,a=o?"spwc":"spw";return null===r?($(this).rejectInvalid(),!1):($ocms.postXT.call(this,{url:$ocms.url(a),data:r,complete:function(){o?(n.append('<div class="form-group"><div class="form-itm"></div><div class="form-itm">Ihnen wurde ein Code per SMS zugesandt. <br />Bitte tragen Sie den hier ein:</div></div>'),i=$('<div class="form-group"><div class="form-itm"><label for="dlg_code">SMS-Code<span class="ind_required">*</span></label></div><div class="form-itm"><input id="dlg_code" name="code" type="string" class="form-control" required></div></div>').appendTo(n)):(alert($t.l13),t.remove())},error:()=>{}}),!1)})),t.find(".modal-close").click((function(){t.remove()}));var r=[];$.each($t.l7a.split("\n"),((e,t)=>{Array.prototype.push.apply(r,[$("<br/>"),$("<span></span>").text(t)])})),t.find(".modal-note").append($('<span style="text-decoration: underline;"></span>').text($t.alert)).append(r),t.appendTo("body"),setTimeout((function(){$(".modal").find('input[name="lastname"]').focus()}),600)}},$(document).ready((function(){$("#loginform").submit($ocms.login.send)}));