2020-06-27 10:42:36 +00:00
|
|
|
{"version":3,"sources":["auth.js"],"names":["const","lsKeys","token","page","localStorage","user","pass","unhide","loaderSection","document","querySelector","classList","add","loginSection","remove","floatingBtn","onAxiosError","error","console","statusText","520","521","522","523","524","525","526","527","530","response","status","description","data","swal","do","dest","trigger","value","trim","axios","post","username","password","then","success","window","location","catch","verify","addEventListener","form","event","preventDefault","loginBtn","checkValidity","currentTarget","registerBtn","click"],"mappings":"AAEAA,IAAMC,OAAS,CACbC,MAAO,SAGHC,KAAO,CAEXD,MAAOE,aAAaH,OAAOC,OAG3BG,KAAM,KACNC,KAAM,KAGRC,OAAW,WACTP,IAAMQ,EAAgBC,SAASC,cAAc,WACzCF,GACFA,EAAcG,UAAUC,IAAI,aAE9BZ,IAAMa,EAAeJ,SAASC,cAAc,oBACxCG,GACFA,EAAaF,UAAUG,OAAO,aAEhCd,IAAMe,EAAcN,SAASC,cAAc,mCACvCK,GACFA,EAAYJ,UAAUG,OAAO,cAIjCE,aAAiB,SAAGC,GAClBC,QAAQD,MAAMA,GAGdjB,IAYMmB,EAZmB,CACvBC,IAAK,gBACLC,IAAK,qBACLC,IAAK,uBACLC,IAAK,wBACLC,IAAK,qBACLC,IAAK,uBACLC,IAAK,0BACLC,IAAK,gBACLC,IAAK,oBAG6BX,EAAMY,SAASC,SAAWb,EAAMY,SAASV,WACvEY,EAAcd,EAAMY,SAASG,MAAQf,EAAMY,SAASG,KAAKD,YAC3Dd,EAAMY,SAASG,KAAKD,YACpB,sFAEJ,OAAOE,KAAQhB,EAAMY,SAAS,OAAM,IAAIV,EAAcY,EAAa,UAGrEG,GAAO,SAAIC,EAAMC,GACfpC,IAAMK,EAAOF,KAAKE,KAAKgC,MAAMC,OAC7B,IAAKjC,EACH,OAAO4B,KAAK,qBAAsB,kCAAmC,SAEvEjC,IAAMM,EAAOH,KAAKG,KAAK+B,MAAMC,OAC7B,IAAKhC,EACH,OAAO2B,KAAK,qBAAsB,kCAAmC,SAEvEG,EAAQz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n // user token\n token: localStorage[lsKeys.token],\n\n // HTML elements\n user: null,\n pass: null\n}\n\npage.unhide = () => {\n const loaderSection = document.querySelector('#loader')\n if (loaderSection)\n loaderSection.classList.add('is-hidden')\n\n const loginSection = document.querySelector('#login.is-hidden')\n if (loginSection)\n loginSection.classList.remove('is-hidden')\n\n const floatingBtn = document.querySelector('.floating-home-button.is-hidden')\n if (floatingBtn)\n floatingBtn.classList.remove('is-hidden')\n}\n\n// Handler for Axios errors\npage.onAxiosError = error => {\n console.error(error)\n\n // Better Cloudflare errors\n const cloudflareErrors = {\n 520: 'Unknown Error',\n 521: 'Web Server Is Down',\n 522: 'Connection Timed Out',\n 523: 'Origin Is Unreachable',\n 524: 'A Timeout Occurred',\n 525: 'SSL Handshake Failed',\n 526: 'Invalid SSL Certificate',\n 527: 'Railgun Error',\n 530: 'Origin DNS Error'\n }\n\n const statusText = cloudflareErrors[error.response.status] || error.response.statusText\n const description = error.response.data && error.response.data.description\n ? error.response.data.description\n : 'There was an error with the request, please check the console for more information.'\n\n return swal(`${error.response.status} ${statusText}`, description, 'error')\n}\n\npage.do = (dest, trigger) => {\n const user = page.user.value.trim()\n if (!user)\n return swal('An error occurred!', 'You need to specify a user
|