Exemplo n.º 1
0
 function VerifyUser($email, $verifiedCode)
 {
     $agentModel = new AgentModel();
     if ($agentModel->IsFound($email, AgentModel::BOTH)) {
         if (!$agentModel->IsActive($email, AgentModel::BOTH)) {
             // check if the code provided is validated
             if ($agentModel->IsVerificationCodeExist($email, $verifiedCode, AgentModel::BOTH)) {
                 $agentModel->SetActive($email, 1, AgentModel::BOTH);
             } else {
                 Session::set("warning", "Verification code is invalid");
                 return $this->View($agentModel->GetAccountEmail($email), "Agent", "Confirmation");
             }
         }
         return $this->ReDirectTo("Agent", "LoginForm");
     } else {
         Session::set("warning", "The email [{$email}] address provided does not exists you can registered it if you wants");
         return $this->View($email, "Agent", "Confirmation");
     }
 }