misc: fix logging in even when email isn't verified

This commit is contained in:
Xyphyn committed 2023-09-26 18:53:13 -07:00
1 parent ac147086f1
commit cec0bbc132
2 files changed
+13 -6

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "photon-lemmy",
"version": "1.12.2",
"version": "1.13.0",
"private": true,
"scripts": {
"dev": "vite dev",
+12 -5
View File
@@ -19,6 +19,7 @@
QuestionMarkCircle,
XCircle,
} from 'svelte-hero-icons'
import { instance as currentInstance } from '$lib/instance.js'
export let data
@@ -63,19 +64,25 @@
})
toast({
content: `Signed up.${
res.verify_email_sent ? ' A verification email was sent.' : ''
}`,
content: 'Signed up.',
type: 'success',
})
if (res?.jwt) {
if (res?.jwt && res.verify_email_sent) {
await setUser(res.jwt, $page.params.instance, username)
toast({ content: 'Successfully logged in.', type: 'success' })
goto('/')
} else if (res.verify_email_sent) {
currentInstance.set(instance)
toast({
content:
'A verification link was sent to your email. Verify your email, and then you can log in.',
type: 'info',
})
goto('/')
} else {
throw new Error('Invalid credentials')
throw new Error('Failed to sign up.')
}
} catch (err) {
toast({