gptsite / gradio /templates /frontend /assets /Login.31bff0cc.js.map
sunxianfeng's picture
Duplicate from jumei/gptsite
11b6e82
{"version":3,"file":"Login.31bff0cc.js","sources":["../../../../ui/packages/app/src/Login.svelte"],"sourcesContent":["<script lang=\"ts\">\n\timport { Component as Form } from \"./components/Form\";\n\timport { Component as Textbox } from \"./components/Textbox\";\n\timport { Button } from \"@gradio/button\";\n\timport { Component as Column } from \"./components/Column\";\n\texport let root: string;\n\texport let auth_message: string | null;\n\texport let app_mode: boolean;\n\texport let is_space: boolean;\n\n\tlet username = \"\";\n\tlet password = \"\";\n\tlet incorrect_credentials = false;\n\n\tconst submit = async () => {\n\t\tconst formData = new FormData();\n\t\tformData.append(\"username\", username);\n\t\tformData.append(\"password\", password);\n\n\t\tlet response = await fetch(root + \"/login\", {\n\t\t\tmethod: \"POST\",\n\t\t\tbody: formData\n\t\t});\n\t\tif (response.status === 400) {\n\t\t\tincorrect_credentials = true;\n\t\t\tusername = \"\";\n\t\t\tpassword = \"\";\n\t\t} else if (response.status == 200) {\n\t\t\tlocation.reload();\n\t\t}\n\t};\n</script>\n\n<div class=\"wrap\" class:min-h-screen={app_mode}>\n\t<Column variant=\"panel\" min_width={480}>\n\t\t<h2>Login</h2>\n\t\t{#if auth_message}\n\t\t\t<p class=\"auth\">{auth_message}</p>\n\t\t{/if}\n\t\t{#if is_space}\n\t\t\t<p class=\"auth\">\n\t\t\t\tIf you are visiting a HuggingFace Space in Incognito mode, you must\n\t\t\t\tenable third party cookies.\n\t\t\t</p>\n\t\t{/if}\n\t\t{#if incorrect_credentials}\n\t\t\t<p class=\"creds\">Incorrect Credentials</p>\n\t\t{/if}\n\t\t<Form>\n\t\t\t<Textbox\n\t\t\t\tlabel=\"username\"\n\t\t\t\tlines={1}\n\t\t\t\tshow_label={true}\n\t\t\t\tmax_lines={1}\n\t\t\t\tmode=\"dynamic\"\n\t\t\t\ton:submit={submit}\n\t\t\t\tbind:value={username}\n\t\t\t/>\n\t\t\t<Textbox\n\t\t\t\tlabel=\"password\"\n\t\t\t\tlines={1}\n\t\t\t\tshow_label={true}\n\t\t\t\tmax_lines={1}\n\t\t\t\tmode=\"dynamic\"\n\t\t\t\ttype=\"password\"\n\t\t\t\ton:submit={submit}\n\t\t\t\tbind:value={password}\n\t\t\t/>\n\t\t</Form>\n\n\t\t<Button\n\t\t\tsize=\"lg\"\n\t\t\tvariant=\"primary\"\n\t\t\tstyle={{ full_width: true }}\n\t\t\ton:click={submit}\n\t\t>\n\t\t\tLogin\n\t\t</Button>\n\t</Column>\n</div>\n\n<style>\n\t.wrap {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tjustify-content: center;\n\t\talign-items: center;\n\t\tmargin-top: var(--size-3);\n\t\tbackground: var(--background-fill-primary);\n\t\twidth: var(--size-full);\n\t}\n\n\th2 {\n\t\tmargin-bottom: var(--size-3);\n\t\tcolor: var(--body-text-color);\n\t\tfont-weight: var(--section-header-text-weight);\n\t\tfont-size: var(--text-xl);\n\t}\n\n\t.auth {\n\t\tmargin-top: var(--size-1);\n\t\tmargin-bottom: var(--size-1);\n\t\tcolor: var(--body-text-color);\n\t}\n\n\t.creds {\n\t\tmargin-top: var(--size-4);\n\t\tmargin-bottom: var(--size-4);\n\t\tcolor: var(--error-text-color);\n\t\tfont-weight: var(--weight-semibold);\n\t}\n</style>\n"],"names":[],"mappings":"0qBAqCoB,iDAAjB,iCAAiB;4EAGjB,mJAMA,2GAKQ,aACK,aACD,kBAGC,wBAAA,mEADD,0DAKJ,aACK,aACD,wCAIC,yBAAA,mEADD,qIATC,+DAUA,oMASd,OAEA,yEAzCK,aAGA,YAMA,6HA4BK,WAAY,2DACX,4KAvCX,yHACK,sEAGA,6DAMA,mcAX6B,oIADE,cAAtC,qHAAsC,kHA5B1B,WACA,mBACA,eACA,cAEP,EAAW,GACX,EAAW,GACX,EAAwB,QAEtB,kBACC,MAAe,UACrB,EAAS,OAAO,WAAY,CAAQ,EACpC,EAAS,OAAO,WAAY,CAAQ,KAEhC,QAAiB,OAAM,EAAO,UACjC,OAAQ,OACR,KAAM,IAEH,EAAS,SAAW,SACvB,EAAwB,EAAI,MAC5B,EAAW,EAAE,MACb,EAAW,EAAE,GACH,EAAS,QAAU,KAC7B,SAAS,wBA4BI,yBAUA"}