{"version":3,"names":["loggedInUserData","Discourse","User","current","console","log","getUserByIdRes","fetch","id","method","headers","then","res","json","obj","user_fields","document","getElementById","style","display","formdata","FormData","append","requestOptions","body","username","data","login","JSON","stringify","modalPopup","span","getElementsByClassName","onclick","window","event","target"],"sourceRoot":"theme-4/","sources":["_html/common/body_tag_1.js"],"sourcesContent":["\nvar loggedInUserData = Discourse.User.current();\nconsole.log(\"logged in user data \", loggedInUserData);\n\nvar getUserByIdRes = fetch(\"https://forumdev.i-taros.net/admin/users/\" + loggedInUserData.id + \".json\", {\n\tmethod: \"GET\",\n\theaders: {\n\t\t\t\"API-Key\": \"12ef0d5b256a705cd3d6d2c6cfe618b7c1ff7b2ea9ee731c815f2fd84dbbde4d\",\n\t\t},\n}).then((res) => {\n\tvar resJson = res.json();\n\treturn resJson;\n}).then((obj) => {\n\tconsole.log(\"second then user field \", obj.user_fields[1]);\n\n\tif (loggedInUserData !== null && (obj.user_fields[1] === false || obj.user_fields[1] === null )) {\n\t\tconsole.log(\"in if statement \", loggedInUserData, \"and result \", obj.user_fields[1]);\n\t\tconsole.log(\"user fields \", obj.user_fields[1])\n\t\t\n\t\tvar modal = document.getElementById(\"myModal\");\n\t\tmodal.style.display = \"block\";\n\n\t\tvar myHeaders = {\n\t\t\t\"API-Key\": \"12ef0d5b256a705cd3d6d2c6cfe618b7c1ff7b2ea9ee731c815f2fd84dbbde4d\",\n\t\t};\n\t\tvar formdata = new FormData();\n\t\tformdata.append(\"user_fields[1]\", \"true\");\n\n\t\tvar requestOptions = {\n\t\t\tmethod: \"PUT\",\n\t\t\theaders: myHeaders,\n\t\t\tbody: formdata,\n\t\t};\n\n\t\tfetch(\"https://forumdev.i-taros.net/u/\" + loggedInUserData.username + \".json\", requestOptions);\n\n\n\t\tlet data = {\n\t\t\tlogin: loggedInUserData.username,\n\t\t};\n\t\tconsole.log(\"password link data \", data);\n\t\tfetch(\"https://forumdev.i-taros.net/session/forgot_password.json\", {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: {\n\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\t\"API-Key\": \"12ef0d5b256a705cd3d6d2c6cfe618b7c1ff7b2ea9ee731c815f2fd84dbbde4d\",\n\t\t\t},\n\t\t\tbody: JSON.stringify(data),\n\t\t});\n\n\t\t\n\t}\n\n});\n\n\tvar modalPopup = document.getElementById(\"myModal\");\n\n\t// Get the <span> element that closes the modal\n\tvar span = document.getElementsByClassName(\"close\");\n\n\t// When the user clicks on <span> (x), close the modal\n\tspan.onclick = function () {\n\t\tmodalPopup.style.display = \"none\";\n\t}\n\n\t// When the user clicks anywhere outside of the modal, close it\n\twindow.onclick = function (event) {\n\t\tif (event.target == modalPopup) {\n\t\t\tmodalPopup.style.display = \"none\";\n\t\t}\n\t}\n\n"],"mappings":"AACA,IAAIA,iBAAmBC,UAAUC,KAAKC;AACtCC,QAAQC,IAAI,uBAAwBL;AAEpC,IAAIM,eAAiBC,MAAM,4CAA8CP,iBAAiBQ,GAAK,QAAS,CACvGC,OAAQ,MACRC,QAAS,CACP,UAAW,sEAEXC,MAAMC,GACMA,EAAIC,SAEhBF,MAAMG,IAGR,GAFAV,QAAQC,IAAI,0BAA2BS,EAAIC,YAAY,IAE9B,OAArBf,oBAAqD,IAAvBc,EAAIC,YAAY,IAAuC,OAAvBD,EAAIC,YAAY,IAAe,CAChGX,QAAQC,IAAI,mBAAoBL,iBAAkB,cAAec,EAAIC,YAAY,IACjFX,QAAQC,IAAI,eAAgBS,EAAIC,YAAY,IAEhCC,SAASC,eAAe,WAC9BC,MAAMC,QAAU;AAEtB,IAGIC,EAAW,IAAIC;AACnBD,EAASE,OAAO,iBAAkB;AAElC,IAAIC,EAAiB,CACpBd,OAAQ,MACRC,QARe,CACf,UAAW,oEAQXc,KAAMJ;AAGPb,MAAM,kCAAoCP,iBAAiByB,SAAW,QAASF;AAG/E,IAAIG,EAAO,CACVC,MAAO3B,iBAAiByB;AAEzBrB,QAAQC,IAAI,sBAAuBqB,GACnCnB,MAAM,4DAA6D,CAClEE,OAAQ,OACRC,QAAS,CACR,eAAgB,mBAChB,UAAW,oEAEZc,KAAMI,KAAKC,UAAUH,IAIvB,KAIII,WAAad,SAASC,eAAe,WAGrCc,KAAOf,SAASgB,uBAAuB;AAG3CD,KAAKE,QAAU,WACdH,WAAWZ,MAAMC,QAAU,MAC5B,EAGAe,OAAOD,QAAU,SAAUE,GACtBA,EAAMC,QAAUN,aACnBA,WAAWZ,MAAMC,QAAU,OAE7B"}