Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auth page #53

Draft
wants to merge 47 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
8940faf
fix: restructure logos
michaelbrusegard Sep 12, 2024
f01754d
fix news skeleton text skeleton
michaelbrusegard Sep 26, 2024
c47a4f4
feat: initial auth page
michaelbrusegard Sep 26, 2024
41331df
Merge branch 'dev' into auth-page
michaelbrusegard Sep 26, 2024
eb16112
Merge branch 'auth-and-user' into auth-page
michaelbrusegard Sep 26, 2024
f4d6990
chore: merge with old auth branch
michaelbrusegard Sep 26, 2024
c1bac67
feat: add login page frontend
michaelbrusegard Sep 26, 2024
58392b1
fix: build
michaelbrusegard Sep 26, 2024
dc62dc2
chore: update dockerfile context
michaelbrusegard Oct 6, 2024
378ffca
fix: logo props
michaelbrusegard Oct 12, 2024
29eb618
Merge branch 'dev' into auth-page
michaelbrusegard Oct 12, 2024
6f762fe
chore: fix padding on main element to not remove background
michaelbrusegard Oct 12, 2024
8033626
typo: correct language to use sign in instead of login
michaelbrusegard Oct 13, 2024
3792169
chore: add main element to error pages
michaelbrusegard Oct 13, 2024
c3e83f7
feat: tailwindcss plugins
michaelbrusegard Oct 13, 2024
31973c3
fix: formatting errors
michaelbrusegard Oct 13, 2024
31ecf7f
chore: add separator role
michaelbrusegard Oct 13, 2024
28f6aad
perf: replace size with h and w everywhere to improve performance
michaelbrusegard Oct 13, 2024
7cc2129
fix: os specific syntax for lefthook install
michaelbrusegard Oct 13, 2024
a01f0be
feat: made header logo responsive transition smooth
michaelbrusegard Oct 13, 2024
03de392
Merge branch 'dev' into auth-page
michaelbrusegard Oct 31, 2024
b0b88b0
cchroe: cleanup docker and package.json
michaelbrusegard Oct 31, 2024
4482f45
chore: cleanup api
michaelbrusegard Oct 31, 2024
7f5fc36
feat: update middleware
michaelbrusegard Oct 31, 2024
53d4e94
feat: add success particles
michaelbrusegard Oct 31, 2024
5561c91
fix: badge not being hoverable
michaelbrusegard Nov 7, 2024
a34397c
feat: add account signin form
michaelbrusegard Nov 7, 2024
1343259
feat: seperate out tables and add seeding
michaelbrusegard Nov 7, 2024
5351dd3
feat: setup password and session auth methods
michaelbrusegard Nov 7, 2024
b2d0525
chore: remove eslint comment not applicable in biome
michaelbrusegard Nov 7, 2024
15df843
feat: add auth check to auth index
michaelbrusegard Nov 7, 2024
9c572ab
feat: add initial schema
michaelbrusegard Nov 7, 2024
4ac843c
chore: remvoe lucia dependency
michaelbrusegard Nov 7, 2024
b13debc
Merge branch 'dev' into auth-page
michaelbrusegard Nov 7, 2024
9a5bdd2
chore: update lockfile
michaelbrusegard Nov 7, 2024
8ebc3f1
feat: add missing oauth dependency
michaelbrusegard Nov 7, 2024
4b48e94
fix: oslo dependency
michaelbrusegard Nov 7, 2024
0999ed1
chore: update lockfile
michaelbrusegard Nov 7, 2024
eb580f7
feat: add skills to seeding
michaelbrusegard Nov 10, 2024
998660a
chore: fixup docker locally
michaelbrusegard Nov 10, 2024
b36724f
feat: add default toast on API error
michaelbrusegard Nov 10, 2024
4b962e3
feat: create rpc toast error type
michaelbrusegard Nov 10, 2024
029fa38
chore: work on getting locale onthe backend through headers
michaelbrusegard Nov 12, 2024
65986b7
Revert "chore: work on getting locale onthe backend through headers"
michaelbrusegard Nov 14, 2024
1570073
fix: backend bug and start auth flow with feide
michaelbrusegard Nov 14, 2024
d186ffb
fix: ability to set cookies in trpc
michaelbrusegard Nov 17, 2024
095df5b
fix: feide route
michaelbrusegard Nov 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Also, setup environment variables by copying the `.env.example` file to `.env` a
Then, run the development server:

```bash
bun dev
bun --bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
Expand All @@ -31,13 +31,13 @@ When you build the project, you pre-render all the Server Side Generated (SSG) p
You can build the project with the following command:

```bash
bun run build
bun --bun run build
```

To serve the build locally, run:

```bash
bun run start
bun --bun run start
```

### Check linting and formatting
Expand Down
Binary file modified bun.lockb
Binary file not shown.
24 changes: 24 additions & 0 deletions compose.local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
services:
db:
image: postgres:16
restart: unless-stopped
environment:
POSTGRES_USER: ${DATABASE_USER}
POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
POSTGRES_DB: ${DATABASE_NAME}
volumes:
- ./data/db:/var/lib/postgresql/data
ports:
- 5432:5432
s3:
image: bitnami/minio:2024
restart: unless-stopped
environment:
MINIO_ROOT_USER: ${STORAGE_USER}
MINIO_ROOT_PASSWORD: ${STORAGE_PASSWORD}
MINIO_DEFAULT_BUCKETS: ${STORAGE_NAME}
volumes:
- ./data/s3:/bitnami/minio/data
ports:
- 9000:9000
- 9001:9001
8 changes: 5 additions & 3 deletions docker-compose.yml → compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
services:
app:
build:
context: .
dockerfile: Dockerfile
build: .
depends_on:
- db
- s3
Expand All @@ -18,6 +16,8 @@ services:
POSTGRES_DB: ${DATABASE_NAME}
volumes:
- ./data/db:/var/lib/postgresql/data
networks:
- nginx_default
s3:
image: bitnami/minio:2024
restart: unless-stopped
Expand All @@ -27,6 +27,8 @@ services:
MINIO_DEFAULT_BUCKETS: ${STORAGE_NAME}
volumes:
- ./data/s3:/bitnami/minio/data
networks:
- nginx_default
networks:
nginx_default:
external: true
3 changes: 2 additions & 1 deletion drizzle.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { env } from '@/env';
import { defineConfig } from 'drizzle-kit';

const config = defineConfig({
schema: './src/server/db/schema/*.ts',
out: './src/server/db/migrations',
schema: './src/server/db/tables/*.ts',
dialect: 'postgresql',
dbCredentials: {
url: `postgresql://${env.DATABASE_USER}:${env.DATABASE_PASSWORD}@${env.DATABASE_HOST}:${env.DATABASE_PORT}/${env.DATABASE_NAME}`,
Expand Down
41 changes: 38 additions & 3 deletions messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,50 @@
"selectMonth": "Select month",
"selectYear": "Select year",
"pickDate": "Pick a date",
"dateFormat": "dd/MM/yyyy"
"dateFormat": "dd/MM/yyyy",
"hidePassword": "Hide password",
"showPassword": "Show password"
},
"error": {
"notFound": "404 - Page not found",
"notFoundDescription": "Oops! Looks like this page got lost in cyberspace.",
"error": "Oops! Something went wrong",
"errorDescription": "Don't worry, our best hackers are on it!",
"goToHomepage": "Return to homepage",
"tryAgain": "Try again"
"tryAgain": "Try again",
"invalidLocale": "Invalid locale: {locale}"
},
"auth": {
"welcome": "Welcome!",
"description": "Is it your first time here? Use Feide",
"signInWith": "Sign in with",
"hackerspaceAccount": "Hackerspace Account",
"success": "Success!",
"home": "Home",
"signIn": "Sign in",
"useYourAccount": "Use your account",
"forgotPassword": "Forgot password?",
"submit": "Submit",
"form": {
"username": {
"label": "Username",
"required": "Username is required",
"minLength": "Username must be at least 5 characters",
"maxLength": "Username must be less than 8 characters",
"invalid": "Username must contain only letters"
},
"password": {
"label": "Password",
"required": "Password is required",
"minLength": "Password must be at least 8 characters",
"maxLength": "Password must be less than 50 characters",
"uppercase": "Password must contain at least one uppercase letter",
"specialChar": "Password must contain at least one special character",
"confirmLabel": "Confirm password",
"mismatch": "Passwords do not match",
"weak": "Password is too weak"
}
}
},
"layout": {
"hackerspaceHome": "Hackerspace homepage",
Expand Down Expand Up @@ -60,7 +95,7 @@
"visitInstagram": "Visit our Instagram",
"NTNUIDI": "NTNU Department of Computer Science",
"NTNUIDIURL": "https://www.ntnu.edu/idi",
"NTNUKiD": "The working life network KID",
"NTNUNexus": "The working life network Nexus",
"copyright": "Copyright",
"allRightsReserved": "All rights reserved"
},
Expand Down
41 changes: 38 additions & 3 deletions messages/no.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,50 @@
"selectMonth": "Velg måned",
"selectYear": "Velg år",
"pickDate": "Velg en dato",
"dateFormat": "dd.MM.yyyy"
"dateFormat": "dd.MM.yyyy",
"hidePassword": "Gjem passord",
"showPassword": "Vis passord"
},
"error": {
"notFound": "404 - Siden ble ikke funnet",
"notFoundDescription": "Oops! Ser ut som denne siden gikk seg vill i cyberspace.",
"error": "Oops! Noe gikk galt",
"errorDescription": "Ikke bekymre deg, våre beste hackere jobber med saken!",
"goToHomepage": "Gå tilbake til hjemmesiden",
"tryAgain": "Prøv igjen"
"tryAgain": "Prøv igjen",
"invalidLocale": "Ugyldig språk: {locale}"
},
"auth": {
"welcome": "Velkommen!",
"description": "Er du her for første gang? Bruk Feide",
"signInWith": "Logg inn med",
"hackerspaceAccount": "Hackerspace-konto",
"success": "Suksess!",
"home": "Hjem",
"signIn": "Logg inn",
"useYourAccount": "Bruk din konto",
"forgotPassword": "Glemt passord?",
"submit": "Send",
"form": {
"username": {
"label": "Brukernavn",
"required": "Brukernavn er påkrevd",
"minLength": "Brukernavn må være minst 5 tegn",
"maxLength": "Brukernavn må være mindre enn 8 tegn",
"invalid": "Brukernavn må kun inneholde bokstaver"
},
"password": {
"label": "Passord",
"required": "Passord er påkrevd",
"minLength": "Passord må være minst 8 tegn",
"maxLength": "Passord må være mindre enn 50 tegn",
"uppercase": "Passord må inneholde minst én stor bokstav",
"specialChar": "Passord må inneholde minst ett spesialtegn",
"confirmLabel": "Bekreft passord",
"mismatch": "Passordene stemmer ikke overens",
"weak": "Passordet er for svakt"
}
}
},
"layout": {
"hackerspaceHome": "Hackerspace hjemmeside",
Expand Down Expand Up @@ -60,7 +95,7 @@
"visitInstagram": "Besøk Instagram",
"NTNUIDI": "NTNU Institutt for datateknologi og informatikk",
"NTNUIDIURL": "https://www.ntnu.no/idi",
"NTNUKiD": "Arbeidslivsnettverket KID",
"NTNUNexus": "Arbeidslivsnettverket Nexus",
"copyright": "Opphavsrett",
"allRightsReserved": "Alle rettigheter reservert"
},
Expand Down
21 changes: 15 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,26 @@
"type": "module",
"scripts": {
"prepare": "cross-env-shell '[ \"$NODE_ENV\" != \"production\" ] && lefthook install || exit 0'",
"dev": "next dev --turbopack",
"dev": "next dev",
"lint": "biome check --write",
"prebuild": "next telemetry disable",
"build": "next build",
"postbuild": "mkdir -p .next/standalone/public .next/standalone/.next/static && cp -r public/* .next/standalone/public && cp -r .next/static/* .next/standalone/.next/static",
"start": "bun run .next/standalone/server.js",
"db:start": "docker-compose up db",
"start": "drizzle-kit migrate && bun run .next/standalone/server.js",
"db:start": "docker compose -f compose.local.yml up db -d",
"db:stop": "docker compose -f compose.local.yml down db",
"db:generate": "drizzle-kit generate",
"db:migrate": "drizzle-kit migrate",
"db:push": "drizzle-kit push",
"db:studio": "drizzle-kit studio",
"s3:start": "docker-compose up s3"
"db:seed": "bun run src/server/db/seed.ts",
"s3:start": "docker compose -f compose.local.yml up s3 -d",
"s3:stop": "docker compose -f compose.local.yml down s3"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.679.0",
"@lucia-auth/adapter-drizzle": "^1.1.0",
"@oslojs/crypto": "^1.0.1",
"@oslojs/encoding": "^1.1.0",
"@radix-ui/react-avatar": "^1.1.1",
"@radix-ui/react-checkbox": "^1.1.2",
"@radix-ui/react-collapsible": "^1.1.1",
Expand All @@ -40,29 +44,34 @@
"@trpc/client": "^11.0.0-rc.599",
"@trpc/react-query": "^11.0.0-rc.599",
"@trpc/server": "^11.0.0-rc.599",
"@tsparticles/react": "^3.0.0",
"cmdk": "1.0.0",
"country-flag-icons": "^1.5.13",
"cva": "^1.0.0-beta.1",
"date-fns": "^4.1.0",
"drizzle-orm": "^0.33.0",
"lucia": "3.2.0",
"framer-motion": "^11.11.11",
"lucide-react": "^0.396.0",
"next": "^15.0.1",
"next-intl": "^3.23.5",
"next-themes": "1.0.0-beta.0",
"nuqs": "^2.0.4",
"oslo": "^1.2.1",
"postgres": "^3.4.5",
"react": "^19.0.0-rc-fb9a90fa48-20240614",
"react-day-picker": "^9.2.1",
"react-dom": "^19.0.0-rc-fb9a90fa48-20240614",
"reading-time": "^1.5.0",
"sonner": "^1.7.0",
"superjson": "^2.2.1",
"tailwind-merge": "^2.5.4",
"tsparticles": "^3.5.0",
"vaul": "^1.1.0",
"zod": "^3.23.8"
},
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@faker-js/faker": "^9.2.0",
"@fluid-tailwind/tailwind-merge": "^0.0.2",
"@types/bun": "^1.1.12",
"@types/react": "npm:[email protected]",
Expand Down
12 changes: 5 additions & 7 deletions src/app/[locale]/(default)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ type DefaultLayoutProps = {
params: Promise<{ locale: string }>;
};

export default async function DefaultLayout(props: DefaultLayoutProps) {
const params = await props.params;

const { locale } = params;

const { children } = props;

export default async function DefaultLayout({
children,
params,
}: DefaultLayoutProps) {
const { locale } = await params;
setRequestLocale(locale);
return (
<>
Expand Down
19 changes: 19 additions & 0 deletions src/app/[locale]/(default)/template.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use client';

import { m } from 'framer-motion';

export default function DefaultTemplate({
children,
}: {
children: React.ReactNode;
}) {
return (
<m.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
transition={{ ease: [0.4, 0, 0.2, 1], duration: 0.5 }}
>
{children}
</m.div>
);
}
12 changes: 12 additions & 0 deletions src/app/[locale]/auth/account/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { AccountSignInForm } from '@/components/auth/AccountSignInForm';
import { setRequestLocale } from 'next-intl/server';

export default async function AccountPage({
params,
}: {
params: Promise<{ locale: string }>;
}) {
const { locale } = await params;
setRequestLocale(locale);
return <AccountSignInForm />;
}
15 changes: 15 additions & 0 deletions src/app/[locale]/auth/create-account/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { setRequestLocale } from 'next-intl/server';

export default async function CreateAccountPage({
params,
}: {
params: Promise<{ locale: string }>;
}) {
const { locale } = await params;
setRequestLocale(locale);
return (
<div className='flex h-full flex-col transition-opacity duration-500'>
This page is for adding info to account after first login
</div>
);
}
15 changes: 15 additions & 0 deletions src/app/[locale]/auth/forgot-password/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { setRequestLocale } from 'next-intl/server';

export default async function CreateAccountPage({
params,
}: {
params: Promise<{ locale: string }>;
}) {
const { locale } = await params;
setRequestLocale(locale);
return (
<div className='flex h-full flex-col transition-opacity duration-500'>
forgot password page
</div>
);
}
Loading
Loading