Exemplo n.º 1
0
 function Login($email, $password, $option = null)
 {
     $email = $email == "null" ? null : $email;
     $password = $password == "null" ? null : $password;
     $agentModel = new AgentModel();
     if ($agentModel->IsLogin($email, $password)) {
         $agent = new Agent();
         // The user has successfully login
         if ($agentModel->IsActive($email)) {
             if (!$agentModel->IsSuspended($email)) {
                 Session::set("db_username", "{$email}");
                 $agent->email = $email;
                 $agent->password = $email;
                 return $this->ReDirectTo("Account", "Index");
             } else {
                 Session::set("Warning", "This account as be fully suspected please contact administrator");
                 return $this->ReDirectTo("Agent", "LoginForm");
             }
         } else {
             Session::set("Warning", "Your email account [{$email}] is not yet verified.");
             return $this->ReDirectTo("Agent", "Confirmation");
         }
     } else {
         ContextManager::ValidationFor("warning", "Invalid username or password\n");
     }
     return $this->View(null, "Agent", "Login");
 }