2024-07-08 11:44:39 -04:00
|
|
|
|
<script lang="ts">
|
|
|
|
|
import { enhance } from '$app/forms';
|
|
|
|
|
import { page } from '$app/stores';
|
|
|
|
|
import { addToast } from '$lib/toasts';
|
2025-01-02 13:34:51 -05:00
|
|
|
|
import type { ImmichIntegration, User } from '$lib/types.js';
|
2024-07-08 11:44:39 -04:00
|
|
|
|
import { onMount } from 'svelte';
|
|
|
|
|
import { browser } from '$app/environment';
|
2024-10-29 10:29:03 -04:00
|
|
|
|
import { t } from 'svelte-i18n';
|
2024-12-13 10:48:18 -05:00
|
|
|
|
import TotpModal from '$lib/components/TOTPModal.svelte';
|
2025-05-23 12:15:44 -04:00
|
|
|
|
import { appTitle, appVersion, copyrightYear } from '$lib/config.js';
|
2025-01-02 13:34:51 -05:00
|
|
|
|
import ImmichLogo from '$lib/assets/immich.svg';
|
2024-07-08 11:44:39 -04:00
|
|
|
|
|
|
|
|
|
export let data;
|
2025-01-02 13:34:51 -05:00
|
|
|
|
console.log(data);
|
2024-07-08 11:44:39 -04:00
|
|
|
|
let user: User;
|
2024-12-07 16:15:41 -05:00
|
|
|
|
let emails: typeof data.props.emails;
|
2024-07-08 11:44:39 -04:00
|
|
|
|
if (data.user) {
|
|
|
|
|
user = data.user;
|
2024-12-07 16:15:41 -05:00
|
|
|
|
emails = data.props.emails;
|
2024-07-08 11:44:39 -04:00
|
|
|
|
}
|
|
|
|
|
|
2025-03-16 21:49:00 -04:00
|
|
|
|
let new_password_disable_setting: boolean = false;
|
2024-12-11 20:46:20 -05:00
|
|
|
|
let new_email: string = '';
|
2025-01-06 18:53:08 -05:00
|
|
|
|
let public_url: string = data.props.publicUrl;
|
2025-01-02 13:34:51 -05:00
|
|
|
|
let immichIntegration = data.props.immichIntegration;
|
2025-05-23 12:15:44 -04:00
|
|
|
|
let activeSection: string = 'profile';
|
2025-01-02 13:34:51 -05:00
|
|
|
|
|
|
|
|
|
let newImmichIntegration: ImmichIntegration = {
|
|
|
|
|
server_url: '',
|
|
|
|
|
api_key: '',
|
|
|
|
|
id: ''
|
|
|
|
|
};
|
|
|
|
|
|
2024-12-13 20:21:44 -05:00
|
|
|
|
let isMFAModalOpen: boolean = false;
|
2024-12-13 10:48:18 -05:00
|
|
|
|
|
2025-05-23 12:15:44 -04:00
|
|
|
|
const sections = [
|
2025-05-23 17:22:28 -04:00
|
|
|
|
{ id: 'profile', icon: '👤', label: () => $t('navbar.profile') },
|
|
|
|
|
{ id: 'security', icon: '🔒', label: () => $t('settings.security') },
|
|
|
|
|
{ id: 'emails', icon: '📧', label: () => $t('settings.emails') },
|
|
|
|
|
{ id: 'integrations', icon: '🔗', label: () => $t('settings.integrations') },
|
|
|
|
|
{ id: 'admin', icon: '⚙️', label: () => $t('settings.admin') },
|
|
|
|
|
{ id: 'advanced', icon: '🛠️', label: () => $t('settings.advanced') }
|
2025-05-23 12:15:44 -04:00
|
|
|
|
];
|
|
|
|
|
|
2024-07-08 11:44:39 -04:00
|
|
|
|
onMount(async () => {
|
|
|
|
|
if (browser) {
|
|
|
|
|
const queryParams = new URLSearchParams($page.url.search);
|
|
|
|
|
const pageParam = queryParams.get('page');
|
|
|
|
|
|
|
|
|
|
if (pageParam === 'success') {
|
2024-10-29 10:29:03 -04:00
|
|
|
|
addToast('success', $t('settings.update_success'));
|
2024-07-08 11:44:39 -04:00
|
|
|
|
console.log('Settings updated successfully!');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$: {
|
|
|
|
|
if (browser && $page.form?.success) {
|
|
|
|
|
window.location.href = '/settings?page=success';
|
|
|
|
|
}
|
|
|
|
|
if (browser && $page.form?.error) {
|
2024-10-29 10:29:03 -04:00
|
|
|
|
addToast('error', $t('settings.update_error'));
|
2024-07-08 11:44:39 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-07-16 21:24:18 -04:00
|
|
|
|
|
2024-11-01 20:08:23 -04:00
|
|
|
|
async function checkVisitedRegions() {
|
|
|
|
|
let res = await fetch('/api/reverse-geocode/mark_visited_region/', {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {
|
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
let data = await res.json();
|
|
|
|
|
if (res.ok) {
|
2025-01-15 11:53:04 -05:00
|
|
|
|
addToast(
|
|
|
|
|
'success',
|
|
|
|
|
`${data.new_regions} ${$t('adventures.regions_updated')}. ${data.new_cities} ${$t('adventures.cities_updated')}.`
|
|
|
|
|
);
|
2024-11-01 20:08:23 -04:00
|
|
|
|
} else {
|
2024-11-01 20:12:43 -04:00
|
|
|
|
addToast('error', $t('adventures.error_updating_regions'));
|
2024-11-01 20:08:23 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-12-07 16:15:41 -05:00
|
|
|
|
|
|
|
|
|
async function removeEmail(email: { email: any; verified?: boolean; primary?: boolean }) {
|
2025-02-23 17:04:20 -05:00
|
|
|
|
let res = await fetch('/auth/browser/v1/account/email', {
|
2024-12-07 16:15:41 -05:00
|
|
|
|
method: 'DELETE',
|
|
|
|
|
headers: {
|
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
|
},
|
|
|
|
|
body: JSON.stringify({ email: email.email })
|
|
|
|
|
});
|
|
|
|
|
if (res.ok) {
|
2024-12-12 19:20:58 -05:00
|
|
|
|
addToast('success', $t('settings.email_removed'));
|
2024-12-07 16:15:41 -05:00
|
|
|
|
emails = emails.filter((e) => e.email !== email.email);
|
|
|
|
|
} else {
|
2024-12-12 19:20:58 -05:00
|
|
|
|
addToast('error', $t('settings.email_removed_error'));
|
2024-12-07 16:15:41 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-12-11 20:46:20 -05:00
|
|
|
|
|
2025-03-16 21:49:00 -04:00
|
|
|
|
async function disablePassword() {
|
|
|
|
|
if (user.disable_password) {
|
|
|
|
|
let res = await fetch('/auth/disable-password/', {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {
|
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if (res.ok) {
|
|
|
|
|
addToast('success', $t('settings.password_disabled'));
|
|
|
|
|
} else {
|
|
|
|
|
addToast('error', $t('settings.password_disabled_error'));
|
2025-03-17 10:38:41 -04:00
|
|
|
|
user.disable_password = false;
|
2025-03-16 21:49:00 -04:00
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
let res = await fetch('/auth/disable-password/', {
|
|
|
|
|
method: 'DELETE',
|
|
|
|
|
headers: {
|
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if (res.ok) {
|
|
|
|
|
addToast('success', $t('settings.password_enabled'));
|
|
|
|
|
} else {
|
|
|
|
|
addToast('error', $t('settings.password_enabled_error'));
|
2025-03-17 10:38:41 -04:00
|
|
|
|
user.disable_password = true;
|
2025-03-16 21:49:00 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-11 20:46:20 -05:00
|
|
|
|
async function verifyEmail(email: { email: any; verified?: boolean; primary?: boolean }) {
|
2025-03-16 21:49:00 -04:00
|
|
|
|
let res = await fetch('/auth/browser/v1/account/email', {
|
2024-12-11 20:46:20 -05:00
|
|
|
|
method: 'PUT',
|
|
|
|
|
headers: {
|
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
|
},
|
|
|
|
|
body: JSON.stringify({ email: email.email })
|
|
|
|
|
});
|
|
|
|
|
if (res.ok) {
|
2024-12-12 19:20:58 -05:00
|
|
|
|
addToast('success', $t('settings.verify_email_success'));
|
2024-12-11 20:46:20 -05:00
|
|
|
|
} else {
|
2024-12-12 19:20:58 -05:00
|
|
|
|
addToast('error', $t('settings.verify_email_error'));
|
2024-12-11 20:46:20 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function addEmail() {
|
2025-03-16 21:49:00 -04:00
|
|
|
|
let res = await fetch('/auth/browser/v1/account/email', {
|
2024-12-11 20:46:20 -05:00
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {
|
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
|
},
|
|
|
|
|
body: JSON.stringify({ email: new_email })
|
|
|
|
|
});
|
|
|
|
|
if (res.ok) {
|
2024-12-12 19:20:58 -05:00
|
|
|
|
addToast('success', $t('settings.email_added'));
|
2024-12-11 20:46:20 -05:00
|
|
|
|
emails = [...emails, { email: new_email, verified: false, primary: false }];
|
|
|
|
|
new_email = '';
|
|
|
|
|
} else {
|
2024-12-14 09:56:12 -05:00
|
|
|
|
let error = await res.json();
|
|
|
|
|
let error_code = error.errors[0].code;
|
|
|
|
|
addToast('error', $t(`settings.${error_code}`) || $t('settings.generic_error'));
|
2024-12-11 20:46:20 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-12-12 11:01:09 -05:00
|
|
|
|
|
|
|
|
|
async function primaryEmail(email: { email: any; verified?: boolean; primary?: boolean }) {
|
2025-03-16 21:49:00 -04:00
|
|
|
|
let res = await fetch('/auth/browser/v1/account/email', {
|
2024-12-12 11:01:09 -05:00
|
|
|
|
method: 'PATCH',
|
|
|
|
|
headers: {
|
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
|
},
|
|
|
|
|
body: JSON.stringify({ email: email.email, primary: true })
|
|
|
|
|
});
|
|
|
|
|
if (res.ok) {
|
2024-12-12 19:20:58 -05:00
|
|
|
|
addToast('success', $t('settings.email_set_primary'));
|
2024-12-12 11:01:09 -05:00
|
|
|
|
emails = emails.map((e) => {
|
|
|
|
|
if (e.email === email.email) {
|
|
|
|
|
e.primary = true;
|
|
|
|
|
} else {
|
|
|
|
|
e.primary = false;
|
|
|
|
|
}
|
|
|
|
|
return e;
|
|
|
|
|
});
|
|
|
|
|
} else {
|
2024-12-12 19:20:58 -05:00
|
|
|
|
addToast('error', $t('settings.email_set_primary_error'));
|
2024-12-12 11:01:09 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-12-13 10:48:18 -05:00
|
|
|
|
|
2025-01-02 13:34:51 -05:00
|
|
|
|
async function enableImmichIntegration() {
|
|
|
|
|
if (!immichIntegration?.id) {
|
|
|
|
|
let res = await fetch('/api/integrations/immich/', {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {
|
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
|
},
|
|
|
|
|
body: JSON.stringify(newImmichIntegration)
|
|
|
|
|
});
|
|
|
|
|
let data = await res.json();
|
|
|
|
|
if (res.ok) {
|
2025-01-02 18:34:13 -05:00
|
|
|
|
addToast('success', $t('immich.immich_enabled'));
|
2025-01-02 13:34:51 -05:00
|
|
|
|
immichIntegration = data;
|
|
|
|
|
} else {
|
2025-01-02 18:34:13 -05:00
|
|
|
|
addToast('error', $t('immich.immich_error'));
|
2025-01-02 13:34:51 -05:00
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
let res = await fetch(`/api/integrations/immich/${immichIntegration.id}/`, {
|
|
|
|
|
method: 'PUT',
|
|
|
|
|
headers: {
|
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
|
},
|
|
|
|
|
body: JSON.stringify(newImmichIntegration)
|
|
|
|
|
});
|
|
|
|
|
let data = await res.json();
|
|
|
|
|
if (res.ok) {
|
2025-01-02 18:34:13 -05:00
|
|
|
|
addToast('success', $t('immich.immich_updated'));
|
2025-01-02 13:34:51 -05:00
|
|
|
|
immichIntegration = data;
|
|
|
|
|
} else {
|
2025-01-02 18:34:13 -05:00
|
|
|
|
addToast('error', $t('immich.immich_error'));
|
2025-01-02 13:34:51 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function disableImmichIntegration() {
|
|
|
|
|
if (immichIntegration && immichIntegration.id) {
|
|
|
|
|
let res = await fetch(`/api/integrations/immich/${immichIntegration.id}/`, {
|
|
|
|
|
method: 'DELETE'
|
|
|
|
|
});
|
|
|
|
|
if (res.ok) {
|
2025-01-02 18:34:13 -05:00
|
|
|
|
addToast('success', $t('immich.immich_disabled'));
|
2025-01-02 13:34:51 -05:00
|
|
|
|
immichIntegration = null;
|
|
|
|
|
} else {
|
2025-01-02 18:34:13 -05:00
|
|
|
|
addToast('error', $t('immich.immich_error'));
|
2025-01-02 13:34:51 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-13 10:48:18 -05:00
|
|
|
|
async function disableMfa() {
|
2025-02-23 17:04:20 -05:00
|
|
|
|
const res = await fetch('/auth/browser/v1/account/authenticators/totp', {
|
2024-12-13 10:48:18 -05:00
|
|
|
|
method: 'DELETE'
|
|
|
|
|
});
|
|
|
|
|
if (res.ok) {
|
2024-12-13 20:21:44 -05:00
|
|
|
|
addToast('success', $t('settings.mfa_disabled'));
|
2024-12-13 10:48:18 -05:00
|
|
|
|
data.props.authenticators = false;
|
|
|
|
|
} else {
|
|
|
|
|
if (res.status == 401) {
|
2024-12-13 20:21:44 -05:00
|
|
|
|
addToast('error', $t('settings.reset_session_error'));
|
2024-12-13 10:48:18 -05:00
|
|
|
|
}
|
|
|
|
|
addToast('error', $t('settings.generic_error'));
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-07-08 11:44:39 -04:00
|
|
|
|
</script>
|
|
|
|
|
|
2024-12-13 20:21:44 -05:00
|
|
|
|
{#if isMFAModalOpen}
|
2024-12-13 10:48:18 -05:00
|
|
|
|
<TotpModal
|
|
|
|
|
user={data.user}
|
2024-12-13 20:21:44 -05:00
|
|
|
|
on:close={() => (isMFAModalOpen = false)}
|
2024-12-13 10:48:18 -05:00
|
|
|
|
bind:is_enabled={data.props.authenticators}
|
|
|
|
|
/>
|
|
|
|
|
{/if}
|
|
|
|
|
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<div class="min-h-screen bg-gradient-to-br from-base-200 to-base-300">
|
|
|
|
|
<!-- Header -->
|
|
|
|
|
<div class="bg-base-100 shadow-lg border-b border-base-300">
|
|
|
|
|
<div class="container mx-auto px-6 py-8">
|
|
|
|
|
<div class="flex items-center justify-between">
|
2024-12-19 18:46:52 -05:00
|
|
|
|
<div>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<h1
|
2025-05-23 17:22:28 -04:00
|
|
|
|
class="text-4xl font-bold bg-gradient-to-r from-primary to-secondary bg-clip-text text-transparent pb-1"
|
2025-01-02 13:40:02 -05:00
|
|
|
|
>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
{$t('settings.settings_page')}
|
|
|
|
|
</h1>
|
2024-12-19 18:46:52 -05:00
|
|
|
|
</div>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-07-08 11:44:39 -04:00
|
|
|
|
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<div class="container mx-auto px-6 py-8 max-w-7xl">
|
|
|
|
|
<div class="flex flex-col lg:flex-row gap-8">
|
|
|
|
|
<!-- Sidebar Navigation -->
|
|
|
|
|
<div class="lg:w-1/4">
|
|
|
|
|
<div class="bg-base-100 rounded-2xl shadow-xl p-6 sticky top-8">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<h3 class="font-semibold text-lg mb-4 text-base-content/80">
|
|
|
|
|
{$t('settings.settings_menu')}
|
|
|
|
|
</h3>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<ul class="menu menu-vertical w-full space-y-1">
|
|
|
|
|
{#each sections as section}
|
|
|
|
|
<li>
|
|
|
|
|
<button
|
|
|
|
|
class="flex items-center gap-3 p-3 rounded-xl transition-all duration-200 {activeSection ===
|
|
|
|
|
section.id
|
|
|
|
|
? 'bg-primary text-primary-content shadow-lg'
|
|
|
|
|
: 'hover:bg-base-200'}"
|
|
|
|
|
on:click={() => (activeSection = section.id)}
|
|
|
|
|
>
|
|
|
|
|
<span class="text-xl">{section.icon}</span>
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<span class="font-medium">{section.label()}</span>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</button>
|
|
|
|
|
</li>
|
|
|
|
|
{/each}
|
|
|
|
|
</ul>
|
2024-12-19 18:46:52 -05:00
|
|
|
|
</div>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</div>
|
2024-09-08 13:53:50 -04:00
|
|
|
|
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<!-- Main Content -->
|
|
|
|
|
<div class="lg:w-3/4">
|
|
|
|
|
<div class="space-y-8">
|
|
|
|
|
<!-- Profile Section -->
|
|
|
|
|
{#if activeSection === 'profile'}
|
|
|
|
|
<div class="bg-base-100 rounded-2xl shadow-xl p-8">
|
|
|
|
|
<div class="flex items-center gap-4 mb-6">
|
|
|
|
|
<div class="p-3 bg-primary/10 rounded-xl">
|
|
|
|
|
<span class="text-2xl">👤</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<h2 class="text-2xl font-bold">{$t('settings.profile_info')}</h2>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<p class="text-base-content/70">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
{$t('settings.profile_info_desc')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-12-19 18:46:52 -05:00
|
|
|
|
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<form
|
|
|
|
|
method="post"
|
|
|
|
|
action="?/changeDetails"
|
|
|
|
|
use:enhance
|
|
|
|
|
enctype="multipart/form-data"
|
|
|
|
|
class="space-y-6"
|
|
|
|
|
>
|
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
|
|
|
<div class="form-control">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<!-- svelte-ignore a11y-label-has-associated-control -->
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<label class="label">
|
|
|
|
|
<span class="label-text font-medium">{$t('auth.username')}</span>
|
|
|
|
|
</label>
|
|
|
|
|
<input
|
|
|
|
|
type="text"
|
|
|
|
|
bind:value={user.username}
|
|
|
|
|
name="username"
|
|
|
|
|
class="input input-bordered input-primary focus:input-primary"
|
2025-05-23 17:22:28 -04:00
|
|
|
|
placeholder={$t('settings.enter_username')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
/>
|
|
|
|
|
</div>
|
2024-12-19 18:46:52 -05:00
|
|
|
|
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<div class="form-control">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<!-- svelte-ignore a11y-label-has-associated-control -->
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<label class="label">
|
|
|
|
|
<span class="label-text font-medium">{$t('auth.first_name')}</span>
|
|
|
|
|
</label>
|
|
|
|
|
<input
|
|
|
|
|
type="text"
|
|
|
|
|
bind:value={user.first_name}
|
|
|
|
|
name="first_name"
|
|
|
|
|
class="input input-bordered input-primary focus:input-primary"
|
2025-05-23 17:22:28 -04:00
|
|
|
|
placeholder={$t('settings.enter_first_name')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
/>
|
|
|
|
|
</div>
|
2024-07-08 11:44:39 -04:00
|
|
|
|
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<div class="form-control">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<!-- svelte-ignore a11y-label-has-associated-control -->
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<label class="label">
|
|
|
|
|
<span class="label-text font-medium">{$t('auth.last_name')}</span>
|
|
|
|
|
</label>
|
|
|
|
|
<input
|
|
|
|
|
type="text"
|
|
|
|
|
bind:value={user.last_name}
|
|
|
|
|
name="last_name"
|
|
|
|
|
class="input input-bordered input-primary focus:input-primary"
|
2025-05-23 17:22:28 -04:00
|
|
|
|
placeholder={$t('settings.enter_last_name')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
/>
|
|
|
|
|
</div>
|
2024-12-19 18:46:52 -05:00
|
|
|
|
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<div class="form-control">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<!-- svelte-ignore a11y-label-has-associated-control -->
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<label class="label">
|
|
|
|
|
<span class="label-text font-medium">{$t('auth.profile_picture')}</span>
|
|
|
|
|
</label>
|
|
|
|
|
<input
|
|
|
|
|
type="file"
|
|
|
|
|
name="profile_pic"
|
|
|
|
|
class="file-input file-input-bordered file-input-primary"
|
|
|
|
|
accept="image/*"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-12-19 18:46:52 -05:00
|
|
|
|
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<div class="form-control">
|
|
|
|
|
<label class="label cursor-pointer justify-start gap-4">
|
|
|
|
|
<input
|
|
|
|
|
type="checkbox"
|
|
|
|
|
bind:checked={user.public_profile}
|
|
|
|
|
name="public_profile"
|
|
|
|
|
class="toggle toggle-primary"
|
|
|
|
|
/>
|
|
|
|
|
<div>
|
|
|
|
|
<span class="label-text font-medium">{$t('auth.public_profile')}</span>
|
|
|
|
|
<p class="text-sm text-base-content/60">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
{$t('settings.public_profile_desc')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
2024-12-12 19:20:58 -05:00
|
|
|
|
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<button class="btn btn-primary btn-wide">
|
|
|
|
|
<span class="loading loading-spinner loading-sm hidden"></span>
|
|
|
|
|
{$t('settings.update')}
|
|
|
|
|
</button>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
<!-- Security Section -->
|
|
|
|
|
{#if activeSection === 'security'}
|
|
|
|
|
<div class="space-y-8">
|
|
|
|
|
<!-- Password Change -->
|
|
|
|
|
<div class="bg-base-100 rounded-2xl shadow-xl p-8">
|
|
|
|
|
<div class="flex items-center gap-4 mb-6">
|
|
|
|
|
<div class="p-3 bg-warning/10 rounded-xl">
|
|
|
|
|
<span class="text-2xl">🔐</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<h2 class="text-2xl font-bold">{$t('settings.change_password')}</h2>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<p class="text-base-content/70">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
{$t('settings.pass_change_desc')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<form method="post" action="?/changePassword" use:enhance class="space-y-6">
|
|
|
|
|
{#if user.has_password}
|
|
|
|
|
<div class="form-control">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<!-- svelte-ignore a11y-label-has-associated-control -->
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<label class="label">
|
|
|
|
|
<span class="label-text font-medium">{$t('settings.current_password')}</span
|
|
|
|
|
>
|
|
|
|
|
</label>
|
|
|
|
|
<input
|
|
|
|
|
type="password"
|
|
|
|
|
name="current_password"
|
|
|
|
|
class="input input-bordered input-primary focus:input-primary"
|
2025-05-23 17:22:28 -04:00
|
|
|
|
placeholder={$t('settings.enter_current_password')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
|
|
|
<div class="form-control">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<!-- svelte-ignore a11y-label-has-associated-control -->
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<label class="label">
|
|
|
|
|
<span class="label-text font-medium">{$t('settings.new_password')}</span>
|
|
|
|
|
</label>
|
|
|
|
|
<input
|
|
|
|
|
type="password"
|
|
|
|
|
name="password1"
|
|
|
|
|
class="input input-bordered input-primary focus:input-primary"
|
2025-05-23 17:22:28 -04:00
|
|
|
|
placeholder={$t('settings.enter_new_password')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="form-control">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<!-- svelte-ignore a11y-label-has-associated-control -->
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<label class="label">
|
|
|
|
|
<span class="label-text font-medium"
|
|
|
|
|
>{$t('settings.confirm_new_password')}</span
|
|
|
|
|
>
|
|
|
|
|
</label>
|
|
|
|
|
<input
|
|
|
|
|
type="password"
|
|
|
|
|
name="password2"
|
|
|
|
|
class="input input-bordered input-primary focus:input-primary"
|
2025-05-23 17:22:28 -04:00
|
|
|
|
placeholder={$t('settings.confirm_new_password')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{#if $page.form?.message}
|
|
|
|
|
<div class="alert alert-warning">
|
|
|
|
|
<svg
|
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
|
class="stroke-current shrink-0 h-6 w-6"
|
|
|
|
|
fill="none"
|
|
|
|
|
viewBox="0 0 24 24"
|
|
|
|
|
>
|
|
|
|
|
<path
|
|
|
|
|
stroke-linecap="round"
|
|
|
|
|
stroke-linejoin="round"
|
|
|
|
|
stroke-width="2"
|
|
|
|
|
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"
|
|
|
|
|
/>
|
|
|
|
|
</svg>
|
|
|
|
|
<span>{$t($page.form?.message)}</span>
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
class="tooltip tooltip-warning"
|
|
|
|
|
data-tip={$t('settings.password_change_lopout_warning')}
|
|
|
|
|
>
|
|
|
|
|
<button class="btn btn-warning">
|
|
|
|
|
🔑 {$t('settings.password_change')}
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
2025-03-17 10:38:41 -04:00
|
|
|
|
</div>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
|
|
|
|
|
<!-- MFA Section -->
|
|
|
|
|
<div class="bg-base-100 rounded-2xl shadow-xl p-8">
|
|
|
|
|
<div class="flex items-center gap-4 mb-6">
|
|
|
|
|
<div class="p-3 bg-success/10 rounded-xl">
|
|
|
|
|
<span class="text-2xl">🛡️</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<h2 class="text-2xl font-bold">{$t('settings.mfa_page_title')}</h2>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<p class="text-base-content/70">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
{$t('settings.mfa_desc')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="flex items-center justify-between p-4 bg-base-200 rounded-xl">
|
|
|
|
|
<div class="flex items-center gap-4">
|
|
|
|
|
<div
|
|
|
|
|
class="badge {data.props.authenticators
|
|
|
|
|
? 'badge-success'
|
|
|
|
|
: 'badge-error'} gap-2"
|
|
|
|
|
>
|
|
|
|
|
{#if data.props.authenticators}
|
2025-05-23 17:22:28 -04:00
|
|
|
|
✅ {$t('settings.enabled')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
{:else}
|
2025-05-23 17:22:28 -04:00
|
|
|
|
❌ {$t('settings.disabled')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
{/if}
|
|
|
|
|
</div>
|
|
|
|
|
<span class="font-medium">
|
|
|
|
|
{data.props.authenticators
|
2025-05-23 17:22:28 -04:00
|
|
|
|
? $t('settings.mfa_is_enabled')
|
|
|
|
|
: $t('settings.mfa_not_enabled')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{#if !data.props.authenticators}
|
|
|
|
|
{#if !emails.some((e) => e.verified)}
|
|
|
|
|
<div
|
|
|
|
|
class="tooltip tooltip-warning"
|
2025-05-23 17:22:28 -04:00
|
|
|
|
data-tip={$t('settings.no_verified_email_warning')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
>
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<button class="btn btn-disabled">{$t('settings.enable_mfa')}</button>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</div>
|
|
|
|
|
{:else}
|
|
|
|
|
<button class="btn btn-primary" on:click={() => (isMFAModalOpen = true)}>
|
2025-05-23 17:22:28 -04:00
|
|
|
|
{$t('settings.enable_mfa')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</button>
|
|
|
|
|
{/if}
|
|
|
|
|
{:else}
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<button class="btn btn-warning" on:click={disableMfa}>
|
|
|
|
|
{$t('settings.disable_mfa')}
|
|
|
|
|
</button>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
{/if}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{#if !emails.some((e) => e.verified)}
|
|
|
|
|
<div class="alert alert-warning mt-4">
|
|
|
|
|
<svg
|
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
|
class="stroke-current shrink-0 h-6 w-6"
|
|
|
|
|
fill="none"
|
|
|
|
|
viewBox="0 0 24 24"
|
|
|
|
|
>
|
|
|
|
|
<path
|
|
|
|
|
stroke-linecap="round"
|
|
|
|
|
stroke-linejoin="round"
|
|
|
|
|
stroke-width="2"
|
|
|
|
|
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"
|
|
|
|
|
/>
|
|
|
|
|
</svg>
|
|
|
|
|
<span>{$t('settings.no_verified_email_warning')}</span>
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Social Auth & Password Disable -->
|
|
|
|
|
{#if data.props.socialProviders && data.props.socialProviders.length > 0}
|
|
|
|
|
<div class="bg-base-100 rounded-2xl shadow-xl p-8">
|
|
|
|
|
<div class="flex items-center gap-4 mb-6">
|
|
|
|
|
<div class="p-3 bg-info/10 rounded-xl">
|
|
|
|
|
<span class="text-2xl">🔗</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<h2 class="text-2xl font-bold">{$t('settings.social_auth')}</h2>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<p class="text-base-content/70">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
{$t('settings.social_auth_desc_1')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="space-y-6">
|
|
|
|
|
<div class="p-4 bg-base-200 rounded-xl">
|
|
|
|
|
<div class="flex items-center justify-between">
|
|
|
|
|
<div>
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<h3 class="font-semibold">{$t('settings.password_auth')}</h3>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<p class="text-sm text-base-content/70">
|
|
|
|
|
{user.disable_password
|
2025-05-23 17:22:28 -04:00
|
|
|
|
? $t('settings.password_login_disabled')
|
|
|
|
|
: $t('settings.password_login_enabled')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="flex items-center gap-4">
|
|
|
|
|
<div
|
|
|
|
|
class="badge {user.disable_password ? 'badge-error' : 'badge-success'}"
|
|
|
|
|
>
|
2025-05-23 17:22:28 -04:00
|
|
|
|
{user.disable_password
|
|
|
|
|
? $t('settings.disabled')
|
|
|
|
|
: $t('settings.enabled')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</div>
|
|
|
|
|
<input
|
|
|
|
|
type="checkbox"
|
|
|
|
|
bind:checked={user.disable_password}
|
|
|
|
|
on:change={disablePassword}
|
|
|
|
|
class="toggle toggle-primary"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{#if user.disable_password}
|
|
|
|
|
<div class="alert alert-warning mt-4">
|
|
|
|
|
<svg
|
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
|
class="stroke-current shrink-0 h-6 w-6"
|
|
|
|
|
fill="none"
|
|
|
|
|
viewBox="0 0 24 24"
|
|
|
|
|
>
|
|
|
|
|
<path
|
|
|
|
|
stroke-linecap="round"
|
|
|
|
|
stroke-linejoin="round"
|
|
|
|
|
stroke-width="2"
|
|
|
|
|
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"
|
|
|
|
|
/>
|
|
|
|
|
</svg>
|
|
|
|
|
<span>{$t('settings.password_disable_warning')}</span>
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<a
|
|
|
|
|
class="btn btn-outline btn-primary w-full"
|
|
|
|
|
href={`${public_url}/accounts/social/connections/`}
|
|
|
|
|
target="_blank"
|
|
|
|
|
>
|
|
|
|
|
🔗 {$t('settings.launch_account_connections')}
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
<!-- Emails Section -->
|
|
|
|
|
{#if activeSection === 'emails'}
|
|
|
|
|
<div class="bg-base-100 rounded-2xl shadow-xl p-8">
|
|
|
|
|
<div class="flex items-center gap-4 mb-6">
|
|
|
|
|
<div class="p-3 bg-secondary/10 rounded-xl">
|
|
|
|
|
<span class="text-2xl">📧</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<h2 class="text-2xl font-bold">{$t('settings.email_management')}</h2>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<p class="text-base-content/70">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
{$t('settings.email_management_desc')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Current Emails -->
|
|
|
|
|
{#if emails.length > 0}
|
|
|
|
|
<div class="space-y-4 mb-8">
|
|
|
|
|
{#each emails as email}
|
|
|
|
|
<div class="p-4 bg-base-200 rounded-xl">
|
|
|
|
|
<div class="flex items-center justify-between flex-wrap gap-4">
|
|
|
|
|
<div class="flex items-center gap-3">
|
|
|
|
|
<span class="font-medium">{email.email}</span>
|
|
|
|
|
<div class="flex gap-2">
|
|
|
|
|
{#if email.verified}
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<div class="badge badge-success gap-1">
|
|
|
|
|
✅ {$t('settings.verified')}
|
|
|
|
|
</div>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
{:else}
|
|
|
|
|
<div class="badge badge-error gap-1">❌ Not Verified</div>
|
|
|
|
|
{/if}
|
|
|
|
|
{#if email.primary}
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<div class="badge badge-primary gap-1">
|
|
|
|
|
⭐ {$t('settings.primary')}
|
|
|
|
|
</div>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
{/if}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="flex gap-2">
|
|
|
|
|
{#if !email.verified}
|
|
|
|
|
<button
|
|
|
|
|
class="btn btn-sm btn-secondary"
|
|
|
|
|
on:click={() => verifyEmail(email)}
|
|
|
|
|
>
|
2025-05-23 17:22:28 -04:00
|
|
|
|
{$t('settings.verify')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</button>
|
|
|
|
|
{/if}
|
|
|
|
|
{#if !email.primary && email.verified}
|
|
|
|
|
<button
|
|
|
|
|
class="btn btn-sm btn-primary"
|
|
|
|
|
on:click={() => primaryEmail(email)}
|
|
|
|
|
>
|
2025-05-23 17:22:28 -04:00
|
|
|
|
{$t('settings.make_primary')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</button>
|
|
|
|
|
{/if}
|
|
|
|
|
<button
|
|
|
|
|
class="btn btn-sm btn-warning"
|
|
|
|
|
on:click={() => removeEmail(email)}
|
|
|
|
|
>
|
2025-05-23 17:22:28 -04:00
|
|
|
|
{$t('adventures.remove')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{/each}
|
|
|
|
|
</div>
|
|
|
|
|
{:else}
|
|
|
|
|
<div class="text-center py-8">
|
|
|
|
|
<div class="text-6xl mb-4">📧</div>
|
|
|
|
|
<p class="text-lg text-base-content/70">{$t('settings.no_email_set')}</p>
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
<!-- Add New Email -->
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<div class="divider">{$t('settings.add_new_email')}</div>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<form class="space-y-4" on:submit|preventDefault={addEmail}>
|
|
|
|
|
<div class="form-control">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<!-- svelte-ignore a11y-label-has-associated-control -->
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<label class="label">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<span class="label-text font-medium"
|
|
|
|
|
>{$t('settings.add_new_email_address')}</span
|
|
|
|
|
>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</label>
|
|
|
|
|
<input
|
|
|
|
|
type="email"
|
|
|
|
|
bind:value={new_email}
|
|
|
|
|
class="input input-bordered input-primary focus:input-primary"
|
2025-05-23 17:22:28 -04:00
|
|
|
|
placeholder={$t('settings.enter_new_email')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
required
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<button class="btn btn-primary w-full"> ➕ {$t('settings.add_email')} </button>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
<!-- Integrations Section -->
|
|
|
|
|
{#if activeSection === 'integrations'}
|
|
|
|
|
<div class="bg-base-100 rounded-2xl shadow-xl p-8">
|
|
|
|
|
<div class="flex items-center gap-4 mb-6">
|
|
|
|
|
<div class="p-3 bg-accent/10 rounded-xl">
|
|
|
|
|
<span class="text-2xl">🔗</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<h2 class="text-2xl font-bold">{$t('settings.integrations')}</h2>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<p class="text-base-content/70">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
{$t('settings.integrations_desc')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Immich Integration -->
|
|
|
|
|
<div class="p-6 bg-base-200 rounded-xl">
|
|
|
|
|
<div class="flex items-center gap-4 mb-4">
|
|
|
|
|
<img src={ImmichLogo} alt="Immich" class="w-8 h-8" />
|
|
|
|
|
<div>
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<h3 class="text-xl font-bold">{$t('immich.immich_integration')}</h3>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<p class="text-sm text-base-content/70">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
{$t('immich.immich_integration_desc')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
{#if immichIntegration}
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<div class="badge badge-success ml-auto">{$t('settings.connected')}</div>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
{:else}
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<div class="badge badge-error ml-auto">{$t('settings.disconnected')}</div>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
{/if}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{#if immichIntegration && !newImmichIntegration.id}
|
|
|
|
|
<div class="flex gap-4 justify-center mb-4">
|
|
|
|
|
<button
|
|
|
|
|
class="btn btn-warning"
|
|
|
|
|
on:click={() => {
|
|
|
|
|
if (immichIntegration) newImmichIntegration = immichIntegration;
|
|
|
|
|
}}
|
|
|
|
|
>
|
2025-05-23 17:22:28 -04:00
|
|
|
|
✏️ {$t('lodging.edit')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</button>
|
|
|
|
|
<button class="btn btn-error" on:click={disableImmichIntegration}>
|
2025-05-23 17:22:28 -04:00
|
|
|
|
❌ {$t('immich.disable')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
{#if !immichIntegration || newImmichIntegration.id}
|
|
|
|
|
<div class="space-y-4">
|
|
|
|
|
<div class="form-control">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<!-- svelte-ignore a11y-label-has-associated-control -->
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<label class="label">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<span class="label-text font-medium">{$t('immich.server_url')}</span>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</label>
|
|
|
|
|
<input
|
|
|
|
|
type="url"
|
|
|
|
|
bind:value={newImmichIntegration.server_url}
|
|
|
|
|
class="input input-bordered input-primary focus:input-primary"
|
|
|
|
|
placeholder="https://immich.example.com/api"
|
|
|
|
|
/>
|
|
|
|
|
{#if newImmichIntegration.server_url && !newImmichIntegration.server_url.endsWith('api')}
|
|
|
|
|
<div class="label">
|
|
|
|
|
<span class="label-text-alt text-warning">{$t('immich.api_note')}</span>
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
{#if newImmichIntegration.server_url && (newImmichIntegration.server_url.indexOf('localhost') !== -1 || newImmichIntegration.server_url.indexOf('127.0.0.1') !== -1)}
|
|
|
|
|
<div class="label">
|
|
|
|
|
<span class="label-text-alt text-warning"
|
|
|
|
|
>{$t('immich.localhost_note')}</span
|
|
|
|
|
>
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="form-control">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<!-- svelte-ignore a11y-label-has-associated-control -->
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<label class="label">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<span class="label-text font-medium">{$t('immich.api_key')}</span>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</label>
|
|
|
|
|
<input
|
|
|
|
|
type="password"
|
|
|
|
|
bind:value={newImmichIntegration.api_key}
|
|
|
|
|
class="input input-bordered input-primary focus:input-primary"
|
2025-05-23 17:22:28 -04:00
|
|
|
|
placeholder={$t('immich.api_key_placeholder')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<button on:click={enableImmichIntegration} class="btn btn-primary w-full">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
{!immichIntegration?.id
|
|
|
|
|
? `🔗 ${$t('immich.enable_integration')}`
|
|
|
|
|
: `💾 ${$t('immich.update_integration')}`}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
<div class="mt-4 p-4 bg-info/10 rounded-lg">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<p class="text-sm">
|
|
|
|
|
📖 {$t('immich.need_help')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<a
|
|
|
|
|
class="link link-primary"
|
|
|
|
|
href="https://adventurelog.app/docs/configuration/immich_integration.html"
|
2025-05-23 17:22:28 -04:00
|
|
|
|
target="_blank">{$t('navbar.documentation')}</a
|
2025-05-23 12:15:44 -04:00
|
|
|
|
>
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
<!-- Admin Section -->
|
|
|
|
|
{#if activeSection === 'admin' && user.is_staff}
|
|
|
|
|
<div class="bg-base-100 rounded-2xl shadow-xl p-8">
|
|
|
|
|
<div class="flex items-center gap-4 mb-6">
|
|
|
|
|
<div class="p-3 bg-error/10 rounded-xl">
|
|
|
|
|
<span class="text-2xl">⚙️</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<h2 class="text-2xl font-bold">{$t('settings.administration')}</h2>
|
|
|
|
|
<p class="text-base-content/70">{$t('settings.administration_desc')}</p>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
|
|
|
<div
|
|
|
|
|
class="card bg-gradient-to-br from-primary/10 to-secondary/10 border border-primary/20"
|
|
|
|
|
>
|
|
|
|
|
<div class="card-body text-center">
|
|
|
|
|
<div class="text-4xl mb-4">🛠️</div>
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<h3 class="card-title justify-center">{$t('navbar.admin_panel')}</h3>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<p class="text-sm text-base-content/70 mb-4">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
{$t('settings.admin_panel_desc')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</p>
|
|
|
|
|
<a class="btn btn-primary" href={`${public_url}/admin/`} target="_blank">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
{$t('settings.launch_administration_panel')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
class="card bg-gradient-to-br from-info/10 to-success/10 border border-info/20"
|
|
|
|
|
>
|
|
|
|
|
<div class="card-body text-center">
|
|
|
|
|
<div class="text-4xl mb-4">📍</div>
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<h3 class="card-title justify-center">{$t('settings.region_updates')}</h3>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<p class="text-sm text-base-content/70 mb-4">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
{$t('settings.region_updates_desc')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</p>
|
|
|
|
|
<button class="btn btn-info" on:click={checkVisitedRegions}>
|
2025-05-23 17:22:28 -04:00
|
|
|
|
{$t('adventures.update_visited_regions')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{:else if activeSection === 'admin' && !user.is_staff}
|
|
|
|
|
<div class="bg-base-100 rounded-2xl shadow-xl p-8 text-center">
|
|
|
|
|
<div class="text-6xl mb-4">🔒</div>
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<h2 class="text-2xl font-bold mb-2">{$t('settings.access_restricted')}</h2>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<p class="text-base-content/70">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
{$t('settings.access_restricted_desc')}
|
2025-01-03 18:46:45 -05:00
|
|
|
|
</p>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
<!-- Advanced Section -->
|
|
|
|
|
{#if activeSection === 'advanced'}
|
|
|
|
|
<div class="space-y-8">
|
|
|
|
|
<!-- Social Auth Info -->
|
|
|
|
|
<div class="bg-base-100 rounded-2xl shadow-xl p-8">
|
|
|
|
|
<div class="flex items-center gap-4 mb-6">
|
|
|
|
|
<div class="p-3 bg-warning/10 rounded-xl">
|
|
|
|
|
<span class="text-2xl">🛠️</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<h2 class="text-2xl font-bold">{$t('settings.advanced_settings')}</h2>
|
|
|
|
|
<p class="text-base-content/70">
|
|
|
|
|
{$t('settings.advanced_settings_desc')}
|
|
|
|
|
</p>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="space-y-6">
|
|
|
|
|
<!-- Social Auth Configuration -->
|
|
|
|
|
<div class="p-6 bg-base-200 rounded-xl">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<h3 class="text-lg font-semibold mb-4">{$t('settings.social_auth_setup')}</h3>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<p class="text-base-content/70 mb-4">{$t('settings.social_auth_desc')}</p>
|
|
|
|
|
|
|
|
|
|
<div class="alert alert-info">
|
|
|
|
|
<svg
|
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
|
fill="none"
|
|
|
|
|
viewBox="0 0 24 24"
|
|
|
|
|
class="stroke-info shrink-0 w-6 h-6"
|
|
|
|
|
>
|
|
|
|
|
<path
|
|
|
|
|
stroke-linecap="round"
|
|
|
|
|
stroke-linejoin="round"
|
|
|
|
|
stroke-width="2"
|
|
|
|
|
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
|
|
|
></path>
|
|
|
|
|
</svg>
|
|
|
|
|
<div>
|
|
|
|
|
<span>{$t('settings.social_auth_desc_2')}</span>
|
|
|
|
|
<a
|
|
|
|
|
href="https://adventurelog.app/docs/configuration/social_auth.html"
|
|
|
|
|
class="link link-neutral font-medium"
|
|
|
|
|
target="_blank">{$t('settings.documentation_link')}</a
|
|
|
|
|
>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Debug Information -->
|
|
|
|
|
<div class="p-6 bg-base-200 rounded-xl">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<h3 class="text-lg font-semibold mb-4">{$t('settings.debug_information')}</h3>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 text-sm font-mono">
|
|
|
|
|
<div class="p-3 bg-base-300 rounded-lg">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<span class="text-base-content/60">UUID:</span>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<br />
|
|
|
|
|
<span class="text-primary font-semibold">{user.uuid}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="p-3 bg-base-300 rounded-lg">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<span class="text-base-content/60">{$t('settings.staff_status')}:</span>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<br />
|
|
|
|
|
<span class="badge {user.is_staff ? 'badge-success' : 'badge-error'}">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
{user.is_staff ? $t('settings.staff_user') : $t('settings.regular_user')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="p-3 bg-base-300 rounded-lg">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<span class="text-base-content/60">{$t('settings.app_version')}:</span>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<br />
|
|
|
|
|
<span class="text-secondary font-semibold">{appTitle} {appVersion}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="p-3 bg-base-300 rounded-lg">
|
|
|
|
|
<span class="text-base-content/60">Profile Type:</span>
|
|
|
|
|
<br />
|
|
|
|
|
<span class="badge {user.public_profile ? 'badge-info' : 'badge-ghost'}">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
{user.public_profile ? $t('adventures.public') : $t('adventures.private')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Quick Actions -->
|
|
|
|
|
<div class="p-6 bg-base-200 rounded-xl">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<h3 class="text-lg font-semibold mb-4">{$t('settings.quick_actions')}</h3>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
|
|
|
<button class="btn btn-outline btn-info" on:click={checkVisitedRegions}>
|
2025-05-23 17:22:28 -04:00
|
|
|
|
📍 {$t('adventures.update_visited_regions')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</button>
|
|
|
|
|
{#if user.is_staff}
|
|
|
|
|
<a
|
|
|
|
|
class="btn btn-outline btn-primary"
|
|
|
|
|
href={`${public_url}/admin/`}
|
|
|
|
|
target="_blank"
|
|
|
|
|
>
|
2025-05-23 17:22:28 -04:00
|
|
|
|
⚙️ {$t('settings.launch_administration_panel')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</a>
|
|
|
|
|
{/if}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Developer message and thanks -->
|
|
|
|
|
<div class="p-6 bg-base-200 rounded-xl">
|
|
|
|
|
<div class="text-center space-y-3">
|
2025-05-23 17:22:28 -04:00
|
|
|
|
<h4 class="font-medium">{$t('about.about')} AdventureLog</h4>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
<p>
|
2025-05-23 17:22:28 -04:00
|
|
|
|
{$t('about.license')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</p>
|
|
|
|
|
<p class="text-sm text-base-content/70">
|
|
|
|
|
© {copyrightYear}
|
|
|
|
|
<a href="https://seanmorley.com" target="_blank" class="link">Sean Morley</a
|
2025-05-23 17:22:28 -04:00
|
|
|
|
>. {$t('settings.all_rights_reserved')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</p>
|
|
|
|
|
<div class="flex justify-center gap-3 mt-2">
|
|
|
|
|
<a
|
|
|
|
|
href="https://github.com/seanmorley15/AdventureLog"
|
|
|
|
|
target="_blank"
|
|
|
|
|
class="link link-primary text-sm"
|
|
|
|
|
>
|
2025-05-23 17:22:28 -04:00
|
|
|
|
GitHub
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</a>
|
|
|
|
|
<a
|
|
|
|
|
href="https://github.com/seanmorley15/AdventureLog/blob/main/LICENSE"
|
|
|
|
|
target="_blank"
|
|
|
|
|
class="link link-secondary text-sm"
|
|
|
|
|
>
|
2025-05-23 17:22:28 -04:00
|
|
|
|
{$t('settings.license')}
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
2025-01-02 13:34:51 -05:00
|
|
|
|
</div>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</div>
|
2025-01-02 13:34:51 -05:00
|
|
|
|
</div>
|
2025-05-23 12:15:44 -04:00
|
|
|
|
</div>
|
2024-12-19 18:46:52 -05:00
|
|
|
|
</div>
|
2024-07-08 11:44:39 -04:00
|
|
|
|
|
|
|
|
|
<svelte:head>
|
|
|
|
|
<title>User Settings | AdventureLog</title>
|
|
|
|
|
<meta
|
|
|
|
|
name="description"
|
2025-05-23 12:15:44 -04:00
|
|
|
|
content="Comprehensive user settings dashboard. Manage your profile, security, emails, integrations, and more in one organized interface."
|
2024-07-08 11:44:39 -04:00
|
|
|
|
/>
|
|
|
|
|
</svelte:head>
|