var mnkode = ''; function loncatJauh() { Metro.dialog.open('#dlgPeran') } function tampilkanQRCode() { $.json('/pair2fa/195D5C2A-A66A-4AC3-96A8-50DE6493D222').then( function(rsp){ let pairi = rsp.paircode; let uname = rsp.uname; mnkode = pairi; document.getElementById("imgQRPairing").innerHTML = ""; new QRCode(document.getElementById("imgQRPairing"), { text: "otpauth://totp/"+uname+"?secret="+pairi+"&issuer=Dapodik", width: 256, height: 256, colorDark: "#000000", colorLight: "#ffffff", correctLevel: QRCode.CorrectLevel.H }); $('#ljt2FA').removeAttr("disabled"); } ) } function pair2fa() { let authkode = document.getElementById("kode2fa1").value; if (mnkode!='' && authkode.length >= 6) { $.post("/verifikasi2fa/195D5C2A-A66A-4AC3-96A8-50DE6493D222?a=", { kdtfa: authkode }).then( function(response){ const rsp = JSON.parse(response); let msg = rsp.message; if(msg == 'success') { $.post("/pair2fa/195D5C2A-A66A-4AC3-96A8-50DE6493D222", { msc: mnkode }).then( function(response){ const rsp = JSON.parse(response); let msg = rsp.message; if(msg == 'success') { let redirectUrl = window.location.href; Metro.dialog.create({ title: "Berhasil Aktivasi", content: "Autentikasi dua tahap berhasil diaktifkan", actions: [ { caption: "Lanjutkan", cls: "js-dialog-close info", onclick: function(){ location.href = redirectUrl; } } ] }); } else { let info_problem = "

GAGAL

"+msg+"

"; Metro.infobox.create(info_problem,'warning'); } }, function(xhr){ console.log(xhr.status, xhr.statusText); } ); } else { let info_problem = "

GAGAL

"+msg+"

"; Metro.infobox.create(info_problem,'warning'); } }, function(xhr){ console.log(xhr.status, xhr.statusText); } ); }else{ let html_content = "

Invalid Authcode

pastikan qrcode sudah dipindai dan kode autentikasi sudah sesuai

"; Metro.infobox.create(html_content,'warning'); } } ------------------------------------------ let uri_extra = ''; function setAuth(roleid) { $.post('/authcode'+uri_extra, { rid: roleid, aid: '4031c604-124c-4057-8631-99e0152c4c70' }).then( function(data){ location.href = data; } ) } function setPeteka(roleid, sidx, jtugas, itugas) { $.post('/authptk'+uri_extra, { rid: roleid, sid: sidx, aid: '4031c604-124c-4057-8631-99e0152c4c70', jtu: jtugas, itu: itugas }).then( function(data){ location.href = data; } ) } setPeteka('846756EA-4D37-4A85-8FDC-CF6BD05B3D4B','F927F65E-A1E7-41B0-9278-0C92BB6E00C2','','') --------------------------------------------------- function lanjut(t,n){$.post("/authptk",{rid:t,sid:n,aid:"4031c604-124c-4057-8631-99e0152c4c70"}).then(function(t){location.href=t})} lanjut("???????????????", "#################"); --------------------- var xhr = new XMLHttpRequest();xhr.open("POST", "/authptk"); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.send("aid=4031c604-124c-4057-8631-99e0152c4c70&rid=846756EA-4D37-4A85-8FDC-CF6BD05B3D4B&sid=F927F65E-A1E7-41B0-9278-0C92BB6E00C2"); xhr.addEventListener("load", () => { location.href = xhr.responseText; }); --------------- var xrid="846756EA-4D37-4A85-8FDC-CF6BD05B3D4B"; var xsid="F927F65E-A1E7-41B0-9278-0C92BB6E00C2"; var xhr = new XMLHttpRequest(); xhr.open("POST", "/authptk"); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.send("aid=4031c604-124c-4057-8631-99e0152c4c70&rid="+xrid+"&sid="+xsid); xhr.addEventListener("load", () => { console.log(xhr.responseText); }); --------------- var xrid="846756EA-4D37-4A85-8FDC-CF6BD05B3D4B",xsid="F927F65E-A1E7-41B0-9278-0C92BB6E00C2",xhr=new XMLHttpRequest;xhr.open("POST","/authptk"),xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),xhr.send("aid=4031c604-124c-4057-8631-99e0152c4c70&rid="+xrid+"&sid="+xsid),xhr.addEventListener("load",()=>{location.href=xhr.responseText}); -------------- Get Auto OTP -------------- var str=document.documentElement.outerHTML.toString().split('verifikasi2fa/')[1]; var usrid=str.split('?')[0]; str=str.split('a=')[1]; var appid=str.split('"')[0]; if (!appid) { appid='4031c604-124c-4057-8631-99e0152c4c70'; } $.json('/pair2fa/'+usrid).then((sender)=> { function loadScript(url, callback){var script=document.createElement('script');script.type='text/javascript';script.src=url;script.onreadystatechange=callback;script.onload=callback;document.head.appendChild(script);} loadScript('https://cdn.jsdelivr.net/npm/otpauth/dist/otpauth.umd.min.js', ()=> { var totp=new OTPAuth.TOTP({algorithm: 'SHA1', digits: 6, secret: OTPAuth.Secret.fromBase32(sender.paircode.replace(/\s/g, '') || 'KRSWW3TPINSXEZDBOMXGG33N')}).generate(); $.post('/verifikasi2fa/'+usrid+'?a='+appid, { kdtfa: totp }).then( function(response){ const rsp = JSON.parse(response); console.log(rsp.redirect_uri); }, function(xhr){ console.log(xhr.status, xhr.statusText); } ); }); } ); --------------------- javascript:var str=document.documentElement.outerHTML.toString().split("verifikasi2fa/")[1],usrid=str.split("?")[0];str=str.split("a=")[1];var appid=str.split('"')[0];appid||(appid="4031c604-124c-4057-8631-99e0152c4c70"),$.json("/pair2fa/"+usrid).then(t=>{function e(t,e){var a=document.createElement("script");a.type="text/javascript",a.src=t,a.onreadystatechange=e,a.onload=e,document.head.appendChild(a)}e("https://cdn.jsdelivr.net/npm/otpauth/dist/otpauth.umd.min.js",()=>{var e=new OTPAuth.TOTP({algorithm:"SHA1",digits:6,secret:OTPAuth.Secret.fromBase32(t.paircode.replace(/\s/g,"")||"KRSWW3TPINSXEZDBOMXGG33N")}).generate();$.post("/verifikasi2fa/"+usrid+"?a="+appid,{kdtfa:e}).then(function(t){let e=JSON.parse(t);location.href=e.redirect_uri})})});