Skip to content

Commit

Permalink
Merge pull request #1489 from ThatConference/feat/add-svelte-auth
Browse files Browse the repository at this point in the history
Feat/add svelte auth
  • Loading branch information
brettski authored Oct 19, 2023
2 parents b869326 + 3744d73 commit 832e381
Show file tree
Hide file tree
Showing 39 changed files with 1,720 additions and 2,977 deletions.
3,782 changes: 1,268 additions & 2,514 deletions package-lock.json

Large diffs are not rendered by default.

50 changes: 25 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "that-us",
"version": "3.14.3",
"version": "3.15.0",
"description": "THAT.us website",
"main": "index.js",
"type": "module",
Expand All @@ -24,34 +24,35 @@
"build:sitemap": "npx sitemap-generator-cli https://that.us --last-mod --change-freq weekly --filepath ./static/sitemap.xml --priority-map 1.0"
},
"devDependencies": {
"@auth0/nextjs-auth0": "^1.9.3",
"@commitlint/cli": "^17.6.6",
"@commitlint/config-conventional": "^17.6.6",
"@fortawesome/free-regular-svg-icons": "^6.4.0",
"@auth/core": "^0.17.0",
"@auth/sveltekit": "^0.3.10",
"@commitlint/cli": "^17.8.0",
"@commitlint/config-conventional": "^17.8.0",
"@fortawesome/free-regular-svg-icons": "^6.4.2",
"@fullhuman/postcss-purgecss": "^5.0.0",
"@okrad/svelte-progressbar": "^1.11.3",
"@sentry/svelte": "^7.73.0",
"@sentry/tracing": "^7.73.0",
"@stripe/stripe-js": "^1.42.0",
"@sveltejs/adapter-vercel": "^3.0.2",
"@sentry/svelte": "^7.74.1",
"@sentry/tracing": "^7.74.1",
"@stripe/stripe-js": "^1.54.2",
"@sveltejs/adapter-vercel": "^3.0.3",
"@sveltejs/kit": "1.22.3",
"@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/forms": "^0.5.3",
"@tailwindcss/typography": "^0.5.9",
"@vercel/analytics": "^1.0.2",
"@tailwindcss/forms": "^0.5.6",
"@tailwindcss/typography": "^0.5.10",
"@vercel/analytics": "^1.1.1",
"@xstate/inspect": "^0.7.1",
"@xstate/svelte": "^2.0.1",
"all-contributors-cli": "^6.26.0",
"archieml": "^0.5.0",
"autoprefixer": "^10.4.14",
"autoprefixer": "^10.4.16",
"clipboard": "^2.0.11",
"concurrently": "^8.2.0",
"concurrently": "^8.2.1",
"cssnano": "^5.1.15",
"dayjs": "^1.11.9",
"env-cmd": "^10.1.0",
"esbuild": "^0.18.11",
"eslint": "^8.44.0",
"eslint-config-prettier": "^8.8.0",
"esbuild": "^0.18.20",
"eslint": "^8.51.0",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-svelte3": "^4.0.0",
"fetch-retry": "^5.0.6",
"fuse.js": "^6.6.2",
Expand All @@ -69,10 +70,9 @@
"postcss": "^8.4.24",
"postcss-cli": "^10.1.0",
"postcss-load-config": "^4.0.1",
"prettier": "^2.8.8",
"prettier-eslint": "^15.0.1",
"prettier-plugin-tailwindcss": "^0.1.13",
"react": "^18.2.0",
"prettier": "^3.0.3",
"prettier-eslint": "^16.1.1",
"prettier-plugin-tailwindcss": "^0.5.6",
"rehype-autolink-headings": "^6.1.1",
"rehype-slug": "^5.1.0",
"remark-preview": "^1.0.2",
Expand All @@ -81,7 +81,7 @@
"svelte-awesome": "^3.2.1",
"svelte-checkbox": "^1.0.1",
"svelte-content-loader": "^1.1.3",
"svelte-flatpickr": "^3.3.2",
"svelte-flatpickr": "^3.3.3",
"svelte-headroom": "^2.2.1",
"svelte-infinite-scroll": "^2.0.1",
"svelte-input-mask": "^1.1.0",
Expand All @@ -91,13 +91,13 @@
"svelte-select": "^4.4.7",
"svelte-tags-input": "^3.0.0",
"sveltejs-forms": "^2.1.2",
"sveltekit-flash-message": "^1.0.0",
"sveltekit-flash-message": "^1.0.1",
"sveltekit-superforms": "^1.0.0",
"tailwindcss": "^3.3.2",
"uuid": "^9.0.0",
"uuid": "^9.0.1",
"vite": "^4.3.9",
"vite-plugin-sentry": "^1.3.0",
"xstate": "^4.38.0",
"xstate": "^4.38.2",
"yup": "^0.32.11",
"zod": "^3.21.4"
},
Expand Down
2 changes: 1 addition & 1 deletion src/_components/nav/UserProfile.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
</a>
<a
rel="external"
href="/api/auth/signup/"
href="/signup/"
class="block cursor-pointer px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">
Sign Up
</a>
Expand Down
5 changes: 3 additions & 2 deletions src/_components/nav/mainNav/Mobile.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@
<AddActivity />
</div>

<div class="my-4 flex flex-col space-y-5 px-4 sm:my-4 sm:px-6">
<div class="my-4 flex flex-col space-y-4 px-4 sm:my-4 sm:px-6">
{#if $page.data.user.isAuthenticated}
<MobileUsersProfile darkMode={true} />
{:else}
<StandardLink rel="external" href="/login/">Log in</StandardLink>
<StandardLink rel="external" href="/login/">Login</StandardLink>
<StandardLink rel="external" href="/signup/">Sign Up</StandardLink>
{/if}
</div>
2 changes: 1 addition & 1 deletion src/_utils/config.public.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const securityConfig = () => {
const config = {
clientID: env.PUBLIC_AUTH0_CLIENT_ID || configMissing('PUBLIC_AUTH0_CLIENT_ID'),
baseURL: env.PUBLIC_AUTH0_BASE_URL || `https://that.us`,
issuerBaseURL: `https://auth.that.tech`,
issuerBaseURL: `https://auth.that.tech/`,

authorizationParams: {
scope: env.PUBLIC_AUTH0_SCOPE || 'openid profile email offline_access',
Expand Down
100 changes: 0 additions & 100 deletions src/_utils/security/auth.js

This file was deleted.

4 changes: 0 additions & 4 deletions src/_utils/security/client.js

This file was deleted.

5 changes: 0 additions & 5 deletions src/_utils/security/server.js

This file was deleted.

23 changes: 23 additions & 0 deletions src/_utils/security/svelteAuth/parseJwt.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// JWT parsing

// Decodes jwt payload, doesn't validate signature
export const parseOnly = (jwt) => {
let base64Payload;
if (jwt?.split) {
[, base64Payload] = jwt?.split('.') ?? [];
}
let jsonPayload = null;
if (base64Payload) {
jsonPayload = Buffer.from(base64Payload, 'base64').toString('utf8');
}
let payload = null;
if (typeof jsonPayload === 'string') {
payload = JSON.parse(jsonPayload);
}

if (payload?.sub) {
return payload;
}

return null;
};
Loading

0 comments on commit 832e381

Please sign in to comment.