コード例 #1
0
ファイル: AccountTest.php プロジェクト: JernejKorosec/z2d2
 public function testCanSaveAndRetrieveUser()
 {
     $account = new \Entities\Account();
     $account->setUsername('wjgilmore-test');
     $account->setEmail('*****@*****.**');
     $account->setPassword('jason');
     $account->setZip('43201');
     $this->em->persist($account);
     $this->em->flush();
     $account = $this->em->getRepository('Entities\\Account')->findOneByUsername('wjgilmore-test');
     $this->assertEquals('wjgilmore-test', $account->getUsername());
 }
コード例 #2
0
ファイル: Register.php プロジェクト: KristofMols/Chrysellia
<?php

namespace Functions\Account;

/**
 * This file contains the Register function logic for Accounts
 */
$Get = null;
if (property_exists($ARequest, 'Data')) {
    $Get = $ARequest->Data;
} else {
    $Get = new \stdClass();
}
if (property_exists($Get, 'UserName') && property_exists($Get, 'Password') && property_exists($Get, 'Email')) {
    $AnAccount = new \Entities\Account();
    $AnAccount->Fill($Get);
    if ($AnAccount->Verify()) {
        if ($Database->Accounts->Insert($AnAccount)) {
            $Response->Set('Result', \Protocol\Response::ER_SUCCESS);
        } else {
            $Response->Set('Result', \Protocol\Response::ER_ALREADYEXISTS);
        }
    } else {
        $Response->Set('Result', \Protocol\Response::ER_BADDATA);
    }
} else {
    $Response->Set('Result', \Protocol\Response::ER_MALFORMED);
}
コード例 #3
0
ファイル: Login.php プロジェクト: KristofMols/Chrysellia
<?php

namespace Functions\Account;

/**
 * This file contains the Login function logic for Accounts
 */
$Get = null;
if (property_exists($ARequest, 'Data')) {
    $Get = $ARequest->Data;
} else {
    $Get = new \stdClass();
}
if (property_exists($Get, 'UserName') && property_exists($Get, 'Password')) {
    $AnAccount = new \Entities\Account();
    $AnAccount->Fill($Get);
    if ($AnAccount->Verify()) {
        if ($Database->Accounts->Login($AnAccount)) {
            $Database->Accounts->Kick($AnAccount);
            $Response->Set('Result', \Protocol\Response::ER_SUCCESS);
            $_SESSION['AccountId'] = $AnAccount->AccountId;
        }
    } else {
        $Response->Set('Result', \Protocol\Response::ER_BADDATA);
    }
} else {
    $Response->Set('Result', \Protocol\Response::ER_MALFORMED);
}