12 |
- /*! third party licenses: dist/vendor.LICENSE.txt */
- window.addEventListener("DOMContentLoaded",()=>{$("#loglevel").change(function(){$.post(OC.generateUrl("/settings/admin/log/level"),{level:$(this).val()},()=>{OC.Log.reload()})}),$("#mail_smtpauth").change(function(){this.checked?$("#mail_credentials").removeClass("hidden"):$("#mail_credentials").addClass("hidden")}),$("#mail_smtpmode").change(function(){$(this).val()!=="smtp"?($("#setting_smtpauth").addClass("hidden"),$("#setting_smtphost").addClass("hidden"),$("#mail_smtpsecure_label").addClass("hidden"),$("#mail_smtpsecure").addClass("hidden"),$("#mail_credentials").addClass("hidden"),$("#mail_sendmailmode_label, #mail_sendmailmode").removeClass("hidden")):($("#setting_smtpauth").removeClass("hidden"),$("#setting_smtphost").removeClass("hidden"),$("#mail_smtpsecure_label").removeClass("hidden"),$("#mail_smtpsecure").removeClass("hidden"),$("#mail_smtpauth").is(":checked")&&$("#mail_credentials").removeClass("hidden"),$("#mail_sendmailmode_label, #mail_sendmailmode").addClass("hidden"))});const r=function(){if(OC.PasswordConfirmation.requiresPasswordConfirmation()){OC.PasswordConfirmation.requirePasswordConfirmation(r);return}OC.msg.startSaving("#mail_settings_msg"),$.ajax({url:OC.generateUrl("/settings/admin/mailsettings"),type:"POST",data:$("#mail_general_settings_form").serialize(),success:()=>{OC.msg.finishedSuccess("#mail_settings_msg",t("settings","Saved"))},error:e=>{OC.msg.finishedError("#mail_settings_msg",e.responseJSON)}})},m=function(){if(OC.PasswordConfirmation.requiresPasswordConfirmation()){OC.PasswordConfirmation.requirePasswordConfirmation(m);return}OC.msg.startSaving("#mail_settings_msg"),$.ajax({url:OC.generateUrl("/settings/admin/mailsettings/credentials"),type:"POST",data:$("#mail_credentials_settings").serialize(),success:()=>{OC.msg.finishedSuccess("#mail_settings_msg",t("settings","Saved"))},error:e=>{OC.msg.finishedError("#mail_settings_msg",e.responseJSON)}})};$("#mail_general_settings_form").change(r),$("#mail_credentials_settings_submit").click(m),$("#mail_smtppassword").click(()=>{(void 0).type==="text"&&(void 0).value==="********"&&((void 0).type="password",(void 0).value="")}),$("#sendtestemail").click(e=>{e.preventDefault(),OC.msg.startAction("#sendtestmail_msg",t("settings","Sending…")),$.ajax({url:OC.generateUrl("/settings/admin/mailtest"),type:"POST",success:()=>{OC.msg.finishedSuccess("#sendtestmail_msg",t("settings","Email sent"))},error:i=>{OC.msg.finishedError("#sendtestmail_msg",i.responseJSON)}})});const o=()=>{$.when(OC.SetupChecks.checkSetup()).then(e=>{const i=$("#postsetupchecks");$("#security-warning-state-loading").addClass("hidden");let n=!1;const a=i.find(".errors"),d=i.find(".warnings"),l=i.find(".info");for(let s=0;s<e.length;s++)switch(e[s].type){case OC.SetupChecks.MESSAGE_TYPE_INFO:l.append("<li>"+e[s].msg+"</li>");break;case OC.SetupChecks.MESSAGE_TYPE_WARNING:d.append("<li>"+e[s].msg+"</li>");break;case OC.SetupChecks.MESSAGE_TYPE_ERROR:default:a.append("<li>"+e[s].msg+"</li>")}a.find("li").length>0&&(a.removeClass("hidden"),n=!0),d.find("li").length>0&&(d.removeClass("hidden"),n=!0),l.find("li").length>0&&(l.removeClass("hidden"),n=!0),n?($("#postsetupchecks-hint").removeClass("hidden"),a.find("li").length>0?$("#security-warning-state-failure").removeClass("hidden"):$("#security-warning-state-warning").removeClass("hidden")):$("#security-warning").children("ul").children().length===0?$("#security-warning-state-ok").removeClass("hidden"):$("#security-warning-state-failure").removeClass("hidden")})};document.getElementById("security-warning")!==null&&o()});
|