From 0c299d9d25ab3a2c78d8ca1e8fb9bb27b90dcbf5 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Tue, 28 May 2024 11:03:18 +0200 Subject: [PATCH] Plugin: Azure AD: Diversify exception to be more explicit regarding empty fields in Azure profile - refs BT#21739 --- plugin/azure_active_directory/src/callback.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugin/azure_active_directory/src/callback.php b/plugin/azure_active_directory/src/callback.php index 8d450d80f1..a0dea33f09 100644 --- a/plugin/azure_active_directory/src/callback.php +++ b/plugin/azure_active_directory/src/callback.php @@ -64,8 +64,11 @@ try { // We use the e-mail to authenticate the user, so check that at least one // e-mail source exists - if (empty($me['mail']) || empty($me['mailNickname'])) { - throw new Exception('Mail empty'); + if (empty($me['mail'])) { + throw new Exception('The mail field is empty in Azure AD and is needed to set the organisation email for this user.'); + } + if (empty($me['mailNickname'])) { + throw new Exception('The mailNickname field is empty in Azure AD and is needed to set the unique Azure ID for this user.'); } $extraFieldValue = new ExtraFieldValue('user');