Beispiel #1
0
 public function CommitUserToDatabase($Email, $Password, $WelcomeHash)
 {
     $this->Connect();
     $InUse = null;
     $HashedPassword = Hash::GenerateHash($Password);
     if ($Statement = $this->MySQLi->prepare("INSERT INTO users (user_email, password_sha256_hash, welcome_hash) VALUES (?,?,?)")) {
         $Time = time();
         $Statement->bind_param("sss", $Email, $HashedPassword, $WelcomeHash);
         $Statement->execute();
         $Rows = $this->MySQLi->affected_rows;
         if ($Rows == 1) {
             //UserManagement::CreateSession($Email);
         }
         $Statement->close();
     }
     $this->Disconnect();
     return $Rows == 1 ? true : false;
 }
Beispiel #2
0
            return;
        }
        $DB = new Database();
        $RecoveryHash = $DB->StoreRecoveryHash($EmailAddress);
        $EmailObject = new Email();
        $EmailObject->SendRecoveryEmail($EmailAddress, $RecoveryHash);
        print JSONResponse::PrepareResponse(true, "Sent", null);
        break;
    case 'updatepassword':
        if (isset($_REQUEST['e']) && isset($_REQUEST['p']) && isset($_REQUEST['h'])) {
            $EmailAddress = $_REQUEST['e'];
            $NewPassword = $_REQUEST['p'];
            $Hash = $_REQUEST['h'];
        } else {
            return;
        }
        $NewHash = Hash::GenerateHash($NewPassword);
        $DB = new Database();
        $DB->UpdateRecoveryPassword($EmailAddress, $Hash, $NewHash);
        break;
    case 'resetportfolio':
        $DB = new Database();
        UserManagement::InitSession();
        $DB->ResetPortfolio($_SESSION['User']->user_id);
        print JSONResponse::PrepareResponse(true, "Sent", null);
        break;
    case 'testmessage':
        $EmailObject = new Email();
        $EmailObject->SendWelcomeEmail("*****@*****.**", "test");
        break;
}