New Sign-In Detected
+IP Address
+{{ipAddress}}
+Device
+{{device}}
+Sign-In Time
+{{dateTimeString}}
+diff --git a/.env.example b/.env.example index f178de6..fae5478 100644 --- a/.env.example +++ b/.env.example @@ -1 +1,2 @@ PUBLIC_APP_URL=http://localhost +TRUST_PROXY=false \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2a6985a..c1007e2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -61,7 +61,7 @@ You're all set! We use [Caddy](https://caddyserver.com) as a reverse proxy. You can use any other reverse proxy if you want but you have to configure it yourself. #### Setup -Run `caddy run --config Caddyfile` in the root folder. +Run `caddy run --config reverse-proxy/Caddyfile` in the root folder. ### Testing diff --git a/Dockerfile b/Dockerfile index 8c4ea8a..e2a8da6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,7 +22,7 @@ RUN CGO_ENABLED=1 GOOS=linux go build -o /app/backend/pocket-id-backend . # Stage 3: Production Image FROM node:20-alpine RUN apk add --no-cache caddy -COPY ./Caddyfile /etc/caddy/Caddyfile +COPY ./reverse-proxy /etc/caddy/ WORKDIR /app COPY --from=frontend-builder /app/frontend/build ./frontend/build @@ -31,6 +31,7 @@ COPY --from=frontend-builder /app/frontend/package.json ./frontend/package.json COPY --from=backend-builder /app/backend/pocket-id-backend ./backend/pocket-id-backend COPY --from=backend-builder /app/backend/migrations ./backend/migrations +COPY --from=backend-builder /app/backend/email-templates ./backend/email-templates COPY --from=backend-builder /app/backend/images ./backend/images COPY ./scripts ./scripts diff --git a/README.md b/README.md index 5dc0dc1..d824ac1 100644 --- a/README.md +++ b/README.md @@ -147,6 +147,7 @@ docker compose up -d | Variable | Default Value | Recommended to change | Description | | ---------------------- | ----------------------- | --------------------- | --------------------------------------------- | | `PUBLIC_APP_URL` | `http://localhost` | yes | The URL where you will access the app. | +| `TRUST_PROXY` | `false` | yes | Whether the app is behind a reverse proxy. | | `DB_PATH` | `data/pocket-id.db` | no | The path to the SQLite database. | | `UPLOAD_PATH` | `data/uploads` | no | The path where the uploaded files are stored. | | `INTERNAL_BACKEND_URL` | `http://localhost:8080` | no | The URL where the backend is accessible. | diff --git a/backend/email-templates/login-with-new-device.html b/backend/email-templates/login-with-new-device.html new file mode 100644 index 0000000..be251d4 --- /dev/null +++ b/backend/email-templates/login-with-new-device.html @@ -0,0 +1,119 @@ + +
+ + + +IP Address
+{{ipAddress}}
+Device
+{{device}}
+Sign-In Time
+{{dateTimeString}}
+{input.error}
diff --git a/frontend/src/lib/components/header/header.svelte b/frontend/src/lib/components/header/header.svelte index 2410caa..fec15eb 100644 --- a/frontend/src/lib/components/header/header.svelte +++ b/frontend/src/lib/components/header/header.svelte @@ -1,6 +1,6 @@ -{#if !applicationConfiguration} +{#if !appConfig}
Authenticate yourself with your passkey to access the admin panel
diff --git a/frontend/src/routes/login/[token]/+page.svelte b/frontend/src/routes/login/[token]/+page.svelte
index 762ab74..c501661 100644
--- a/frontend/src/routes/login/[token]/+page.svelte
+++ b/frontend/src/routes/login/[token]/+page.svelte
@@ -4,7 +4,7 @@
import Logo from '$lib/components/logo.svelte';
import { Button } from '$lib/components/ui/button';
import UserService from '$lib/services/user-service';
- import applicationConfigurationStore from '$lib/stores/application-configuration-store.js';
+ import appConfigStore from '$lib/stores/application-configuration-store.js';
import userStore from '$lib/stores/user-store.js';
import type { User } from '$lib/types/user.type.js';
import { axiosErrorToast } from '$lib/utils/error-util';
@@ -18,9 +18,9 @@
isLoading = true;
userService
.exchangeOneTimeAccessToken(data.token)
- .then((user :User) => {
+ .then((user: User) => {
userStore.setUser(user);
- goto('/settings')
+ goto('/settings');
})
.catch(axiosErrorToast);
isLoading = false;
@@ -29,15 +29,15 @@
- You've been granted one-time access to your {$applicationConfigurationStore.appName} account. Please note that if you continue,
- this link will become invalid. To avoid this, make sure to add a passkey. Otherwise, you'll need
- to request a new link.
+
+ You've been granted one-time access to your {$appConfigStore.appName} account. Please note that if
+ you continue, this link will become invalid. To avoid this, make sure to add a passkey. Otherwise,
+ you'll need to request a new link.
One Time Access
- One Time Access
+ Settings
diff --git a/frontend/src/routes/settings/admin/application-configuration/+page.server.ts b/frontend/src/routes/settings/admin/application-configuration/+page.server.ts
index 0c30081..566b010 100644
--- a/frontend/src/routes/settings/admin/application-configuration/+page.server.ts
+++ b/frontend/src/routes/settings/admin/application-configuration/+page.server.ts
@@ -1,10 +1,8 @@
-import ApplicationConfigurationService from '$lib/services/application-configuration-service';
+import AppConfigService from '$lib/services/app-config-service';
import type { PageServerLoad } from './$types';
export const load: PageServerLoad = async ({ cookies }) => {
- const applicationConfigurationService = new ApplicationConfigurationService(
- cookies.get('access_token')
- );
- const applicationConfiguration = await applicationConfigurationService.list(true);
- return { applicationConfiguration };
+ const appConfigService = new AppConfigService(cookies.get('access_token'));
+ const appConfig = await appConfigService.list(true);
+ return { appConfig };
};
diff --git a/frontend/src/routes/settings/admin/application-configuration/+page.svelte b/frontend/src/routes/settings/admin/application-configuration/+page.svelte
index d04c9e5..ef0374d 100644
--- a/frontend/src/routes/settings/admin/application-configuration/+page.svelte
+++ b/frontend/src/routes/settings/admin/application-configuration/+page.svelte
@@ -1,24 +1,30 @@
+
+
diff --git a/frontend/src/routes/settings/admin/application-configuration/application-configuration-form.svelte b/frontend/src/routes/settings/admin/application-configuration/forms/app-config-general-form.svelte
similarity index 65%
rename from frontend/src/routes/settings/admin/application-configuration/application-configuration-form.svelte
rename to frontend/src/routes/settings/admin/application-configuration/forms/app-config-general-form.svelte
index 81ab900..a551f30 100644
--- a/frontend/src/routes/settings/admin/application-configuration/application-configuration-form.svelte
+++ b/frontend/src/routes/settings/admin/application-configuration/forms/app-config-general-form.svelte
@@ -1,23 +1,24 @@
diff --git a/frontend/src/routes/settings/admin/oidc-clients/+page.svelte b/frontend/src/routes/settings/admin/oidc-clients/+page.svelte
index b30a874..269390f 100644
--- a/frontend/src/routes/settings/admin/oidc-clients/+page.svelte
+++ b/frontend/src/routes/settings/admin/oidc-clients/+page.svelte
@@ -1,17 +1,17 @@
+
+