From 71aa1b309c14500c4e6bb7a02d01bc736807f7f8 Mon Sep 17 00:00:00 2001 From: "Alfonso Saavedra \"Son Link" Date: Thu, 25 Jul 2024 15:04:42 +0200 Subject: [PATCH] Adding the dashboard. From there, the user can change his data (except for the username) and password. In the future you will have more options --- app/Config/Routes.php | 1 + app/Controllers/Dashboard.php | 85 +++++++++- app/Views/dashboard/header.php | 27 ++++ app/Views/dashboard/main.php | 1 + app/Views/dashboard/user.php | 288 +++++++++++++++++++++++++++++++++ app/Views/templates/footer.php | 1 + public/css/dashboard.css | 19 ++- public/css/fonts/sd.eot | Bin 0 -> 2832 bytes public/css/fonts/sd.svg | 18 +++ public/css/fonts/sd.ttf | Bin 0 -> 2688 bytes public/css/fonts/sd.woff | Bin 0 -> 2764 bytes public/css/sd-icons.css | 55 +++++++ public/css/style.css | 1 + public/js/axios.min.js | 2 + public/js/dashboard.js | 41 ++++- 15 files changed, 535 insertions(+), 4 deletions(-) create mode 100644 app/Views/dashboard/header.php create mode 100644 app/Views/dashboard/main.php create mode 100644 app/Views/dashboard/user.php create mode 100644 public/css/fonts/sd.eot create mode 100644 public/css/fonts/sd.svg create mode 100644 public/css/fonts/sd.ttf create mode 100644 public/css/fonts/sd.woff create mode 100644 public/css/sd-icons.css create mode 100644 public/js/axios.min.js diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 7096152..904dbdd 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -13,6 +13,7 @@ $routes->get('track/(:any)', 'Tracks::index/$1'); $routes->get('race/(:num)', 'Races::index/$1'); $routes->get('users', 'Users::index'); $routes->get('login', 'Users::login'); +$routes->get('register', 'Register::index'); $routes->post('webserver', 'Webserver::index'); $routes->group('dashboard', static function ($routes) { diff --git a/app/Controllers/Dashboard.php b/app/Controllers/Dashboard.php index 4dc539e..7e72cbc 100644 --- a/app/Controllers/Dashboard.php +++ b/app/Controllers/Dashboard.php @@ -10,6 +10,9 @@ class Dashboard extends BaseController protected $usersModel; use ResponseTrait; + const HASH = PASSWORD_DEFAULT; + const COST = 16; + public function __construct() { $this->usersModel = new UsersModel(); @@ -32,7 +35,7 @@ class Dashboard extends BaseController //$tplData['users'] = $users; echo get_header('Dashboard', [], true); echo view('dashboard/main.php', $tplData); - echo get_footer(); + echo get_footer(['dashboard.js']); } public function login() @@ -49,11 +52,89 @@ class Dashboard extends BaseController echo get_header("My User", [], true); echo view('dashboard/user', ['user' => $user]); - echo get_footer(); + echo get_footer(['dashboard.js']); } public function users() { $users = $this->usersModel->findAll(); return $this->respond($users); } + + public function logout() + { + $this->session->destroy(); + return redirect()->to('login'); + } + + public function updateUser() + { + $data = $this->request->getVar(); + + $response = [ + 'ok' => true, + 'msg' => '' + ]; + + $update = $this->usersModel->update($this->session->userid, $data); + + if (!$update) $this->respond(['ok' => false, 'msg' => 'Error on update data']); + + $file = $this->request->getFile('imginput'); + if ($file && $file->getName()) + { + // Verify is the file is correct and not, for example, a .exe renamed to .jpg + $ext = strtolower($file->guessExtension()); + + if ($ext != strtolower($file->getExtension())) $response['msg'] = 'The image is not valid'; + else + { + + // First, get the current avatar filnename, and delete if the extension is different + $userData = $this->usersModel->getUser($this->session->username); + $avatar = FCPATH . '/img/users/'. $userData->img; + $oldAvatarFile = new \CodeIgniter\Files\File($avatar); + if ($oldAvatarFile->getExtension() != $ext) unlink($avatar); + + $filename = "{$this->session->username}.$ext"; + $move = $file->move(FCPATH . '/img/users/', $filename, true); + if ($move) $update = $this->usersModel->update($this->session->userid, (object) ['img' => $filename]); + } + } + + return $this->respond($response); + } + + public function changePasswd() + { + $data = $this->request->getPost(); + + $response = [ + 'ok' => false, + 'msg' => '' + ]; + + if (!$data) + { + $response['msg'] = 'Not data send'; + return $this->respond($response); + } + + $query = $this->usersModel->select('password')->where('id', $this->session->userid)->get(1); + + if (!$query) return $this->respond($response); + + $user = $query->getRow(); + if (!password_verify($data['cur_password'], $user->password)) + { + $response['msg'] = 'The current password is not correct'; + return $this->respond($response); + } + + $password = password_hash($data['password'], self::HASH, [self::COST]); + + $update = $this->usersModel->update($this->session->userid, (object) ['password' => $password]); + + $response['ok'] = $update; + return $this->respond($response); + } } \ No newline at end of file diff --git a/app/Views/dashboard/header.php b/app/Views/dashboard/header.php new file mode 100644 index 0000000..01c5c56 --- /dev/null +++ b/app/Views/dashboard/header.php @@ -0,0 +1,27 @@ + + + + + + + + <?=$title?> + + + + + + + + + +
+

+
+ +
diff --git a/app/Views/dashboard/main.php b/app/Views/dashboard/main.php new file mode 100644 index 0000000..6b76cad --- /dev/null +++ b/app/Views/dashboard/main.php @@ -0,0 +1 @@ +

Speed Dreams Dashboard

\ No newline at end of file diff --git a/app/Views/dashboard/user.php b/app/Views/dashboard/user.php new file mode 100644 index 0000000..022bb6d --- /dev/null +++ b/app/Views/dashboard/user.php @@ -0,0 +1,288 @@ +

User data

+
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ + Email address isn't valid +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+ img}" ?>" id="profile-img"> +
+
+
+ +
+
+
+ +

Password

+
+
+ + + + + + + Passwords don't match +
+ +
+
+
+ + \ No newline at end of file diff --git a/app/Views/templates/footer.php b/app/Views/templates/footer.php index e7796aa..b06836d 100644 --- a/app/Views/templates/footer.php +++ b/app/Views/templates/footer.php @@ -3,6 +3,7 @@ const base_url = ''; + diff --git a/public/css/dashboard.css b/public/css/dashboard.css index 9fa02d4..15d9336 100644 --- a/public/css/dashboard.css +++ b/public/css/dashboard.css @@ -20,13 +20,30 @@ a.selected { #dashmenu, header { - margin-top: 1rem; + padding-top: 1rem; } /* Menu */ +#dashmenu { + display: flex; + flex-direction: column; + height: 100vh; +} + #dashmenu a { text-decoration: none; + padding: 8px; + transition: none; +} + +#dashmenu a:hover { + background-color: #4a4a4a; + color: #eee; +} + +#dashmenu a > i { + margin-right: 8px; } /* Edit user */ diff --git a/public/css/fonts/sd.eot b/public/css/fonts/sd.eot new file mode 100644 index 0000000000000000000000000000000000000000..b3163158db2276ab604d0130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rG>^K_lo=o^@)EaoT}1p{S(4=FBm@dJiW&d>)q4lJEYSBee>pJY6h#&@T9(qfUV zcwNKIWX4Yc$y0i|P_2l;M6ebybh51Z&R|Ed%d6}&g+mF`va6$(WhO!)Bx_PpI)gCJ zTh@Lv%9s6ldu+_k|8!U+V0gHvx3_0l+H0jFDYWLd%c*2CRjwpKl~AywBN%ep{h8dr z0Lyw$Z*+DxG0?B+{y@O5YyAU>+1dWy9!=(feru+tcY{_Q4SsSW$eBk&W18CW*kT4E z_oHt!fC{u}lrAB=$B9(qYVy?H=Z`>?fr=hSifhkKX!eQRuN9Q1ZH6b^@?t@c-=v3NW-DkTs9^7|}eGudngBV?QR zk88$>7PWIm2XQtOj`oE?ebI0T9}#L4{Lve!+s}24|C0hP07M`Ea^QQP_U$SY6^D9u z2r7w*+c?A|RdXQcbcLV5n z6^_zwI_bylHMAaTt@TK_L5gi$MqIiryC7d|%Wm8;p0?}(ezq<9@x?wZ-U2Qk5E0Rm zC9L9nTb6-~8(jFf@VnHO-FV8WZP^3dYRi5q(en0!cmUQHx3*v0SdZm%_WyqMwcJ|m z)y1V-tBtM4AB-*2g^l%{*wW(q;#Om4aUu4?-Plt%Hs&`r)^l{hc|`6|43Er3JSWA| fvOzoO7l6G$chNpYH{dl777xxGvMF9opF#fx$1=gI literal 0 HcmV?d00001 diff --git a/public/css/fonts/sd.svg b/public/css/fonts/sd.svg new file mode 100644 index 0000000..f53d34a --- /dev/null +++ b/public/css/fonts/sd.svg @@ -0,0 +1,18 @@ + + + +Generated by IcoMoon + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/css/fonts/sd.ttf b/public/css/fonts/sd.ttf new file mode 100644 index 0000000000000000000000000000000000000000..cd6048bd0b39b065f7fc9f6e2fe8058d970e99e5 GIT binary patch literal 2688 zcmb7GTWlj|6+UOi_V|{|*q)grb`skY+hpzajPILGNOK{p?QYVQc59;|R;{}UNwc{% z$+EjpN+c@i6N`B315Ze(%_77@r3yr8RH^MlDM*MQB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md&} z-uf|LUmrg_oPu3yz+XSwuiu|sYphKk9^%Orb#l(XhfFHb1TD~YTBmPeo{E^GXcP^! z0WMNP=;DJ7SI*D}IRRTHovD@_8)8z4bO!fM@npmz+xfbNm&r^#W=K7zXNt9|7)&H< z5kn`-TIddT1$(^80aG}XG%dR}W?5!36hg746s0=|_kv{|w4!|3U$Do=?ZPicL;*%d z`uh9(Mx_0AIZ{GveYcWMrP7sZ3Q!FNySjoQhaSx42M1Z!`}(7EbIHM&ruzc{zpljw zlXG*i{yt6S!I(8$*Lwl0j|M+I5#;Qnp)pPUWNa}5k^9lz44?yT8ly|7?nxolgqnJ6 z@A79Sj8bc=Q@`3tX~U0I&OAInKmW`#^YiDA_BlJ5%Vu+v4t?0(zH{n0{iFR${H`@V zJ^^?$8VZL)(Kda5ES^Zj$E4KJpMRG_ZZ?<8VuW1l{z=a`*`jyO=m5@z!qI^+U?3U} z;S!-ofq(g7`u4Lu6aS=u3kIT3-W&YUXS~y8qT|rd4j{+*9mbEU08lZ~X$ZDGZIeh7 z`sbk&>8A({(JP$ei~OcEAYGLHEw92OMi0`<;%xw&tin+`q?>-$S%Y{YPu3&h1u1px zGVGa-?1Fr;BfIg&csjBN_Ol(?j~n}x_%Gn{!6Gu+vV>Kf@5nOj;sqBmE_|0dvYT{L zJF*9Mt0ViVOe;H!v_p%HrR|*;HaFshyiE;SqHP#opiSDKIG(vY+3m14y}Gn~YpuCW zR}r{Ow`h%;wB2@H*xcBSFE4E@Z8vw97UR#~jX!x~b76CHBTpBc;dU|LGV(T@Nt(0^ bz6jg%bQknVx`C(#pqM(3%87qXp9B8|bf2|@ literal 0 HcmV?d00001 diff --git a/public/css/fonts/sd.woff b/public/css/fonts/sd.woff new file mode 100644 index 0000000000000000000000000000000000000000..e69519a13099477c614c3d7d21ef300250fbbdac GIT binary patch literal 2764 zcmb7GTWlj|6+UOi_V|{|*q)grb`skY+hpzajPILGNOK|4c6Za2c59;|R&BZoNwc|Z zlPueXQX+wXCl>KUA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j$E4KZUw)rMZ8n$7 zVuW1l{_&Y{s>Rtkqk}jX3P%URpn+&OgiC}o3jXVl(|4ZknfNCKTmXnZ{?*`5KhvF4 zCQcmAvqPwHeuwd+DhN`Hbee+gNE;Gm!v8#WGW`^xA^I-o_yWH!4M-QHf6Hr#h|z=e zl6V_H$6w(%9nnoc?|g%JB9FgE!V6OB;4<(`$9BQK(6QZkV>}((1N>~q_T$DrA^sO| z`GAOuwk_c+&Ub7XxOl-ujthSmJGPs2QaiQ>xYe=!RHoIPCEB5-#`5;gb6cD7Lf)nZ zEz>r@=V*&IDUN3@Pj)-4Ew3)G++JVYrmIL?q1&`hi?rPi&2Me)##fd%m$w&pmzUzt z-i<$gV{2h+Yco&t&TzXJa0PXn&LoSp3%vyFS-K1PINd=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(u&&c){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),A(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:L(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},t}function c(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}function l(e,t,r,n,o,i,a){try{var s=e[i](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,o)}function h(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(e){l(i,n,o,a,s,"next",e)}function s(e){l(i,n,o,a,s,"throw",e)}a(void 0)}))}}function p(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r2&&void 0!==arguments[2]?arguments[2]:{},i=o.allOwnKeys,a=void 0!==i&&i;if(null!=e)if("object"!==f(e)&&(e=[e]),L(e))for(r=0,n=e.length;r0;)if(t===(r=n[o]).toLowerCase())return r;return null}var Y="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Q=function(e){return!N(e)&&e!==Y};var Z,ee=(Z="undefined"!=typeof Uint8Array&&j(Uint8Array),function(e){return Z&&e instanceof Z}),te=A("HTMLFormElement"),re=function(e){var t=Object.prototype.hasOwnProperty;return function(e,r){return t.call(e,r)}}(),ne=A("RegExp"),oe=function(e,t){var r=Object.getOwnPropertyDescriptors(e),n={};X(r,(function(r,o){var i;!1!==(i=t(r,o,e))&&(n[o]=i||r)})),Object.defineProperties(e,n)},ie="abcdefghijklmnopqrstuvwxyz",ae="0123456789",se={DIGIT:ae,ALPHA:ie,ALPHA_DIGIT:ie+ie.toUpperCase()+ae};var ue=A("AsyncFunction"),ce={isArray:L,isArrayBuffer:_,isBuffer:function(e){return null!==e&&!N(e)&&null!==e.constructor&&!N(e.constructor)&&F(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:function(e){var t;return e&&("function"==typeof FormData&&e instanceof FormData||F(e.append)&&("formdata"===(t=k(e))||"object"===t&&F(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&_(e.buffer)},isString:C,isNumber:U,isBoolean:function(e){return!0===e||!1===e},isObject:D,isPlainObject:B,isReadableStream:W,isRequest:G,isResponse:K,isHeaders:V,isUndefined:N,isDate:I,isFile:q,isBlob:z,isRegExp:ne,isFunction:F,isStream:function(e){return D(e)&&F(e.pipe)},isURLSearchParams:H,isTypedArray:ee,isFileList:M,forEach:X,merge:function e(){for(var t=Q(this)&&this||{},r=t.caseless,n={},o=function(t,o){var i=r&&$(n,o)||o;B(n[i])&&B(t)?n[i]=e(n[i],t):B(t)?n[i]=e({},t):L(t)?n[i]=t.slice():n[i]=t},i=0,a=arguments.length;i3&&void 0!==arguments[3]?arguments[3]:{},o=n.allOwnKeys;return X(t,(function(t,n){r&&F(t)?e[n]=x(t,r):e[n]=t}),{allOwnKeys:o}),e},trim:function(e){return e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e},inherits:function(e,t,r,n){e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:function(e,t,r,n){var o,i,a,s={};if(t=t||{},null==e)return t;do{for(i=(o=Object.getOwnPropertyNames(e)).length;i-- >0;)a=o[i],n&&!n(a,e,t)||s[a]||(t[a]=e[a],s[a]=!0);e=!1!==r&&j(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:k,kindOfTest:A,endsWith:function(e,t,r){e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;var n=e.indexOf(t,r);return-1!==n&&n===r},toArray:function(e){if(!e)return null;if(L(e))return e;var t=e.length;if(!U(t))return null;for(var r=new Array(t);t-- >0;)r[t]=e[t];return r},forEachEntry:function(e,t){for(var r,n=(e&&e[Symbol.iterator]).call(e);(r=n.next())&&!r.done;){var o=r.value;t.call(e,o[0],o[1])}},matchAll:function(e,t){for(var r,n=[];null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:te,hasOwnProperty:re,hasOwnProp:re,reduceDescriptors:oe,freezeMethods:function(e){oe(e,(function(t,r){if(F(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;var n=e[r];F(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=function(){throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:function(e,t){var r={},n=function(e){e.forEach((function(e){r[e]=!0}))};return L(e)?n(e):n(String(e).split(t)),r},toCamelCase:function(e){return e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r}))},noop:function(){},toFiniteNumber:function(e,t){return null!=e&&Number.isFinite(e=+e)?e:t},findKey:$,global:Y,isContextDefined:Q,ALPHABET:se,generateString:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:16,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:se.ALPHA_DIGIT,r="",n=t.length;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&F(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:function(e){var t=new Array(10);return function e(r,n){if(D(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[n]=r;var o=L(r)?[]:{};return X(r,(function(t,r){var i=e(t,n+1);!N(i)&&(o[r]=i)})),t[n]=void 0,o}}return r}(e,0)},isAsyncFn:ue,isThenable:function(e){return e&&(D(e)||F(e))&&F(e.then)&&F(e.catch)}};function fe(e,t,r,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),o&&(this.response=o)}ce.inherits(fe,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ce.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var le=fe.prototype,he={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((function(e){he[e]={value:e}})),Object.defineProperties(fe,he),Object.defineProperty(le,"isAxiosError",{value:!0}),fe.from=function(e,t,r,n,o,i){var a=Object.create(le);return ce.toFlatObject(e,a,(function(e){return e!==Error.prototype}),(function(e){return"isAxiosError"!==e})),fe.call(a,e.message,t,r,n,o),a.cause=e,a.name=e.name,i&&Object.assign(a,i),a};function pe(e){return ce.isPlainObject(e)||ce.isArray(e)}function de(e){return ce.endsWith(e,"[]")?e.slice(0,-2):e}function ye(e,t,r){return e?e.concat(t).map((function(e,t){return e=de(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}var ve=ce.toFlatObject(ce,{},null,(function(e){return/^is[A-Z]/.test(e)}));function me(e,t,r){if(!ce.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;var n=(r=ce.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!ce.isUndefined(t[e])}))).metaTokens,o=r.visitor||c,i=r.dots,a=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&ce.isSpecCompliantForm(t);if(!ce.isFunction(o))throw new TypeError("visitor must be a function");function u(e){if(null===e)return"";if(ce.isDate(e))return e.toISOString();if(!s&&ce.isBlob(e))throw new fe("Blob is not supported. Use a Buffer instead.");return ce.isArrayBuffer(e)||ce.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function c(e,r,o){var s=e;if(e&&!o&&"object"===f(e))if(ce.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(ce.isArray(e)&&function(e){return ce.isArray(e)&&!e.some(pe)}(e)||(ce.isFileList(e)||ce.endsWith(r,"[]"))&&(s=ce.toArray(e)))return r=de(r),s.forEach((function(e,n){!ce.isUndefined(e)&&null!==e&&t.append(!0===a?ye([r],n,i):null===a?r:r+"[]",u(e))})),!1;return!!pe(e)||(t.append(ye(o,r,i),u(e)),!1)}var l=[],h=Object.assign(ve,{defaultVisitor:c,convertValue:u,isVisitable:pe});if(!ce.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!ce.isUndefined(r)){if(-1!==l.indexOf(r))throw Error("Circular reference detected in "+n.join("."));l.push(r),ce.forEach(r,(function(r,i){!0===(!(ce.isUndefined(r)||null===r)&&o.call(t,r,ce.isString(i)?i.trim():i,n,h))&&e(r,n?n.concat(i):[i])})),l.pop()}}(e),t}function be(e){var t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function ge(e,t){this._pairs=[],e&&me(e,this,t)}var we=ge.prototype;function Ee(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Oe(e,t,r){if(!t)return e;var n,o=r&&r.encode||Ee,i=r&&r.serialize;if(n=i?i(t,r):ce.isURLSearchParams(t)?t.toString():new ge(t,r).toString(o)){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e}we.append=function(e,t){this._pairs.push([e,t])},we.toString=function(e){var t=e?function(t){return e.call(this,t,be)}:be;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var Se,xe=function(){function e(){p(this,e),this.handlers=[]}return y(e,[{key:"use",value:function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}},{key:"eject",value:function(e){this.handlers[e]&&(this.handlers[e]=null)}},{key:"clear",value:function(){this.handlers&&(this.handlers=[])}},{key:"forEach",value:function(e){ce.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}]),e}(),Re={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Te={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ge,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},je="undefined"!=typeof window&&"undefined"!=typeof document,ke=(Se="undefined"!=typeof navigator&&navigator.product,je&&["ReactNative","NativeScript","NS"].indexOf(Se)<0),Ae="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Pe=je&&window.location.href||"http://localhost",Le=s(s({},Object.freeze({__proto__:null,hasBrowserEnv:je,hasStandardBrowserWebWorkerEnv:Ae,hasStandardBrowserEnv:ke,origin:Pe})),Te);function Ne(e){function t(e,r,n,o){var i=e[o++];if("__proto__"===i)return!0;var a=Number.isFinite(+i),s=o>=e.length;return i=!i&&ce.isArray(n)?n.length:i,s?(ce.hasOwnProp(n,i)?n[i]=[n[i],r]:n[i]=r,!a):(n[i]&&ce.isObject(n[i])||(n[i]=[]),t(e,r,n[i],o)&&ce.isArray(n[i])&&(n[i]=function(e){var t,r,n={},o=Object.keys(e),i=o.length;for(t=0;t-1,i=ce.isObject(e);if(i&&ce.isHTMLForm(e)&&(e=new FormData(e)),ce.isFormData(e))return o?JSON.stringify(Ne(e)):e;if(ce.isArrayBuffer(e)||ce.isBuffer(e)||ce.isStream(e)||ce.isFile(e)||ce.isBlob(e)||ce.isReadableStream(e))return e;if(ce.isArrayBufferView(e))return e.buffer;if(ce.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return me(e,new Le.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return Le.isNode&&ce.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((r=ce.isFileList(e))||n.indexOf("multipart/form-data")>-1){var a=this.env&&this.env.FormData;return me(r?{"files[]":e}:e,a&&new a,this.formSerializer)}}return i||o?(t.setContentType("application/json",!1),function(e,t,r){if(ce.isString(e))try{return(t||JSON.parse)(e),ce.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||_e.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(ce.isResponse(e)||ce.isReadableStream(e))return e;if(e&&ce.isString(e)&&(r&&!this.responseType||n)){var o=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(o){if("SyntaxError"===e.name)throw fe.from(e,fe.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Le.classes.FormData,Blob:Le.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ce.forEach(["delete","get","head","post","put","patch"],(function(e){_e.headers[e]={}}));var Ce=_e,Fe=ce.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Ue=Symbol("internals");function De(e){return e&&String(e).trim().toLowerCase()}function Be(e){return!1===e||null==e?e:ce.isArray(e)?e.map(Be):String(e)}function Ie(e,t,r,n,o){return ce.isFunction(n)?n.call(this,t,r):(o&&(t=r),ce.isString(t)?ce.isString(n)?-1!==t.indexOf(n):ce.isRegExp(n)?n.test(t):void 0:void 0)}var qe=function(e,t){function r(e){p(this,r),e&&this.set(e)}return y(r,[{key:"set",value:function(e,t,r){var n=this;function o(e,t,r){var o=De(t);if(!o)throw new Error("header name must be a non-empty string");var i=ce.findKey(n,o);(!i||void 0===n[i]||!0===r||void 0===r&&!1!==n[i])&&(n[i||t]=Be(e))}var i=function(e,t){return ce.forEach(e,(function(e,r){return o(e,r,t)}))};if(ce.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(ce.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i(function(e){var t,r,n,o={};return e&&e.split("\n").forEach((function(e){n=e.indexOf(":"),t=e.substring(0,n).trim().toLowerCase(),r=e.substring(n+1).trim(),!t||o[t]&&Fe[t]||("set-cookie"===t?o[t]?o[t].push(r):o[t]=[r]:o[t]=o[t]?o[t]+", "+r:r)})),o}(e),t);else if(ce.isHeaders(e)){var a,s=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=E(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}(e.entries());try{for(s.s();!(a=s.n()).done;){var u=m(a.value,2),c=u[0];o(u[1],c,r)}}catch(e){s.e(e)}finally{s.f()}}else null!=e&&o(t,e,r);return this}},{key:"get",value:function(e,t){if(e=De(e)){var r=ce.findKey(this,e);if(r){var n=this[r];if(!t)return n;if(!0===t)return function(e){for(var t,r=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;t=n.exec(e);)r[t[1]]=t[2];return r}(n);if(ce.isFunction(t))return t.call(this,n,r);if(ce.isRegExp(t))return t.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}},{key:"has",value:function(e,t){if(e=De(e)){var r=ce.findKey(this,e);return!(!r||void 0===this[r]||t&&!Ie(0,this[r],r,t))}return!1}},{key:"delete",value:function(e,t){var r=this,n=!1;function o(e){if(e=De(e)){var o=ce.findKey(r,e);!o||t&&!Ie(0,r[o],o,t)||(delete r[o],n=!0)}}return ce.isArray(e)?e.forEach(o):o(e),n}},{key:"clear",value:function(e){for(var t=Object.keys(this),r=t.length,n=!1;r--;){var o=t[r];e&&!Ie(0,this[o],o,e,!0)||(delete this[o],n=!0)}return n}},{key:"normalize",value:function(e){var t=this,r={};return ce.forEach(this,(function(n,o){var i=ce.findKey(r,o);if(i)return t[i]=Be(n),void delete t[o];var a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r}))}(o):String(o).trim();a!==o&&delete t[o],t[a]=Be(n),r[a]=!0})),this}},{key:"concat",value:function(){for(var e,t=arguments.length,r=new Array(t),n=0;n1?r-1:0),o=1;on)return o&&(clearTimeout(o),o=null),r=a,e.apply(null,arguments);o||(o=setTimeout((function(){return o=null,r=Date.now(),e.apply(null,t)}),n-(a-r)))}}ce.inherits(Je,fe,{__CANCEL__:!0});var Ve=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3,n=0,o=Ge(50,250);return Ke((function(r){var i=r.loaded,a=r.lengthComputable?r.total:void 0,s=i-n,u=o(s);n=i;var c={loaded:i,total:a,progress:a?i/a:void 0,bytes:s,rate:u||void 0,estimated:u&&a&&i<=a?(a-i)/u:void 0,event:r,lengthComputable:null!=a};c[t?"download":"upload"]=!0,e(c)}),r)},Xe=Le.hasStandardBrowserEnv?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function n(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=n(window.location.href),function(t){var r=ce.isString(t)?n(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0},$e=Le.hasStandardBrowserEnv?{write:function(e,t,r,n,o,i){var a=[e+"="+encodeURIComponent(t)];ce.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),ce.isString(n)&&a.push("path="+n),ce.isString(o)&&a.push("domain="+o),!0===i&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function Ye(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var Qe=function(e){return e instanceof ze?s({},e):e};function Ze(e,t){t=t||{};var r={};function n(e,t,r){return ce.isPlainObject(e)&&ce.isPlainObject(t)?ce.merge.call({caseless:r},e,t):ce.isPlainObject(t)?ce.merge({},t):ce.isArray(t)?t.slice():t}function o(e,t,r){return ce.isUndefined(t)?ce.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function i(e,t){if(!ce.isUndefined(t))return n(void 0,t)}function a(e,t){return ce.isUndefined(t)?ce.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(r,o,i){return i in t?n(r,o):i in e?n(void 0,r):void 0}var u={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:s,headers:function(e,t){return o(Qe(e),Qe(t),!0)}};return ce.forEach(Object.keys(Object.assign({},e,t)),(function(n){var i=u[n]||o,a=i(e[n],t[n],n);ce.isUndefined(a)&&i!==s||(r[n]=a)})),r}var et,tt,rt,nt,ot=function(e){var t,r,n=Ze({},e),o=n.data,i=n.withXSRFToken,a=n.xsrfHeaderName,s=n.xsrfCookieName,u=n.headers,c=n.auth;if(n.headers=u=ze.from(u),n.url=Oe(Ye(n.baseURL,n.url),e.params,e.paramsSerializer),c&&u.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),ce.isFormData(o))if(Le.hasStandardBrowserEnv||Le.hasStandardBrowserWebWorkerEnv)u.setContentType(void 0);else if(!1!==(t=u.getContentType())){var f=t?t.split(";").map((function(e){return e.trim()})).filter(Boolean):[],l=g(r=f)||w(r)||E(r)||S(),h=l[0],p=l.slice(1);u.setContentType([h||"multipart/form-data"].concat(b(p)).join("; "))}if(Le.hasStandardBrowserEnv&&(i&&ce.isFunction(i)&&(i=i(n)),i||!1!==i&&Xe(n.url))){var d=a&&s&&$e.read(s);d&&u.set(a,d)}return n},it="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){var n,o=ot(e),i=o.data,a=ze.from(o.headers).normalize(),s=o.responseType;function u(){o.cancelToken&&o.cancelToken.unsubscribe(n),o.signal&&o.signal.removeEventListener("abort",n)}var c=new XMLHttpRequest;function f(){if(c){var n=ze.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());We((function(e){t(e),u()}),(function(e){r(e),u()}),{data:s&&"text"!==s&&"json"!==s?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:n,config:e,request:c}),c=null}}c.open(o.method.toUpperCase(),o.url,!0),c.timeout=o.timeout,"onloadend"in c?c.onloadend=f:c.onreadystatechange=function(){c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(f)},c.onabort=function(){c&&(r(new fe("Request aborted",fe.ECONNABORTED,o,c)),c=null)},c.onerror=function(){r(new fe("Network Error",fe.ERR_NETWORK,o,c)),c=null},c.ontimeout=function(){var e=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded",t=o.transitional||Re;o.timeoutErrorMessage&&(e=o.timeoutErrorMessage),r(new fe(e,t.clarifyTimeoutError?fe.ETIMEDOUT:fe.ECONNABORTED,o,c)),c=null},void 0===i&&a.setContentType(null),"setRequestHeader"in c&&ce.forEach(a.toJSON(),(function(e,t){c.setRequestHeader(t,e)})),ce.isUndefined(o.withCredentials)||(c.withCredentials=!!o.withCredentials),s&&"json"!==s&&(c.responseType=o.responseType),"function"==typeof o.onDownloadProgress&&c.addEventListener("progress",Ve(o.onDownloadProgress,!0)),"function"==typeof o.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",Ve(o.onUploadProgress)),(o.cancelToken||o.signal)&&(n=function(t){c&&(r(!t||t.type?new Je(null,e,c):t),c.abort(),c=null)},o.cancelToken&&o.cancelToken.subscribe(n),o.signal&&(o.signal.aborted?n():o.signal.addEventListener("abort",n)));var l,h,p=(l=o.url,(h=/^([-+\w]{1,25})(:?\/\/|:)/.exec(l))&&h[1]||"");p&&-1===Le.protocols.indexOf(p)?r(new fe("Unsupported protocol "+p+":",fe.ERR_BAD_REQUEST,e)):c.send(i||null)}))},at=function(e,t){var r,n=new AbortController,o=function(e){if(!r){r=!0,a();var t=e instanceof Error?e:this.reason;n.abort(t instanceof fe?t:new Je(t instanceof Error?t.message:t))}},i=t&&setTimeout((function(){o(new fe("timeout ".concat(t," of ms exceeded"),fe.ETIMEDOUT))}),t),a=function(){e&&(i&&clearTimeout(i),i=null,e.forEach((function(e){e&&(e.removeEventListener?e.removeEventListener("abort",o):e.unsubscribe(o))})),e=null)};e.forEach((function(e){return e&&e.addEventListener&&e.addEventListener("abort",o)}));var s=n.signal;return s.unsubscribe=a,[s,function(){i&&clearTimeout(i),i=null}]},st=u().mark((function e(t,r){var n,o,i;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.byteLength,r&&!(n1?"since :\n"+s.map(Et).join("\n"):" "+Et(s[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function xt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Je(null,e)}function Rt(e){return xt(e),e.headers=ze.from(e.headers),e.data=Me.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),St(e.adapter||Ce.adapter)(e).then((function(t){return xt(e),t.data=Me.call(e,e.transformResponse,t),t.headers=ze.from(t.headers),t}),(function(t){return He(t)||(xt(e),t&&t.response&&(t.response.data=Me.call(e,e.transformResponse,t.response),t.response.headers=ze.from(t.response.headers))),Promise.reject(t)}))}var Tt="1.7.2",jt={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){jt[e]=function(r){return f(r)===e||"a"+(t<1?"n ":" ")+e}}));var kt={};jt.transitional=function(e,t,r){function n(e,t){return"[Axios v1.7.2] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,o,i){if(!1===e)throw new fe(n(o," has been removed"+(t?" in "+t:"")),fe.ERR_DEPRECATED);return t&&!kt[o]&&(kt[o]=!0,console.warn(n(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,o,i)}};var At={assertOptions:function(e,t,r){if("object"!==f(e))throw new fe("options must be an object",fe.ERR_BAD_OPTION_VALUE);for(var n=Object.keys(e),o=n.length;o-- >0;){var i=n[o],a=t[i];if(a){var s=e[i],u=void 0===s||a(s,i,e);if(!0!==u)throw new fe("option "+i+" must be "+u,fe.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new fe("Unknown option "+i,fe.ERR_BAD_OPTION)}},validators:jt},Pt=At.validators,Lt=function(){function e(t){p(this,e),this.defaults=t,this.interceptors={request:new xe,response:new xe}}var t;return y(e,[{key:"request",value:(t=h(u().mark((function e(t,r){var n,o;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this._request(t,r);case 3:return e.abrupt("return",e.sent);case 6:if(e.prev=6,e.t0=e.catch(0),e.t0 instanceof Error){Error.captureStackTrace?Error.captureStackTrace(n={}):n=new Error,o=n.stack?n.stack.replace(/^.+\n/,""):"";try{e.t0.stack?o&&!String(e.t0.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(e.t0.stack+="\n"+o):e.t0.stack=o}catch(e){}}throw e.t0;case 10:case"end":return e.stop()}}),e,this,[[0,6]])}))),function(e,r){return t.apply(this,arguments)})},{key:"_request",value:function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{};var r=t=Ze(this.defaults,t),n=r.transitional,o=r.paramsSerializer,i=r.headers;void 0!==n&&At.assertOptions(n,{silentJSONParsing:Pt.transitional(Pt.boolean),forcedJSONParsing:Pt.transitional(Pt.boolean),clarifyTimeoutError:Pt.transitional(Pt.boolean)},!1),null!=o&&(ce.isFunction(o)?t.paramsSerializer={serialize:o}:At.assertOptions(o,{encode:Pt.function,serialize:Pt.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();var a=i&&ce.merge(i.common,i[t.method]);i&&ce.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete i[e]})),t.headers=ze.concat(a,i);var s=[],u=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(u=u&&e.synchronous,s.unshift(e.fulfilled,e.rejected))}));var c,f=[];this.interceptors.response.forEach((function(e){f.push(e.fulfilled,e.rejected)}));var l,h=0;if(!u){var p=[Rt.bind(this),void 0];for(p.unshift.apply(p,s),p.push.apply(p,f),l=p.length,c=Promise.resolve(t);h0;)n._listeners[t](e);n._listeners=null}})),this.promise.then=function(e){var t,r=new Promise((function(e){n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},t((function(e,t,o){n.reason||(n.reason=new Je(e,t,o),r(n.reason))}))}return y(e,[{key:"throwIfRequested",value:function(){if(this.reason)throw this.reason}},{key:"subscribe",value:function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}},{key:"unsubscribe",value:function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}}}],[{key:"source",value:function(){var t;return{token:new e((function(e){t=e})),cancel:t}}}]),e}();var Ct={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ct).forEach((function(e){var t=m(e,2),r=t[0],n=t[1];Ct[n]=r}));var Ft=Ct;var Ut=function e(t){var r=new Nt(t),n=x(Nt.prototype.request,r);return ce.extend(n,Nt.prototype,r,{allOwnKeys:!0}),ce.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(Ze(t,r))},n}(Ce);return Ut.Axios=Nt,Ut.CanceledError=Je,Ut.CancelToken=_t,Ut.isCancel=He,Ut.VERSION=Tt,Ut.toFormData=me,Ut.AxiosError=fe,Ut.Cancel=Ut.CanceledError,Ut.all=function(e){return Promise.all(e)},Ut.spread=function(e){return function(t){return e.apply(null,t)}},Ut.isAxiosError=function(e){return ce.isObject(e)&&!0===e.isAxiosError},Ut.mergeConfig=Ze,Ut.AxiosHeaders=ze,Ut.formToJSON=function(e){return Ne(ce.isHTMLForm(e)?new FormData(e):e)},Ut.getAdapter=St,Ut.HttpStatusCode=Ft,Ut.default=Ut,Ut})); +//# sourceMappingURL=axios.min.js.map diff --git a/public/js/dashboard.js b/public/js/dashboard.js index 99f89b7..d60aad6 100644 --- a/public/js/dashboard.js +++ b/public/js/dashboard.js @@ -14,4 +14,43 @@ $('#login-form').on('submit', function(e) { } } }); -}); \ No newline at end of file +}); + +$('#user-edit-form > form').on('submit', function(e) { + e.preventDefault() + + const formData = new FormData(this); + + axios.post('/dashboard/update_user', formData) + .then( resp => { + if (resp.data) window.location.reload() + }) +}) + +if (typeof nation !== 'undefined') { + $('#flaginput > option').each( ele => { + if (ele.innerText == nation) { + $(ele).attr('selected', true) + return true + } + }) +} + +$('#user-passwd-form > form').on('submit', function(e) { + e.preventDefault() + + $('#passwd-error').hide(); + const formData = new FormData(this); + if (formData.get('password') != formData.get('passwordcheck')) { + $('#passwd-error').show(); + return; + } + + axios.post('/dashboard/change_passwd', formData) + .then( resp => { + if (resp.data) { + if (resp.data.ok) window.location.reload() + else alert(resp.data.msg) + } + }) +}) \ No newline at end of file