Simplify vault UI: remove confirm password, settings hidden until unlocked
This commit is contained in:
parent
5159355c98
commit
2ff6c6b1a3
1 changed files with 2 additions and 21 deletions
|
|
@ -389,7 +389,6 @@ async function openUncloseaiEmbeddedModalNew() {
|
|||
${hasVault ? getUIText("vaultWelcomeBack") : getUIText("vaultWelcome")}
|
||||
</div>
|
||||
<input type="password" class="vault-password uncloseai-input" placeholder="${getUIText("vaultPasswordPlaceholder")}" style="margin-bottom: 8px; width: 100%;">
|
||||
${!hasVault ? `<input type="password" class="vault-confirm uncloseai-input" placeholder="${getUIText("vaultConfirmPlaceholder")}" style="margin-bottom: 8px; width: 100%;">` : ''}
|
||||
<button class="vault-submit-btn uncloseai-btn-control" style="width: 100%;">
|
||||
${hasVault ? getUIText("vaultUnlock") : getUIText("vaultCreate")}
|
||||
</button>
|
||||
|
|
@ -398,7 +397,6 @@ async function openUncloseaiEmbeddedModalNew() {
|
|||
`;
|
||||
|
||||
const passwordInput = promptUI.querySelector('.vault-password');
|
||||
const confirmInput = promptUI.querySelector('.vault-confirm');
|
||||
const submitBtn = promptUI.querySelector('.vault-submit-btn');
|
||||
const errorDiv = promptUI.querySelector('.vault-error');
|
||||
|
||||
|
|
@ -419,20 +417,12 @@ async function openUncloseaiEmbeddedModalNew() {
|
|||
}
|
||||
} else {
|
||||
// Create new vault
|
||||
const confirm = confirmInput ? confirmInput.value : '';
|
||||
|
||||
if (password.length < 8) {
|
||||
errorDiv.textContent = getUIText("vaultPasswordTooShort");
|
||||
errorDiv.style.display = 'block';
|
||||
return;
|
||||
}
|
||||
|
||||
if (password !== confirm) {
|
||||
errorDiv.textContent = getUIText("vaultPasswordMismatch");
|
||||
errorDiv.style.display = 'block';
|
||||
return;
|
||||
}
|
||||
|
||||
const result = UncloseVault.create(password);
|
||||
if (result.success) {
|
||||
migrateSettingsToVault();
|
||||
|
|
@ -445,8 +435,7 @@ async function openUncloseaiEmbeddedModalNew() {
|
|||
};
|
||||
|
||||
// Allow Enter key to submit
|
||||
const lastInput = confirmInput || passwordInput;
|
||||
lastInput.onkeydown = (e) => {
|
||||
passwordInput.onkeydown = (e) => {
|
||||
if (e.key === 'Enter') submitBtn.click();
|
||||
};
|
||||
|
||||
|
|
@ -466,8 +455,7 @@ async function openUncloseaiEmbeddedModalNew() {
|
|||
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: 8px; width: 100%;">
|
||||
<input type="password" class="confirm-password uncloseai-input" placeholder="${getUIText("vaultConfirmPlaceholder")}" style="margin-bottom: 12px; 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;">
|
||||
|
|
@ -494,7 +482,6 @@ async function openUncloseaiEmbeddedModalNew() {
|
|||
changeBtn.onclick = () => {
|
||||
const current = dialog.querySelector('.current-password').value;
|
||||
const newPass = dialog.querySelector('.new-password').value;
|
||||
const confirm = dialog.querySelector('.confirm-password').value;
|
||||
|
||||
if (newPass.length < 8) {
|
||||
errorDiv.textContent = getUIText("vaultPasswordTooShort");
|
||||
|
|
@ -502,12 +489,6 @@ async function openUncloseaiEmbeddedModalNew() {
|
|||
return;
|
||||
}
|
||||
|
||||
if (newPass !== confirm) {
|
||||
errorDiv.textContent = getUIText("vaultPasswordMismatch");
|
||||
errorDiv.style.display = 'block';
|
||||
return;
|
||||
}
|
||||
|
||||
const result = UncloseVault.changePassword(current, newPass);
|
||||
if (result.success) {
|
||||
alert(getUIText("vaultPasswordChanged"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue