diff --git a/components/pages/inspector/AccountActions.tsx b/components/pages/inspector/AccountActions.tsx
index 93012f5..7d599d9 100644
--- a/components/pages/inspector/AccountActions.tsx
+++ b/components/pages/inspector/AccountActions.tsx
@@ -11,6 +11,7 @@ import {
disableAccount,
queueAccountDeletion,
restoreAccount,
+ verifyAccountEmail,
} from "@/lib/actions";
import dayjs from "dayjs";
@@ -86,6 +87,56 @@ export function AccountActions({
+
+
+
+
+
+
+
+
+ Mark Email as verified
+
+
+ Verification status is currently {accountDraft.verification.status}.
+
+
+
+ Cancel
+ {
+ try {
+ await verifyAccountEmail(account._id);
+ toast({ title: "Verified email" });
+ setAccountDraft({ ...accountDraft, verification: { status: "Verified" } });
+ } catch(e) {
+ toast({
+ title: "Failed to verify",
+ description: String(e),
+ variant: "destructive",
+ })
+ }
+ }}
+ >
+ Mark verified
+
+ {
+ navigator.clipboard.writeText(`https://app.revolt.chat/login/verify/${(accountDraft.verification as any).token}`);
+ toast({ title: "Copied verification link" })
+ }}
+ >
+ Copy link
+
+
+
+
diff --git a/lib/actions.ts b/lib/actions.ts
index 0d76a6d..044be12 100644
--- a/lib/actions.ts
+++ b/lib/actions.ts
@@ -5,6 +5,7 @@ import { PLATFORM_MOD_ID, RESTRICT_ACCESS_LIST } from "./constants";
import mongo, {
Account,
createDM,
+ fetchAccountById,
fetchChannels,
fetchMembershipsByUser,
fetchMessages,
@@ -211,6 +212,35 @@ export async function changeAccountEmail(userId: string, email: string) {
)
}
+export async function verifyAccountEmail(userId: string) {
+ if (RESTRICT_ACCESS_LIST.includes(userId)) throw "restricted access";
+ await checkPermission("accounts/update/email", userId);
+
+ const account = await fetchAccountById(userId);
+
+ if (!account) throw new Error("couldn't find account");
+ if (account.verification.status == "Verified") throw new Error("already verified");
+
+ let email = account.email;
+ if (account.verification.status == "Moving") {
+ email = account.verification.new_email;
+ }
+
+ await mongo()
+ .db("revolt")
+ .collection("accounts")
+ .updateOne(
+ { _id: userId },
+ {
+ $set: {
+ email: email,
+ email_normalised: email, // <-- should be fine but someone should fix this in the future
+ verification: { status: "Verified" },
+ }
+ }
+ )
+}
+
export async function suspendUser(userId: string) {
if (RESTRICT_ACCESS_LIST.includes(userId)) throw "restricted access";