Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ PUBLIC_BRAND_NAME=BotSharp
PUBLIC_ADMIN_USERNAME=admin@gmail.com
PUBLIC_ADMIN_PASSWORD=123456
PUBLIC_COMPANY_NAME=SciSharp STACK
PUBLIC_PLUGIN_DEFAULT_ICON=https://avatars.githubusercontent.com/u/44989469?s=200&v=4
PUBLIC_PLUGIN_DEFAULT_ICON=https://avatars.githubusercontent.com/u/44989469?s=200&v=4
PUBLIC_ALLOW_SIGNUP=false
3 changes: 2 additions & 1 deletion src/lib/common/Loader.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<script>
import { Circle } from 'svelte-loading-spinners';
export let size=100
</script>

<div class="loader">
<Circle size="100" color="#6F42C1" unit="px" duration="1s" />
<Circle {size} color="var(--bs-primary)" unit="px" duration="1s" />
</div>
4 changes: 2 additions & 2 deletions src/lib/common/ProfileDropdown.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
export let user;
function logout() {
if (browser){
localStorage.removeItem('authUser');
localStorage.removeItem('user');
}
goto('/');
};
Expand All @@ -27,7 +27,7 @@
</DropdownToggle>
<DropdownMenu end>
<!-- item-->
<DropdownItem href="/page/myProfile"
<DropdownItem href="/page/user/me"
><i class="bx bx-user font-size-16 align-middle me-1" />
<span>Profile</span>
</DropdownItem>
Expand Down
32 changes: 28 additions & 4 deletions src/routes/(authentication)/login/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,36 @@
PUBLIC_BRAND_NAME,
PUBLIC_ADMIN_USERNAME,
PUBLIC_ADMIN_PASSWORD,
PUBLIC_COMPANY_NAME
PUBLIC_COMPANY_NAME,
PUBLIC_ALLOW_SIGNUP
} from '$env/static/public';
import { onMount } from 'svelte';

let username = PUBLIC_ADMIN_USERNAME;
let password = PUBLIC_ADMIN_PASSWORD;
let isOpen = false;
let msg = '';
let status = '';
let isSubmitting = false;
let isRememberMe = false;
onMount(() => {
const userName = localStorage.getItem('user_name');
isRememberMe = userName !== null;
if(isRememberMe){
username = userName;
}
});
function handleRememberMe(){
if(isRememberMe){
localStorage.setItem("user_name", username);
}
else {
localStorage.removeItem("user_name");
}
}
async function onSubmit(e) {
isSubmitting = true;
handleRememberMe();
e.preventDefault();
await getToken(username, password, () => {
isOpen = true;
Expand Down Expand Up @@ -62,7 +81,7 @@
<Container>
<Row class="justify-content-center">
{#if isSubmitting}
<Loader />
<Loader size={50} />
{/if}
<Col md={8} lg={6} xl={5}>
<Card class="overflow-hidden">
Expand Down Expand Up @@ -133,7 +152,12 @@
</div>

<div class="form-check">
<input class="form-check-input" type="checkbox" id="remember-check" />
<input
class="form-check-input"
type="checkbox"
id="remember-check"
bind:checked={isRememberMe}
/>
<Label class="form-check-label" for="remember-check">Remember me</Label>
</div>

Expand Down Expand Up @@ -178,7 +202,7 @@
</CardBody>
</Card>
<div class="mt-5 text-center">
<p>
<p hidden={!(PUBLIC_ALLOW_SIGNUP === 'true')}>
Don&apos;t have an account ?
<Link href="/register" class="fw-medium text-primary">Signup now</Link>
</p>
Expand Down
2 changes: 1 addition & 1 deletion src/routes/page/dashboard/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
</Col>
</Row>
<div class="mt-4">
<Link href="/page/myProfile" class="btn btn-primary waves-effect waves-light btn-sm">
<Link href="/page/user/me" class="btn btn-primary waves-effect waves-light btn-sm">
View Profile <i class="mdi mdi-arrow-right ms-1" />
</Link>
</div>
Expand Down
1 change: 1 addition & 0 deletions svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const config = {
"/page/plugin/[pluginId]",
"/page/setting",
"/page/mongodb",
"/page/user/me",
"/chat",
"/chat/[agentId]",
"/chat/[agentId]/[conversationId]",
Expand Down