2022-03-03 11:46:42 +00:00
|
|
|
{"version":3,"sources":["auth.js"],"names":["const","lsKeys","token","page","localStorage","user","pass","loaderSection","document","querySelector","classList","add","loginSection","remove","floatingBtn","error","console","statusText","response","status","description","data","swal","dest","trigger","value","trim","axios","post","username","password","then","success","window","location","catch","onAxiosError","unhide","addEventListener","form","event","preventDefault","loginBtn","checkValidity","do","currentTarget","registerBtn","click","verify"],"mappings":"AAEAA,IAAMC,OAAS,CACbC,MAAO,SAGHC,KAAO,CAEXD,MAAOE,aAAaH,OAAOC,OAG3BG,KAAM,KACNC,KAAM,KAGRH,OAAW,WACTH,IAAMO,EAAgBC,SAASC,cAAc,WACzCF,GAAeA,EAAcG,UAAUC,IAAI,aAE/CX,IAAMY,EAAeJ,SAASC,cAAc,oBACxCG,GAAcA,EAAaF,UAAUG,OAAO,aAEhDb,IAAMc,EAAcN,SAASC,cAAc,mCACvCK,GAAaA,EAAYJ,UAAUG,OAAO,cAIhDV,aAAiB,SAAGY,GAClBC,QAAQD,MAAMA,GAGdf,IAYMiB,EAZmB,CACvB,IAAK,gBACL,IAAK,qBACL,IAAK,uBACL,IAAK,wBACL,IAAK,qBACL,IAAK,uBACL,IAAK,0BACL,IAAK,gBACL,IAAK,oBAG6BF,EAAMG,SAASC,SAAWJ,EAAMG,SAASD,WACvEG,EAAcL,EAAMG,SAASG,MAAQN,EAAMG,SAASG,KAAKD,YAC3DL,EAAMG,SAASG,KAAKD,YACpB,uFAEJ,OAAOE,KAAQP,EAAMG,SAAS,OAAM,IAAID,EAAcG,EAAa,UAGrEjB,GAAO,SAAIoB,EAAMC,GACfxB,IAAMK,EAAOF,KAAKE,KAAKoB,MAAMC,OAC7B,IAAKrB,EAAM,OAAOiB,KAAK,qBAAsB,kCAAmC,SAEhFtB,IAAMM,EAAOH,KAAKG,KAAKmB,MAAMC,OAC7B,IAAKpB,EAAM,OAAOgB,KAAK,qBAAsB,kCAAmC,SAEhFE,EAAQd,UAAUC,IAAI,cACtBgB,MAAMC,KAAK,OAAOL,EAAQ,CACxBM,SAAUxB,EACVyB,SAAUxB,IACTyB,MAAI,SAACb,GACN,IAA8B,IAA1BA,EAASG,KAAKW,QAEhB,OADAR,EAAQd,UAAUG,OAAO,cAClBS,KAAK,aAAaC,EAAI,IAAKL,EAASG,KAAKD,YAAa,SAG/DhB,aAAaF,MAAQgB,EAASG,KAAKnB,MACnC+B,OAAOC,SAAW,eACjBC,OAAK,SAACpB,GACPS,EAAQd,UAAUG,OAAO,cACzBV,KAAKiC,aAAarB,OAItBZ,OAAW,WACTwB,MAAMC,KAAK,oBAAqB,CAC9B1B,MAAOC,KAAKD,QACX6B,MAAI,SAACb,GACN,IAA8B,IAA1BA,EAASG,KAAKW,QAEhB,OADA7B,KAAKkC,SACEf,KAAK,qBAAsBJ,EAASG,KAAKD,YAAa,SAI/Da,OAAOC,SAAW,eACjBC,OAAK,SAACpB,GACPZ,KAAKkC,SACLlC,KAAKiC,aAAarB,QAItBkB,OAAOK,iBAAiB,oBAAkB,WACxCnC,KAAKE,KAAOG,SAASC,cAAc,SACnCN,KAAKG,KAAOE,SAASC,cAAc,SAGnCT,IAAMuC,EAAO/B,SAASC,cAAc,aACpC8B,EAAKD,iBAAiB,UAAQ,SAAEE,GAC9BA,EAAMC,oBAGRzC,IAAM0C,EAAWlC,SAASC,cAAc,aACpCiC,GACFA,EAASJ,iBAAiB,SAAO,SAAEE,GAC5BD,EAAKI,iBACVxC,KAAKyC,GAAG,QAASJ,EAAMK,kBAI3B7C,IAAM8C,EAActC,SAASC,cAAc,gBACvCqC,GACFA,EAAYR,iBAAiB,SAAO,SAAEE,GACpC,IAAKD,EAAKI,gBAER,OAAOD,EAASK,QAElB5C,KAAKyC,GAAG,WAAYJ,EAAMK,kBAI1B1C,KAAKD,MAAOC,KAAK6C,SAChB7C,KAAKkC","file":"auth.js","sourcesContent":["/* global swal, axios */\n\nconst lsKeys = {\n token: 'token'\n}\n\nconst page = {\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) loaderSection.classList.add('is-hidden')\n\n const loginSection = document.querySelector('#login.is-hidden')\n if (loginSection) loginSection.classList.remove('is-hidden')\n\n const floatingBtn = document.querySelector('.floating-home-button.is-hidden')\n if (floatingBtn) 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.\\nPlease 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) return swal('An error occurred!', 'You need to specify a username.', 'error')\n\n const pass = page.pass.value.trim()\n if (!pass) return s
|