mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge pull request #931 from Nirothipan/master
Fixes for [MDM-367] Proper "Error" message is not given when trying to invite a user without having the email transport properly configured. #504
This commit is contained in:
commit
749f1ccdcf
@ -562,7 +562,12 @@ public class UserManagementServiceImpl implements UserManagementService {
|
||||
}
|
||||
} catch (DeviceManagementException e) {
|
||||
String msg = "Error occurred while inviting user to enrol their device";
|
||||
if (e.getMessage() != null && !e.getMessage().isEmpty()) {
|
||||
msg = e.getMessage();
|
||||
}
|
||||
log.error(msg, e);
|
||||
return Response.serverError().entity(
|
||||
new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build();
|
||||
} catch (UserStoreException e) {
|
||||
String msg = "Error occurred while getting claim values to invite user";
|
||||
log.error(msg, e);
|
||||
|
||||
@ -837,7 +837,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
||||
metaInfo.getRecipients()).build();
|
||||
DeviceManagementDataHolder.getInstance().getEmailSenderService().sendEmail(ctx);
|
||||
} catch (EmailSendingFailedException e) {
|
||||
String msg = "Error occurred while sending user registration notification";
|
||||
String msg = "Error occurred while sending user registration notification." + e.getMessage();
|
||||
log.error(msg, e);
|
||||
throw new DeviceManagementException(msg, e);
|
||||
} catch (Exception e) {
|
||||
|
||||
@ -89,10 +89,11 @@ $("a#invite-user-link").click(function () {
|
||||
modalDialog.hide();
|
||||
});
|
||||
},
|
||||
function () {
|
||||
function (data) {
|
||||
var msg = JSON.parse(data.responseText);
|
||||
modalDialog.header('<span class="fw-stack"> <i class="fw fw-circle-outline fw-stack-2x"></i> <i class="fw ' +
|
||||
'fw-error fw-stack-1x"></i> </span> Unexpected Error !');
|
||||
modalDialog.content('An unexpected error occurred. Try again later.');
|
||||
modalDialog.content(msg.message);
|
||||
modalDialog.footer('<div class="buttons"><a href="#" id="invite-user-error-link" ' +
|
||||
'class="btn-operations">Ok </a></div>');
|
||||
$("a#invite-user-error-link").click(function () {
|
||||
|
||||
@ -65,8 +65,13 @@ public class EmailSenderServiceImpl implements EmailSenderService {
|
||||
for (String recipient : emailCtx.getRecipients()) {
|
||||
ContentProviderInfo info = emailCtx.getContentProviderInfo();
|
||||
EmailData emailData;
|
||||
String transportSenderName = "mailto";
|
||||
try {
|
||||
emailData = contentProvider.getContent(info.getTemplate(), info.getParams());
|
||||
if(EmailSenderDataHolder.getInstance().getConfigurationContextService()
|
||||
.getServerConfigContext().getAxisConfiguration().getTransportOut(transportSenderName) == null){
|
||||
throw new EmailSendingFailedException("Email transport is not configured.");
|
||||
}
|
||||
} catch (ContentProcessingInterruptedException e) {
|
||||
throw new EmailSendingFailedException("Error occurred while retrieving email content to be " +
|
||||
"sent for recipient '" + recipient + "'", e);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user