Fix resending emials

Change-Id: I54a41e2732aee02d704b7e2c9afc34d5d93ae9ed
diff --git a/User.php b/User.php
index 5fb7307..b16fd6e 100644
--- a/User.php
+++ b/User.php
@@ -67,16 +67,6 @@
         if (!empty($data["password"])) $this->set_password($data["password"]);
     }
 
-    function __construct6(string $username, string $first_name, string $last_name, string $email, string $password, string $organization)
-    {
-        include 'config.php';
-        $this->username = $username;
-        $this->first_name = $first_name;
-        $this->last_name = $last_name;
-        $this->email = $email;
-        $this->organization = $organization;
-        $this->set_password($password);
-    }
 
     function set_password(string $password)
     {
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;
 
diff --git a/templates/resend_mail.htm b/templates/resend_mail.htm
index 4bbcf80..e69de29 100644
--- a/templates/resend_mail.htm
+++ b/templates/resend_mail.htm
@@ -1,3 +0,0 @@
-<div class="alert alert-info" role="alert">
-    Another email has been sent to <?php echo $_SESSION['email']; ?>!
-</div>