Skip to content

Add account export and deletion controls - #71

Open
joan-code6 wants to merge 3 commits into
mainfrom
feat/account-data-rights
Open

joan-code6 wants to merge 3 commits into
mainfrom
feat/account-data-rights

Conversation

@joan-code6

Copy link
Copy Markdown
Owner

Summary

  • add Datenschutz und Konto settings section
  • allow users to download their LANIS-held account export
  • require exact LÖSCHEN confirmation for account deletion
  • clear browser storage, caches and push subscription after deletion

Validation

  • npx tsc --noEmit

Note: unrelated pre-existing worktree changes were left uncommitted.

@appwrite

appwrite Bot commented Sep 21, 2026

Copy link
Copy Markdown

Lanis

Project ID: 698337a60017b46df380

Sites (1)
Site Status Logs Preview QR
 lanis_ui
6a180889003c768d3660
Ready Ready View Logs Preview URL QR Code

Tip

Deploy functions via zip upload or connect directly to your Git repo

@coderabbitai

coderabbitai Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: ba03b646-eb37-4af5-851b-0513fbe4018a


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f32f6f3dd5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/components/settings/Settings.tsx Outdated
Comment on lines +231 to +233
for (let index = localStorage.length - 1; index >= 0; index -= 1) {
const key = localStorage.key(index);
if (key) localStorage.removeItem(key);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Hide destructive account controls in demo mode

On /demo/settings/account, the demo API adapter falls through to a successful mocked response for DELETE /account, after which this loop clears the browser's entire real localStorage. Because DemoRoute's mock logout is a no-op and the storage snapshot itself is also removed, testing account deletion in the demo can erase real login tokens, custom-backend configuration, and other persisted settings without deleting any server account. Exclude this section in demo mode or provide a non-destructive demo implementation.

Useful? React with 👍 / 👎.

Comment thread src/components/settings/Settings.tsx Outdated
? await navigator.serviceWorker.getRegistration()
: undefined;
const subscription = await registration?.pushManager.getSubscription();
if (subscription) await subscription.unsubscribe();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Always finish logout after server deletion

If PushSubscription.unsubscribe() rejects after DELETE /account has already succeeded, control jumps to the outer catch before logout() and the redirect run. The account is therefore permanently deleted while the current React auth state still says the user is signed in, leaving them on the settings page with a misleading retryable-error message; make cache/push cleanup best-effort and place local logout/navigation in an unconditional post-deletion path.

Useful? React with 👍 / 👎.

Comment thread public/robots.txt Outdated
User-agent: *
Allow: /
Disallow: /login
Disallow: /impressum

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Allow crawlers to read the Impressum noindex directive

Disallowing /impressum prevents compliant crawlers from fetching the page and observing the existing noindex meta tag in Impressum.tsx. Because the landing page still links to this URL, search engines can retain or create a URL-only result while being unable to process the directive intended to remove it; allow crawling and rely on the page-level noindex instead.

Useful? React with 👍 / 👎.

@joan-code6
joan-code6 force-pushed the feat/account-data-rights branch from f32f6f3 to 54851bf Compare September 22, 2026 08:33

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 54851bf1e9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/components/settings/Settings.tsx Outdated
Comment on lines +232 to +235
const registration = 'serviceWorker' in navigator
? await navigator.serviceWorker.getRegistration()
: undefined;
const subscription = await registration?.pushManager.getSubscription();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Guarantee logout after service-worker lookup failures

If the account deletion succeeds but getRegistration() or getSubscription() rejects—for example because the browser cannot access its push/service-worker storage—the outer catch still runs before localStorage.clear(), logout(), and navigation, leaving the UI authenticated to an account that no longer exists. Although subscription cleanup is now covered by Promise.allSettled, these newly exposed awaited lookups remain outside that best-effort boundary; local logout and redirect should run unconditionally after a successful deletion.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3dbcfae529

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}
await Promise.allSettled(cleanupTasks);
try {
localStorage.clear();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve the configured backend when deleting an account

When the user is connected to a custom backend, localStorage.clear() also removes lanis_custom_backend_url, which is a device-level setting rather than account data. The current API client continues using the custom backend only until a reload; afterward the login page silently switches to the default backend, so a user trying to sign back into the same deployment can submit credentials to the wrong server. Use the existing scoped-storage cleanup or explicitly preserve the custom-backend key.

Useful? React with 👍 / 👎.

Comment on lines +254 to +256
await Promise.allSettled(cleanupTasks);
try {
localStorage.clear();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clear the selected-school cookies during account cleanup

Deleting an account clears local storage and Cache Storage but leaves the lastSchoolId, lastSchoolName, and lastSchoolLocation cookies intact. LoginForm reads those cookies and repopulates the deleted user's school on the next login screen, so the promised local-data cleanup is incomplete; expire these cookies as clearBackendScopedStorage() already does.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant