Ejemplo n.º 1
0
 public function getInvite($token)
 {
     $invite = Invite::getByToken($token);
     if (!$invite) {
         return View::make('pages.guest')->with('failure', "Invalid Token. It was already used or has been terminated by the admins");
     }
     $email = $invite->email;
     if (!$invite->email) {
         $email = "URL";
     }
     //Creating the lease
     $lease = array('user_id' => $invite->user_id, 'group_id' => $invite->group_id, 'lease_ip' => $this->getClientIp() . "/32", 'protocol' => $invite->protocol, 'port_from' => $invite->port_from, 'port_to' => $invite->port_to, 'expiry' => $invite->expiry, 'invite_email' => $email);
     $result = $this->createLease($lease);
     if (!$result) {
         //Lease Creation Failed. AWS Reported an error. Generally in case if a lease with same ip, protocl, port already exists on AWS.
         return View::make('pages.guest')->with('failure', "Error encountered while creating lease. Please try again. If doesn't help contact the admin.");
     }
     $lease = Lease::create($lease);
     if ($invite->email != 'DEPLOY') {
         $invite = $invite->delete();
     }
     $this->NotificationMail($lease, TRUE);
     return View::make('pages.guest')->with('lease', $lease);
 }