feat(admin): add resend verification email op

This commit is contained in:
Hampus Kraft
2026-02-18 19:04:25 +00:00
parent 2be274e762
commit 08eaad6f76
5 changed files with 78 additions and 0 deletions

View File

@@ -46,6 +46,7 @@ import {
ListWebAuthnCredentialsRequest,
LookupUserRequest,
LookupUserResponse,
ResendVerificationEmailRequest,
ScheduleAccountDeletionRequest,
SendPasswordResetRequest,
SetUserAclsRequest,
@@ -312,6 +313,30 @@ export function UserAdminController(app: HonoApp) {
},
);
app.post(
'/admin/users/resend-verification-email',
RateLimitMiddleware(RateLimitConfigs.ADMIN_USER_MODIFY),
requireAdminACL(AdminACLs.USER_UPDATE_EMAIL),
Validator('json', ResendVerificationEmailRequest),
OpenAPI({
operationId: 'admin_resend_verification_email',
summary: 'Resend verification email',
responseSchema: null,
statusCode: 204,
security: 'adminApiKey',
tags: 'Admin',
description:
'Resend the account verification email for a user. Creates audit log entry and honours email verification resend limits. Requires USER_UPDATE_EMAIL permission.',
}),
async (ctx) => {
const adminService = ctx.get('adminService');
const adminUserId = ctx.get('adminUserId');
const auditLogReason = ctx.get('auditLogReason');
await adminService.resendVerificationEmail(ctx.req.valid('json'), adminUserId, auditLogReason);
return ctx.body(null, 204);
},
);
app.post(
'/admin/users/send-password-reset',
RateLimitMiddleware(RateLimitConfigs.ADMIN_USER_MODIFY),