From 72bb6cc45a10e62f25fcea5a8e31f1ce449027be Mon Sep 17 00:00:00 2001
From: Guillaume Rousse <guillaume.rousse@renater.fr>
Date: Tue, 7 Nov 2017 16:01:20 +0100
Subject: [PATCH] abort in case of notification error

---
 lib/IdPAccountManager/WebRequest.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/IdPAccountManager/WebRequest.pm b/lib/IdPAccountManager/WebRequest.pm
index 72972c3..10c2dff 100755
--- a/lib/IdPAccountManager/WebRequest.pm
+++ b/lib/IdPAccountManager/WebRequest.pm
@@ -415,7 +415,11 @@ sub req_generate_token {
             }
         );
     };
-    $self->{logger}->errorf("Error TT2 : %s", $EVAL_ERROR) if $EVAL_ERROR;
+    if ($EVAL_ERROR) {
+        push @{ $self->{out}->{errors} }, "mail_notification_error";
+        $self->{logger}->errorf("Mail notification error: %s", $EVAL_ERROR);
+        return undef;
+    }
 
     $self->{logger}->infof(
         "Token send to %s for sp_entityid=%s;token=%s",
-- 
GitLab