diff --git a/.env.sample b/.env.sample new file mode 100644 index 0000000..3ac0de5 --- /dev/null +++ b/.env.sample @@ -0,0 +1,11 @@ +DB_FILE_NAME=file:data.local/database.db +BETTER_AUTH_SECRET= +BETTER_AUTH_URL=http://localhost:3000 +OAUTH_CLIENT_ID= +OAUTH_CLIENT_SECRET= +OAUTH_AUTH_URL=https://iam.unipi.it/oauth2/authorize +OAUTH_TOKEN_HOST=https://iam.unipi.it +OAUTH_TOKEN_PATH=/oauth2/token +OAUTH_REDIRECT_URL=https://phc.dm.unipi.it/api/auth/oauth2/callback/unipi +OAUTH_USER_INFO_URL=https://iam.unipi.it/oauth2/userinfo +OAUTH_SCOPES="openid profile email" diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2014f87 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +# https://dev.to/code42cate/how-to-dockerize-and-deploy-astro-6ll + +FROM node:alpine AS base +WORKDIR /app + +COPY package.json package-lock.json ./ + +FROM base AS deps +RUN npm install + +FROM deps AS build +COPY . . +RUN npm run build + +FROM base AS runtime +COPY --from=deps /app/node_modules ./node_modules +COPY --from=build /app/dist ./dist + +ENV HOST=0.0.0.0 +ENV PORT=3000 +EXPOSE 3000 + +CMD node ./dist/server/entry.mjs diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..4ca4efb --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,12 @@ +services: + website: + build: + context: . + container_name: website + restart: unless-stopped + ports: + # https://gist.github.com/aziis98/88af12b32d9cf3eeae3929b93146fd27 + # hash2addr "next.phc.dm.unipi.it" + - '127.44.207.62:1059' + volumes: + - /var/lib/website:/app/data.local \ No newline at end of file diff --git a/src/pages/auth/ateneo.astro b/src/pages/auth/ateneo.astro new file mode 100644 index 0000000..baaca60 --- /dev/null +++ b/src/pages/auth/ateneo.astro @@ -0,0 +1,8 @@ + diff --git a/src/pages/login.astro b/src/pages/login.astro index fbbf60a..ff2ee1a 100644 --- a/src/pages/login.astro +++ b/src/pages/login.astro @@ -1,5 +1,6 @@ --- import PageLayout from '../layouts/PageLayout.astro' +import '@/styles/pages/login.css' --- @@ -7,25 +8,25 @@ import PageLayout from '../layouts/PageLayout.astro'
-

Accedi con Poisson

- - +

Accedi con Poisson (Work in Progress)

- +
+ person + +
+
+ key + +
+ +

Accedi con Ateneo

- Login + + account_balance + Login +
- - -
diff --git a/src/pages/profilo.astro b/src/pages/profilo.astro index 55bc529..9f8b0f1 100644 --- a/src/pages/profilo.astro +++ b/src/pages/profilo.astro @@ -1,12 +1,40 @@ --- -const session = () => { - if (Astro.locals.session) { - return Astro.locals.session - } else { - // Redirect to login page if the user is not authenticated - return Astro.redirect('/login') - } +import PageLayout from '../layouts/PageLayout.astro' +import '@/styles/pages/login.css' + +if (!Astro.locals.user) { + return Astro.redirect('/login') } + +const { name, email } = Astro.locals.user --- -Ciao prova profilo {JSON.stringify(Astro.locals.user)} + +
+
Profilo di {name}
+
+

+ Nome: + {name} +
+ Email: + {email} +
+

+

+ Benvenuto nel tuo profilo! Qui puoi visualizzare le tue informazioni personali e modificare le tue + impostazioni. +

+
+
+ +
+
Impostazioni
+
+

+ Al momento non sono disponibili impostazioni modificabili. Se hai bisogno di assistenza, contatta il + supporto tecnico. +

+
+
+
diff --git a/src/styles/_pages.css b/src/styles/_pages.css deleted file mode 100644 index 6cf5990..0000000 --- a/src/styles/_pages.css +++ /dev/null @@ -1,27 +0,0 @@ -/* This file is here for historical reasons but is not used anymore */ - -@layer page { - /* - .login { - background: #ddfaff; - - main { - justify-self: center; - - display: flex; - flex-direction: column; - align-items: center; - - max-width: 80ch; - padding: 3rem 0; - - gap: 3rem; - - h3 { - font-size: 28px; - font-weight: 600; - } - } - } - */ -} diff --git a/src/styles/controls.css b/src/styles/controls.css index 098273a..9909b22 100644 --- a/src/styles/controls.css +++ b/src/styles/controls.css @@ -21,6 +21,8 @@ Controls - for things like buttons, input, select display: grid; place-content: center; + grid-auto-flow: column; + gap: 0.25rem; &:hover { transform: translate(-1px, -1px); @@ -206,6 +208,23 @@ Controls - for things like buttons, input, select background: #4ea2b1; } } + + &:disabled { + background: #aaa; + color: #666; + cursor: not-allowed; + + &:active { + transform: none; + box-shadow: 4px 4px 0 0 #222; + } + + &:hover { + background: #aaa; + transform: none; + box-shadow: 4px 4px 0 0 #222; + } + } } hr { @@ -217,6 +236,25 @@ Controls - for things like buttons, input, select margin-top: 1rem; } + > .row { + display: grid; + grid-template-columns: auto 1fr; + align-items: center; + gap: 0.5rem; + + span.material-symbols-outlined { + font-size: 1.5rem; + color: #222; + } + + input[type='text'], + input[type='password'] { + width: 100%; + min-height: 2.5rem; + padding-left: 0.5rem; + } + } + .right { justify-self: end; } @@ -226,6 +264,12 @@ Controls - for things like buttons, input, select .center { justify-self: center; } + + @media screen and (max-width: 1024px) { + min-width: 0; + padding: 1.5rem; + gap: 1.5rem; + } } details { diff --git a/src/styles/pages/login.css b/src/styles/pages/login.css new file mode 100644 index 0000000..d99c89e --- /dev/null +++ b/src/styles/pages/login.css @@ -0,0 +1,17 @@ +@layer page { + main { + justify-self: center; + + display: grid; + place-items: center; + place-content: center; + + padding: 4.5rem 3rem; + gap: 4.5rem; + + @media screen and (max-width: 1024px) { + padding: 3rem 1.5rem; + gap: 3rem; + } + } +}