refactor(credentials): remove credential expiry support and API

The credential expiry feature has been removed from both the Rust
backend and the frontend. Stored credentials now include only
username and password.

- Remove expiresAt field from StoredCredential
- Simplify API by removing expiry param from credSave
- Drop expiry UI and expiry checks across the app
This commit is contained in:
Christoph Brandau
2026-08-13 20:45:43 +02:00
parent cc0f1c076f
commit 6434a9f10c
7 changed files with 13 additions and 73 deletions
+6 -20
View File
@@ -180,7 +180,6 @@
import {
orgKeyFromUrl,
isCredentialExpired,
isAuthError,
stripAuthPrefix,
summarizeGitError,
@@ -2219,11 +2218,10 @@
if (!username && !password) {
const stored = await loadStoredCredential(credentialKey);
if (stored && !isCredentialExpired(stored)) {
if (stored) {
await cloneRepo(remoteUrl, parentPath, directoryName, stored.username, stored.password, credentialKey, true);
return;
}
if (stored && credentialKey) await credDelete(credentialKey).catch(() => {});
}
operation = "Cloning repository";
@@ -2921,7 +2919,7 @@
if (!activeRepoPath || isBusy) return;
const key = await currentCredKey();
const stored = await loadStoredCredential(key);
const credential = stored && !isCredentialExpired(stored) ? stored : null;
const credential = stored ?? null;
await runOperation(`Pushing tag ${tag.name}`, async () => {
try {
@@ -3028,12 +3026,7 @@
async function storedCredentialForNoteRemote(remote: string, direction: "fetch" | "push") {
const config = commitNoteRemotes.find((item) => item.name === remote);
const key = orgKeyFromUrl(direction === "push" ? (config?.push_url ?? "") : (config?.fetch_url ?? ""));
const stored = await loadStoredCredential(key);
if (stored && isCredentialExpired(stored)) {
if (key) await credDelete(key).catch(() => {});
return null;
}
return stored;
return loadStoredCredential(key);
}
function commitNoteRemoteError(error: unknown): string {
@@ -3271,12 +3264,7 @@
handleRemoteResult("push", key, fromStore);
}
async function handleCredentialSubmit(
username: string,
password: string,
save: boolean,
expiresAt: string | null,
) {
async function handleCredentialSubmit(username: string, password: string, save: boolean) {
const key = credDialogKey;
if (credDialogAction === "pull") await doActualPull(username, password, key, false);
else if (credDialogAction === "push") await doActualPush(username, password, key, false);
@@ -3296,7 +3284,7 @@
// Only persist once the operation actually succeeded (dialog has closed).
if (!credDialogOpen && save && key) {
try {
await credSave(key, username, password, expiresAt);
await credSave(key, username, password);
} catch (error) {
errorMessage = errorToMessage(error);
}
@@ -3311,15 +3299,13 @@
const key = await currentCredKey();
const stored = await loadStoredCredential(key);
if (stored && !isCredentialExpired(stored)) {
if (stored) {
if (action === "pull") await doActualPull(stored.username, stored.password, key, true);
else if (action === "fetch") await doActualFetch(stored.username, stored.password, key, true);
else await doActualPush(stored.username, stored.password, key, true);
return;
}
// Expired entry → clean it up before prompting again.
if (stored && key) await credDelete(key).catch(() => {});
await openCredentialDialog(action, key);
}