Hotfix/remove state params after login (#443)

* hide autofill in profilr settings

* fix Image width

* Remove state search params after login

* fix biome
This commit is contained in:
Ilya Y 2024-04-22 16:47:37 +03:00 committed by GitHub
parent cca858dadf
commit 36fff73af6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 16 additions and 10 deletions

View File

@ -22,6 +22,7 @@ img {
.articleContent {
img:not([data-disable-lightbox='true']) {
cursor: zoom-in;
width: 100%;
}
}

View File

@ -227,13 +227,15 @@ export const HeaderAuth = (props: Props) => {
<Show
when={isAuthenticatedControlsVisible()}
fallback={
<div class={clsx(styles.userControlItem, styles.userControlItemVerbose, 'loginbtn')}>
<a href="?m=auth&mode=login">
<span class={styles.textLabel}>{t('Enter')}</span>
<Icon name="key" class={styles.icon} />
{/*<Icon name="user-default" class={clsx(styles.icon, styles.iconHover)} />*/}
</a>
</div>
<Show when={!isAuthenticated()}>
<div class={clsx(styles.userControlItem, styles.userControlItemVerbose, 'loginbtn')}>
<a href="?m=auth&mode=login">
<span class={styles.textLabel}>{t('Enter')}</span>
<Icon name="key" class={styles.icon} />
{/*<Icon name="user-default" class={clsx(styles.icon, styles.iconHover)} />*/}
</a>
</div>
</Show>
}
>
<Show when={!isSaveButtonVisible()}>

View File

@ -264,6 +264,7 @@ export const ProfileSettings = () => {
type="text"
name="username"
id="username"
autocomplete="one-time-code"
placeholder={t('Name')}
onInput={(event) => updateFormField('name', event.currentTarget.value)}
value={form.name}
@ -289,6 +290,7 @@ export const ProfileSettings = () => {
type="text"
name="user-address"
id="user-address"
autocomplete="one-time-code2"
onInput={(event) => updateFormField('slug', event.currentTarget.value)}
value={form.slug}
ref={(el) => (slugInputRef.current = el)}

View File

@ -1,5 +1,5 @@
import type { Accessor, JSX, Resource } from 'solid-js'
import type { AuthModalSource } from '../components/Nav/AuthModal/types'
import type { AuthModalSearchParams, AuthModalSource } from '../components/Nav/AuthModal/types'
import type { Author } from '../graphql/schema/core.gen'
import {
@ -29,7 +29,6 @@ import {
import { inboxClient } from '../graphql/client/chat'
import { apiClient } from '../graphql/client/core'
import { notifierClient } from '../graphql/client/notifier'
import { useRouter } from '../stores/router'
import { showModal } from '../stores/ui'
import { addAuthors } from '../stores/zine/authors'
@ -136,6 +135,7 @@ export const SessionProvider = (props: {
const [isSessionLoaded, setIsSessionLoaded] = createSignal(false)
const [authError, setAuthError] = createSignal('')
const { clearSearchParams } = useRouter<AuthModalSearchParams>()
// Function to load session data
const sessionData = async () => {
@ -143,7 +143,7 @@ export const SessionProvider = (props: {
const s: ApiResponse<AuthToken> = await authorizer().getSession()
if (s?.data) {
console.info('[context.session] loading session', s)
clearSearchParams()
// Set session expiration time in local storage
const expires_at = new Date(Date.now() + s.data.expires_in * 1000)
localStorage.setItem('expires_at', `${expires_at.getTime()}`)
@ -379,6 +379,7 @@ export const SessionProvider = (props: {
}
const isAuthenticated = createMemo(() => Boolean(author()))
const actions = {
loadSession,
requireAuthentication,