feat: user export service. bug and UX fixes. Complete minus outstanding email template fixes.

This commit is contained in:
Eric Gullickson
2025-12-26 14:06:03 -06:00
parent 8c13dc0a55
commit fb52ce398b
35 changed files with 1686 additions and 118 deletions

View File

@@ -151,6 +151,40 @@ class Auth0ManagementClientSingleton {
}
}
/**
* Send password reset email to user
* Uses Auth0 Authentication API (not Management API)
* @param email User's email address
*/
async sendPasswordResetEmail(email: string): Promise<void> {
try {
const config = appConfig.getAuth0ManagementConfig();
const response = await fetch(`https://${config.domain}/dbconnections/change_password`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
client_id: config.clientId,
email,
connection: this.CONNECTION_NAME,
}),
});
if (!response.ok) {
const errorBody = await response.text();
logger.error('Password reset email request failed', { email: email.substring(0, 3) + '***', status: response.status, error: errorBody });
throw new Error(`Password reset email failed: ${response.status}`);
}
logger.info('Password reset email sent', { email: email.substring(0, 3) + '***' });
} catch (error) {
logger.error('Failed to send password reset email', { email: email.substring(0, 3) + '***', error });
throw new Error(`Failed to send password reset email: ${error instanceof Error ? error.message : 'Unknown error'}`);
}
}
/**
* Verify user password using Resource Owner Password Grant
* @param email User's email address