Component + Login cleanup

This commit is contained in:
Philipp Dormann 2021-01-03 15:55:46 +01:00
parent 89fcfe6a49
commit b1114634e8
2 changed files with 6 additions and 16 deletions

View File

@ -5,14 +5,12 @@
import FileUpload from "./FileUpload.svelte";
import FormLayout from "./FormLayout.svelte";
import Pagination from "./Pagination.svelte";
import StatCards from "./StatCards.svelte";
import Table from "./Table.svelte";
import Tabs from "./Tabs.svelte";
import Tags from "./Tags.svelte";
</script>
<div class="border-4 border-dashed rounded h-96" />
<StatCards />
<div class="border-4 border-dashed rounded h-96 mb-4" />
<div class="mb-8">
<FileUpload />
</div>

View File

@ -8,8 +8,8 @@
import Toastify from "toastify-js";
import "toastify-js/src/toastify.css";
// ------
let usersUsername;
let usersPassword = "";
let username = "demo";
let password = "demo";
let is_blocked_by_autologin = false;
let last_loginclick_processed = true;
@ -37,14 +37,6 @@
text: $_("login_is_checked"),
duration: 500,
}).showToast();
let username = usersUsername;
let password = usersPassword;
// if ((usersUsername + "").length == 0) {
username = config.fallback_username || "demo";
// }
// if ((usersPassword + "").length == 0) {
password = config.fallback_password || "demo";
// }
AuthService.authControllerLogin({
username,
password,
@ -54,7 +46,7 @@
OpenAPI.TOKEN = result.access_token;
const jwtinfo = JSON.parse(atob(OpenAPI.TOKEN.split(".")[1]));
store.login(result.access_token, jwtinfo);
replace("/");
location.replace("/");
Toastify({
text: $_("welcome_wavinghand"),
duration: 500,
@ -111,14 +103,14 @@
class="border-gray-300 placeholder-gray-500 appearance-none rounded-none relative block w-full px-3 py-2 border rounded-t-md focus:outline-none focus:shadow-outline-blue focus:border-blue-300 focus:z-10 sm:text-sm"
on:keydown={handleKeydown}
placeholder={$_('email_address_or_username')}
bind:value={usersUsername} />
bind:value={username} />
</div>
<div class="-mt-px relative">
<input
aria-label={$_('password')}
type="password"
required=""
bind:value={usersPassword}
bind:value={password}
class="border-gray-300 placeholder-gray-500 appearance-none rounded-none relative block w-full px-3 py-2 border rounded-b-md focus:outline-none focus:shadow-outline-blue focus:border-blue-300 focus:z-10 sm:text-sm"
on:keydown={handleKeydown}
placeholder={$_('password')} />