feat: add dockerfiles, finish /login and start /profile
parent
a8172f7e66
commit
069af4cd09
@ -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"
|
||||
@ -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
|
||||
@ -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
|
||||
@ -0,0 +1,8 @@
|
||||
<script>
|
||||
import { authClient } from '@/client/auth-client' //import the auth client
|
||||
|
||||
await authClient.signIn.oauth2({
|
||||
providerId: 'unipi',
|
||||
callbackURL: '/profilo', // the path to redirect to after the user is authenticated
|
||||
})
|
||||
</script>
|
||||
@ -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)}
|
||||
<PageLayout title="Profilo | PHC">
|
||||
<div class="card large">
|
||||
<div class="title">Profilo di {name}</div>
|
||||
<div class="text">
|
||||
<p>
|
||||
<strong>Nome:</strong>
|
||||
{name}
|
||||
<br />
|
||||
<strong>Email:</strong>
|
||||
{email}
|
||||
<br />
|
||||
</p>
|
||||
<p>
|
||||
Benvenuto nel tuo profilo! Qui puoi visualizzare le tue informazioni personali e modificare le tue
|
||||
impostazioni.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="title">Impostazioni</div>
|
||||
<div class="text">
|
||||
<p>
|
||||
Al momento non sono disponibili impostazioni modificabili. Se hai bisogno di assistenza, contatta il
|
||||
supporto tecnico.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</PageLayout>
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue