Remove vault settings dialog (no password change/delete)
This commit is contained in:
parent
2ff6c6b1a3
commit
25d27be681
1 changed files with 1 additions and 89 deletions
|
|
@ -353,15 +353,11 @@ async function openUncloseaiEmbeddedModalNew() {
|
|||
<div style="display: flex; align-items: center; gap: 8px;">
|
||||
<span style="color: #28a745;">✓ ${getUIText("vaultLoggedIn")}</span>
|
||||
</div>
|
||||
<div style="display: flex; gap: 8px;">
|
||||
<button class="vault-lock-btn uncloseai-btn-small" title="${getUIText("vaultLockTooltip")}">🔒 ${getUIText("vaultLock")}</button>
|
||||
<button class="vault-settings-btn uncloseai-btn-small" title="${getUIText("vaultChangePassword")}">⚙️</button>
|
||||
</div>
|
||||
<button class="vault-lock-btn uncloseai-btn-small" title="${getUIText("vaultLockTooltip")}">🔒 ${getUIText("vaultLock")}</button>
|
||||
</div>
|
||||
`;
|
||||
|
||||
const lockBtn = unlockedUI.querySelector('.vault-lock-btn');
|
||||
const settingsBtn = unlockedUI.querySelector('.vault-settings-btn');
|
||||
|
||||
lockBtn.onclick = () => {
|
||||
UncloseVault.lock();
|
||||
|
|
@ -371,10 +367,6 @@ async function openUncloseaiEmbeddedModalNew() {
|
|||
settingsPanel.classList.remove("open");
|
||||
};
|
||||
|
||||
settingsBtn.onclick = () => {
|
||||
showVaultSettings();
|
||||
};
|
||||
|
||||
vaultSection.appendChild(unlockedUI);
|
||||
settingsContent.style.display = 'block'; // Show settings when unlocked
|
||||
} else {
|
||||
|
|
@ -444,86 +436,6 @@ async function openUncloseaiEmbeddedModalNew() {
|
|||
}
|
||||
}
|
||||
|
||||
// Show vault settings dialog (change password, delete)
|
||||
function showVaultSettings() {
|
||||
const existingDialog = document.getElementById('vault-settings-dialog');
|
||||
if (existingDialog) existingDialog.remove();
|
||||
|
||||
const dialog = document.createElement('dialog');
|
||||
dialog.id = 'vault-settings-dialog';
|
||||
dialog.style.cssText = 'padding: 20px; border-radius: 8px; max-width: 400px; border: 1px solid var(--uncloseai-border-color, #ccc);';
|
||||
dialog.innerHTML = `
|
||||
<h3 style="margin-top: 0;">🔑 ${getUIText("vaultChangePassword")}</h3>
|
||||
<input type="password" class="current-password uncloseai-input" placeholder="${getUIText("vaultCurrentPassword")}" style="margin-bottom: 8px; width: 100%;">
|
||||
<input type="password" class="new-password uncloseai-input" placeholder="${getUIText("vaultNewPassword")}" style="margin-bottom: 12px; width: 100%;">
|
||||
<button class="change-password-btn uncloseai-btn-control" style="width: 100%; margin-bottom: 16px;">${getUIText("vaultChangePassword")}</button>
|
||||
|
||||
<hr style="margin: 16px 0; border: none; border-top: 1px solid #ccc;">
|
||||
|
||||
<details style="margin-bottom: 12px;">
|
||||
<summary style="cursor: pointer; color: #6c757d; font-size: 0.9em;">${getUIText("vaultDeleteVault")}</summary>
|
||||
<div style="margin-top: 12px;">
|
||||
<p style="font-size: 0.9em; opacity: 0.8;">${getUIText("vaultDeleteConfirm")}</p>
|
||||
<input type="password" class="delete-password uncloseai-input" placeholder="${getUIText("vaultCurrentPassword")}" style="margin-bottom: 8px; width: 100%;">
|
||||
<button class="delete-vault-btn uncloseai-btn-control" style="width: 100%; background: #dc3545; border-color: #dc3545;">${getUIText("vaultDeleteVault")}</button>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<div class="vault-dialog-error" style="color: #dc3545; margin-top: 12px; display: none;"></div>
|
||||
|
||||
<button class="close-dialog-btn uncloseai-btn-control" style="width: 100%; margin-top: 8px;">Close</button>
|
||||
`;
|
||||
|
||||
const changeBtn = dialog.querySelector('.change-password-btn');
|
||||
const deleteBtn = dialog.querySelector('.delete-vault-btn');
|
||||
const closeBtn = dialog.querySelector('.close-dialog-btn');
|
||||
const errorDiv = dialog.querySelector('.vault-dialog-error');
|
||||
|
||||
changeBtn.onclick = () => {
|
||||
const current = dialog.querySelector('.current-password').value;
|
||||
const newPass = dialog.querySelector('.new-password').value;
|
||||
|
||||
if (newPass.length < 8) {
|
||||
errorDiv.textContent = getUIText("vaultPasswordTooShort");
|
||||
errorDiv.style.display = 'block';
|
||||
return;
|
||||
}
|
||||
|
||||
const result = UncloseVault.changePassword(current, newPass);
|
||||
if (result.success) {
|
||||
alert(getUIText("vaultPasswordChanged"));
|
||||
dialog.close();
|
||||
dialog.remove();
|
||||
} else {
|
||||
errorDiv.textContent = result.error;
|
||||
errorDiv.style.display = 'block';
|
||||
}
|
||||
};
|
||||
|
||||
deleteBtn.onclick = () => {
|
||||
const password = dialog.querySelector('.delete-password').value;
|
||||
const result = UncloseVault.deleteVault(password);
|
||||
|
||||
if (result.success) {
|
||||
alert(getUIText("vaultDeleted"));
|
||||
dialog.close();
|
||||
dialog.remove();
|
||||
buildVaultUI();
|
||||
} else {
|
||||
errorDiv.textContent = result.error;
|
||||
errorDiv.style.display = 'block';
|
||||
}
|
||||
};
|
||||
|
||||
closeBtn.onclick = () => {
|
||||
dialog.close();
|
||||
dialog.remove();
|
||||
};
|
||||
|
||||
document.body.appendChild(dialog);
|
||||
dialog.showModal();
|
||||
}
|
||||
|
||||
// Migrate existing localStorage settings to vault
|
||||
function migrateSettingsToVault() {
|
||||
if (!UncloseVault.isUnlocked()) return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue