Skip to content

Commit 7f5ce2a

Browse files
committed
Keep staff account deletion on the CMS.
Readers can still delete from docs; team accounts are sent to cms.lap.onl instead.
1 parent e932b44 commit 7f5ce2a

1 file changed

Lines changed: 35 additions & 14 deletions

File tree

app/account/page.tsx

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const fieldClassName =
4747

4848
const primaryButtonClassName =
4949
"group inline-flex min-h-16 w-full items-center justify-between bg-white px-5 font-semibold uppercase text-black transition-colors duration-300 hover:bg-[#8a2ae3] hover:text-white focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-[#8a2ae3] active:translate-y-px disabled:cursor-not-allowed disabled:opacity-40";
50-
const CMS_PROFILE_URL = "https://lap-cms.vercel.app/admin/profile";
50+
const CMS_PROFILE_URL = "https://cms.lap.onl/admin/profile";
5151

5252
async function checkCurrentDevice() {
5353
const payload = await getDeviceRiskPayload();
@@ -516,6 +516,10 @@ export default function AccountPage() {
516516

517517
const removeAccount = async () => {
518518
if (!user || deletingAccount) return;
519+
if (isStaff) {
520+
setError("Staff accounts can only be deleted from the CMS.");
521+
return;
522+
}
519523

520524
const confirmation = window.prompt(
521525
"This permanently deletes your account and profile. Your comments will remain as Deleted user, and your article bylines and votes will remain. Type DELETE to continue.",
@@ -861,19 +865,36 @@ export default function AccountPage() {
861865

862866
<div className="border-t border-white/20 pt-8">
863867
<h2 className="text-lg font-semibold uppercase">Delete account</h2>
864-
<p className="mt-2 max-w-xl text-sm leading-6 text-white/50">
865-
Your profile and sign-in will be permanently removed. Articles,
866-
comments, replies, and their vote totals will stay published.
867-
</p>
868-
<button
869-
type="button"
870-
onClick={removeAccount}
871-
disabled={deletingAccount}
872-
className="mt-5 inline-flex items-center gap-2 border-b border-red-400/60 pb-1 text-sm font-semibold uppercase text-red-300 transition-colors hover:border-red-300 hover:text-red-200 disabled:cursor-not-allowed disabled:opacity-40"
873-
>
874-
<RiDeleteBinLine className="text-lg" aria-hidden="true" />
875-
{deletingAccount ? "Deleting…" : "Delete my account"}
876-
</button>
868+
{isStaff ? (
869+
<>
870+
<p className="mt-2 max-w-xl text-sm leading-6 text-white/50">
871+
Team accounts can only be deleted from the CMS.
872+
</p>
873+
<a
874+
href={CMS_PROFILE_URL}
875+
className="mt-5 inline-flex items-center gap-2 border-b border-white/40 pb-1 text-sm font-semibold uppercase transition-colors hover:border-[#8a2ae3] hover:text-[#8a2ae3]"
876+
>
877+
Open CMS profile
878+
<RiArrowRightLine className="text-xl" aria-hidden="true" />
879+
</a>
880+
</>
881+
) : (
882+
<>
883+
<p className="mt-2 max-w-xl text-sm leading-6 text-white/50">
884+
Your profile and sign-in will be permanently removed. Articles,
885+
comments, replies, and their vote totals will stay published.
886+
</p>
887+
<button
888+
type="button"
889+
onClick={removeAccount}
890+
disabled={deletingAccount}
891+
className="mt-5 inline-flex items-center gap-2 border-b border-red-400/60 pb-1 text-sm font-semibold uppercase text-red-300 transition-colors hover:border-red-300 hover:text-red-200 disabled:cursor-not-allowed disabled:opacity-40"
892+
>
893+
<RiDeleteBinLine className="text-lg" aria-hidden="true" />
894+
{deletingAccount ? "Deleting…" : "Delete my account"}
895+
</button>
896+
</>
897+
)}
877898
</div>
878899
</div>
879900
) : isBanned || isDeviceBlocked ? null : (

0 commit comments

Comments
 (0)