sveltekit-auth-example 1.0.14 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
* Refactor $env/dynamic/private and public
|
|
5
5
|
* Add password complexity checking on /register and /profile pages (only checks for length currently despite what the pages say)
|
|
6
6
|
|
|
7
|
+
# 1.0.15
|
|
8
|
+
* [Bug] Replaced use of Action type in +server.ts files (only works for +page.server.ts)
|
|
9
|
+
|
|
7
10
|
# 1.0.14
|
|
8
11
|
* Refactor routing to be folder, not file-based - https://github.com/sveltejs/kit/discussions/5774 (file system router). More info: https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3294867
|
|
9
12
|
* Move bootstrap SCSS import to JavaScript in +layout.svelte
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sveltekit-auth-example",
|
|
3
3
|
"description": "SvelteKit Authentication Example",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.15",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Nate Stuyvesant",
|
|
7
7
|
"license": "https://github.com/nstuyvesant/sveltekit-auth-example/blob/master/LICENSE",
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { error, json } from '@sveltejs/kit'
|
|
2
|
-
import type { Action } from './$types'
|
|
1
|
+
import { error, json, type RequestHandler } from '@sveltejs/kit'
|
|
3
2
|
import { query } from '../../../_db'
|
|
4
3
|
|
|
5
|
-
export const PUT:
|
|
4
|
+
export const PUT: RequestHandler = async event => {
|
|
6
5
|
const { user } = event.locals
|
|
7
6
|
|
|
8
7
|
if (!user)
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { error, json } from '@sveltejs/kit'
|
|
2
|
-
import type { Action } from './$types'
|
|
1
|
+
import { error, json, type RequestHandler } from '@sveltejs/kit'
|
|
3
2
|
import { query } from '../../_db'
|
|
4
3
|
|
|
5
|
-
export const POST:
|
|
4
|
+
export const POST: RequestHandler = async (event) => {
|
|
6
5
|
const { slug } = event.params
|
|
7
6
|
|
|
8
7
|
let result
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RequestHandler } from '@sveltejs/kit'
|
|
2
2
|
import type { Secret } from 'jsonwebtoken'
|
|
3
3
|
import jwt from 'jsonwebtoken'
|
|
4
4
|
import dotenv from 'dotenv'
|
|
@@ -9,7 +9,7 @@ dotenv.config()
|
|
|
9
9
|
const DOMAIN = process.env.DOMAIN
|
|
10
10
|
const JWT_SECRET = process.env.JWT_SECRET
|
|
11
11
|
|
|
12
|
-
export const POST:
|
|
12
|
+
export const POST: RequestHandler = async event => {
|
|
13
13
|
const body = await event.request.json()
|
|
14
14
|
const sql = `SELECT id as "userId" FROM users WHERE email = $1 LIMIT 1;`
|
|
15
15
|
const { rows } = await query(sql, [body.email])
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { error } from '@sveltejs/kit'
|
|
2
|
-
import type { Action } from './$types'
|
|
1
|
+
import { error, type RequestHandler } from '@sveltejs/kit'
|
|
3
2
|
import { OAuth2Client } from 'google-auth-library'
|
|
4
3
|
import { query } from '../../_db';
|
|
5
4
|
import { config } from '$lib/config'
|
|
@@ -42,7 +41,7 @@ async function upsertGoogleUser(user: Partial<User>): Promise<UserSession> {
|
|
|
42
41
|
}
|
|
43
42
|
|
|
44
43
|
// Returns local user if Google user authenticated (and authorized our app)
|
|
45
|
-
export const POST:
|
|
44
|
+
export const POST: RequestHandler = async event => {
|
|
46
45
|
try {
|
|
47
46
|
const { token } = await event.request.json()
|
|
48
47
|
const user = await getGoogleUserFromJWT(token)
|