Skip to content

Commit 881cbed

Browse files
authored
Update AuthenticationController.php
1 parent 6aa398c commit 881cbed

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/GraphJS/Controllers/AuthenticationController.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,14 +411,19 @@ public function reset(Request $request, Response $response, Kernel $kernel)
411411
else{
412412
file_put_contents(getenv("PASSWORD_REMINDER").md5($data["email"]), "{$pin}:".time()."\n", LOCK_EX);
413413
}
414-
$mgClient = new Mailgun(getenv("MAILGUN_KEY"));
414+
try {
415+
$mgClient = new Mailgun(getenv("MAILGUN_API_KEY"));
415416
$mgClient->sendMessage(getenv("MAILGUN_DOMAIN"),
416417
array('from' => 'GraphJS <postmaster@client.graphjs.com>',
417418
'to' => $data["email"],
418419
'subject' => 'Password Reminder',
419420
'text' => 'You may enter this 6 digit passcode: '.$pin)
420421
);
421422
$this->succeed($response);
423+
}
424+
catch(\Exception $e) {
425+
$this->fail($response, "There was a problem sending email.");
426+
}
422427
}
423428

424429
protected function isRedisPasswordReminder(): bool

0 commit comments

Comments
 (0)