feat: user export service. bug and UX fixes. Complete minus outstanding email template fixes.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user