CLI changes: - Use official oRPC client instead of manual HTTP requests - Add admin complete-login command for dev workflow - Remove type assertions, use proper ContractRouterClient typing - Add @orpc/client and @orpc/contract dependencies API changes: - Use oRPC cookie helpers from @orpc/server/helpers - Improve admin complete-login error messages (expired, already completed) Dashboard changes: - Add AuthGuard component to redirect unauthenticated users to /auth/login - Update confirm page with correct CLI command and copy button - Remove duplicate auth redirect from dashboard layout Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
47 lines
1.1 KiB
TypeScript
47 lines
1.1 KiB
TypeScript
import type { LocalContext } from "../../context.js";
|
|
import { buildCommand } from "@stricli/core";
|
|
import { createApiClient } from "../../utils/api-client.js";
|
|
|
|
interface ConfirmEmailFlags {
|
|
email: string;
|
|
}
|
|
|
|
async function confirmEmail(
|
|
this: LocalContext,
|
|
flags: ConfirmEmailFlags,
|
|
): Promise<void> {
|
|
try {
|
|
const api = await createApiClient();
|
|
|
|
await api.admin.users.confirmEmail({
|
|
email: flags.email,
|
|
});
|
|
|
|
console.log(`Confirmed email for: ${flags.email}`);
|
|
} catch (error) {
|
|
console.error(
|
|
"Error:",
|
|
error instanceof Error ? error.message : String(error),
|
|
);
|
|
this.process.exit(1);
|
|
}
|
|
}
|
|
|
|
export const confirmEmailCommand = buildCommand({
|
|
func: confirmEmail,
|
|
parameters: {
|
|
flags: {
|
|
email: {
|
|
kind: "parsed",
|
|
parse: String,
|
|
brief: "Email address to confirm",
|
|
},
|
|
},
|
|
},
|
|
docs: {
|
|
brief: "Confirm user email",
|
|
fullDescription:
|
|
"Confirms a user's email address via the admin API. This is useful for development when email sending is not configured.",
|
|
},
|
|
});
|