'post_reset' => 'postReset',
       ],
   ],
*/
use NinjaWars\core\control\PasswordController;
use NinjaWars\core\data\PasswordResetRequest;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RedirectResponse;
$command = (string) in('command');
$controller = new PasswordController();
$request = Request::createFromGlobals();
switch (true) {
    case $command == 'post_reset':
        $response = $controller->postReset($request);
        break;
    case $command == 'reset':
        $response = $controller->getReset($request);
        break;
    case $command == 'email':
        $response = $controller->postEmail($request);
        break;
    default:
        $command == 'index';
        $response = $controller->index($request);
        break;
}
if ($response instanceof RedirectResponse) {
    $response->send();
} else {
    display_page($response['template'], $response['title'], $response['parts'], $response['options']);
}
 public function testPostEmailCanGetAnAccountUsingANinjaName()
 {
     $req = Request::create('/resetpassword.php');
     $req->setMethod('POST');
     $char = TestAccountCreateAndDestroy::char();
     $ninja_name = $char->name();
     $req->query->set('ninja_name', $ninja_name);
     $account = AccountFactory::findByNinjaName($ninja_name);
     $controller = new PasswordController();
     $controller->postEmail($req);
     // Check for a matching request for the appropriate account.
     $req = PasswordResetRequest::where('_account_id', '=', $account->id())->first();
     $this->assertNotEmpty($req, 'Fail: Unable to find a matching password reset request.');
 }
 public function testPostEmailCanGetAnAccountUsingANinjaName()
 {
     $req = Request::create('/password/post_email/');
     $req->setMethod('POST');
     $char = TestAccountCreateAndDestroy::char();
     $ninja_name = $char->name();
     $req->request->set('ninja_name', $ninja_name);
     RequestWrapper::inject($req);
     $account = Account::findByNinjaName($ninja_name);
     $this->assertNotEmpty($account->id(), 'Unable to find id for newly created account.');
     $controller = new PasswordController();
     $controller->postEmail($this->m_dependencies);
     // Check for a matching request for the appropriate account.
     $pwrr = PasswordResetRequest::where('_account_id', '=', $account->id())->first();
     $this->assertNotEmpty($pwrr, 'Fail: Unable to find a matching password reset request  for account_id: [' . $this->account->id() . '].');
     $this->nonce = $pwrr->nonce;
 }