sveltekit-auth-example 1.0.31 → 1.0.32
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 +6 -0
- package/package.json +3 -3
- package/src/app.d.ts +0 -13
- package/src/lib/google.ts +1 -1
- package/src/routes/+layout.svelte +0 -21
- package/static/apple-touch-icon.png +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
# Backlog
|
|
2
2
|
* Add password complexity checking on /register and /profile pages (only checks for length currently despite what the pages say)
|
|
3
3
|
|
|
4
|
+
# 1.0.32
|
|
5
|
+
* Remove window from reference to google.accounts
|
|
6
|
+
* Add apple-touch-icon.png
|
|
7
|
+
* Update dependencies
|
|
8
|
+
* Remove dead code
|
|
9
|
+
|
|
4
10
|
# 1.0.31
|
|
5
11
|
* Cleanup
|
|
6
12
|
* Update SvelteKit
|
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.32",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Nate Stuyvesant",
|
|
7
7
|
"license": "https://github.com/nstuyvesant/sveltekit-auth-example/blob/master/LICENSE",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"engines": {
|
|
35
35
|
"node": "~18.11.0",
|
|
36
|
-
"npm": "^8.19.
|
|
36
|
+
"npm": "^8.19.3"
|
|
37
37
|
},
|
|
38
38
|
"type": "module",
|
|
39
39
|
"dependencies": {
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"jsonwebtoken": "^8.5.1",
|
|
57
57
|
"prettier": "^2.7.1",
|
|
58
58
|
"prettier-plugin-svelte": "^2.8.0",
|
|
59
|
-
"sass": "^1.
|
|
59
|
+
"sass": "^1.56.0",
|
|
60
60
|
"svelte": "^3.52.0",
|
|
61
61
|
"svelte-check": "^2.9.2",
|
|
62
62
|
"svelte-preprocess": "^4.10.7",
|
package/src/app.d.ts
CHANGED
|
@@ -40,19 +40,6 @@ interface Credentials {
|
|
|
40
40
|
password: string
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
interface GoogleCredentialResponse {
|
|
44
|
-
credential: string
|
|
45
|
-
select_by:
|
|
46
|
-
| 'auto'
|
|
47
|
-
| 'user'
|
|
48
|
-
| 'user_1tap'
|
|
49
|
-
| 'user_2tap'
|
|
50
|
-
| 'btn'
|
|
51
|
-
| 'btn_confirm'
|
|
52
|
-
| 'btn_add_session'
|
|
53
|
-
| 'btn_confirm_add_session'
|
|
54
|
-
}
|
|
55
|
-
|
|
56
43
|
interface MessageAddressee {
|
|
57
44
|
email: string
|
|
58
45
|
name?: string
|
package/src/lib/google.ts
CHANGED
|
@@ -35,27 +35,6 @@
|
|
|
35
35
|
if (!$loginSession) google.accounts.id.prompt()
|
|
36
36
|
})
|
|
37
37
|
|
|
38
|
-
async function googleCallback(response: google.accounts.id.CredentialResponse) {
|
|
39
|
-
const res = await fetch('/auth/google', {
|
|
40
|
-
method: 'POST',
|
|
41
|
-
headers: {
|
|
42
|
-
'Content-Type': 'application/json'
|
|
43
|
-
},
|
|
44
|
-
body: JSON.stringify({ token: response.credential })
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
if (res.ok) {
|
|
48
|
-
const fromEndpoint = await res.json()
|
|
49
|
-
loginSession.set(fromEndpoint.user) // update loginSession store
|
|
50
|
-
const { role } = fromEndpoint.user
|
|
51
|
-
const referrer = $page.url.searchParams.get('referrer')
|
|
52
|
-
if (referrer) return goto(referrer)
|
|
53
|
-
if (role === 'teacher') return goto('/teachers')
|
|
54
|
-
if (role === 'admin') return goto('/admin')
|
|
55
|
-
if (location.pathname === '/login') goto('/') // logged in so go home
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
38
|
async function logout() {
|
|
60
39
|
// Request server delete httpOnly cookie called loginSession
|
|
61
40
|
const url = '/auth/logout'
|
|
Binary file
|