KI-AGENT: Defekte Mailkonto-Verschlüsselung abfangen
This commit is contained in:
@@ -5,6 +5,7 @@ const toast = useToast()
|
||||
const mode = route.params.mode
|
||||
const isCreate = computed(() => mode === "create")
|
||||
const loading = ref(false)
|
||||
const credentialsReadable = ref(true)
|
||||
|
||||
const itemInfo = ref({
|
||||
email: "",
|
||||
@@ -20,6 +21,7 @@ const itemInfo = ref({
|
||||
const setup = async () => {
|
||||
if(!isCreate.value) {
|
||||
const account = await useNuxtApp().$api(`/api/email/accounts/${route.params.id}`)
|
||||
credentialsReadable.value = account.credentialsReadable !== false
|
||||
itemInfo.value = {
|
||||
...itemInfo.value,
|
||||
...account,
|
||||
@@ -36,6 +38,13 @@ const payload = () => ({
|
||||
password: itemInfo.value.password || undefined,
|
||||
})
|
||||
|
||||
const canSave = computed(() => Boolean(
|
||||
itemInfo.value.email
|
||||
&& itemInfo.value.imapHost
|
||||
&& itemInfo.value.smtpHost
|
||||
&& (isCreate.value || credentialsReadable.value || itemInfo.value.password)
|
||||
))
|
||||
|
||||
const createAccount = async () => {
|
||||
loading.value = true
|
||||
const res = await useNuxtApp().$api(`/api/email/accounts`, {
|
||||
@@ -123,7 +132,7 @@ const syncAccount = async () => {
|
||||
v-if="!isCreate"
|
||||
icon="i-heroicons-check"
|
||||
:loading="loading"
|
||||
:disabled="!itemInfo.email || !itemInfo.imapHost || !itemInfo.smtpHost"
|
||||
:disabled="!canSave"
|
||||
@click="saveAccount"
|
||||
>
|
||||
Speichern
|
||||
@@ -132,6 +141,16 @@ const syncAccount = async () => {
|
||||
</UDashboardNavbar>
|
||||
|
||||
<div class="mx-auto max-w-4xl p-4">
|
||||
<UAlert
|
||||
v-if="!isCreate && !credentialsReadable"
|
||||
class="mb-4"
|
||||
color="error"
|
||||
variant="soft"
|
||||
icon="i-heroicons-exclamation-triangle"
|
||||
title="Zugangsdaten müssen repariert werden"
|
||||
description="Die Daten wurden mit einem anderen oder nicht mehr verfügbaren Verschlüsselungsschlüssel gespeichert. Trage E-Mail-Adresse, Passwort, IMAP-Host und SMTP-Host vollständig neu ein und speichere das Konto."
|
||||
/>
|
||||
|
||||
<UAlert
|
||||
v-if="!isCreate"
|
||||
class="mb-4"
|
||||
@@ -139,7 +158,7 @@ const syncAccount = async () => {
|
||||
variant="soft"
|
||||
icon="i-heroicons-lock-closed"
|
||||
title="Passwort bleibt geschützt"
|
||||
description="Das gespeicherte Passwort wird nicht angezeigt. Trage nur dann ein neues Passwort ein, wenn du es ändern möchtest."
|
||||
:description="credentialsReadable ? 'Das gespeicherte Passwort wird nicht angezeigt. Trage nur dann ein neues Passwort ein, wenn du es ändern möchtest.' : 'Das bisherige Passwort kann nicht entschlüsselt werden und muss neu eingetragen werden.'"
|
||||
/>
|
||||
|
||||
<UForm class="grid gap-6">
|
||||
@@ -158,11 +177,11 @@ const syncAccount = async () => {
|
||||
/>
|
||||
</UFormField>
|
||||
|
||||
<UFormField :label="isCreate ? 'Passwort' : 'Neues Passwort'">
|
||||
<UFormField :label="isCreate || !credentialsReadable ? 'Passwort' : 'Neues Passwort'">
|
||||
<UInput
|
||||
v-model="itemInfo.password"
|
||||
type="password"
|
||||
:placeholder="isCreate ? '' : 'Unverändert lassen'"
|
||||
:placeholder="isCreate || !credentialsReadable ? '' : 'Unverändert lassen'"
|
||||
/>
|
||||
</UFormField>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user