Fix resending emials
Change-Id: I54a41e2732aee02d704b7e2c9afc34d5d93ae9ed
diff --git a/index.php b/index.php
index d2ae3a1..d4310c8 100755
--- a/index.php
+++ b/index.php
@@ -149,7 +149,7 @@
function approve_request(User $user)
{
include 'config.php';
- global $log;
+ global $log, $_SESSION;
$token = generateRandomString();
redis_set($token, $user, $MAIL_CONFIRMATION_AWAIT_DELAY);
@@ -325,8 +325,10 @@
break;
case "resend":
if (isset($_GET['token']) && isset($_SESSION['resend']) && $_GET['token'] == $_SESSION['resend']) {
- include $TEMPLATE . "resend_mail.htm";
- $user = new User($_SESSION["username"], $_SESSION["first_name"], $_SESSION["last_name"], $_SESSION["email"], "", $_SESSION["organization"]);
+ $log->info("Resending confirmation email to " . $_SESSION['email']);
+ $user = new User();
+ $user->init_from_array($_SESSION);
+ $log->info("Resending confirmation email to " . $user->to_string());
$token = $_SESSION['token'];
$url = $BASE_URL . "?type=confirmation&token=" . $token;
$smtp = $FALLBACK_SMTP;
@@ -337,11 +339,12 @@
unset($_SESSION['recover']);
} else
send_confirmation_email($address, $smtp, $url, $user);
+ echo "<div class='alert alert-info' role='alert'> Another email has been sent to ". $_SESSION['email']. " </div>";
unset($_SESSION['resend']);
unset($_SESSION['token']);
# unset($_SESSION['email']);
} else {
- echo "<h2>A second email has already been sent to " . $_SESSION['email'] .".</h2>";
+ echo "<div class='alert alert-warning' role='alert'>A second email has already been sent.</div>";
}
break;