mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix: report email as not sent to fe if it throws (#844)
This commit is contained in:
		
							parent
							
								
									c9f67cc209
								
							
						
					
					
						commit
						52d3e9eb77
					
				@ -137,13 +137,22 @@ export default class UserAdminController extends Controller {
 | 
			
		||||
                user.email,
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
            let emailSent = false;
 | 
			
		||||
            const emailConfigured = this.emailService.configured();
 | 
			
		||||
            if (emailConfigured) {
 | 
			
		||||
                try {
 | 
			
		||||
                    await this.emailService.sendGettingStartedMail(
 | 
			
		||||
                        createdUser.name,
 | 
			
		||||
                        createdUser.email,
 | 
			
		||||
                        inviteLink.toString(),
 | 
			
		||||
                    );
 | 
			
		||||
                    emailSent = true;
 | 
			
		||||
                } catch (e) {
 | 
			
		||||
                    this.logger.warn(
 | 
			
		||||
                        'email was configured, but sending failed due to: ',
 | 
			
		||||
                        e,
 | 
			
		||||
                    );
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
                this.logger.warn(
 | 
			
		||||
                    'email was not sent to the user because email configuration is lacking',
 | 
			
		||||
@ -153,7 +162,7 @@ export default class UserAdminController extends Controller {
 | 
			
		||||
            res.status(201).send({
 | 
			
		||||
                ...createdUser,
 | 
			
		||||
                inviteLink,
 | 
			
		||||
                emailSent: emailConfigured,
 | 
			
		||||
                emailSent,
 | 
			
		||||
                rootRole,
 | 
			
		||||
            });
 | 
			
		||||
        } catch (e) {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user