Can I Reset isPost() to false?

Discussion in 'PHP Toolkit' started by John Taylor, Nov 6, 2017.

  1. John Taylor

    John Taylor New Member

    We have written an authentication module that intercepts all requests through onBootstrap in morning module.php. That is working fine except in a condition when the requested module goes through authentication and the person is not logged in. After they are authenticated through the login form they are routed to their request but that request thinks the posted already. We need to reset or turn off (false) the isPost() indicator after their successful login. Can we do this?
     
  2. jordiwes

    jordiwes New Member

    Hi John, Perhaps you can tackle your problem a different way.
    When you say "they are routed to their request but that request thinks the posted already", what does that code look like?
     
  3. John Taylor

    John Taylor New Member

    In my Module.php I have modified the onBootstrap function to look for Identity:
    // If we don't have an identity then go to the Authority controller to login
    if (! $auth->hasIdentity()) {
    $response = $e->getResponse();
    $response->getHeaders()
    ->addHeaderLine('Location', $e->getRouter()
    ->assemble(array(), array(
    'name' => 'authority'
    )));
    In the Authority module it presents a form to login from. After a successful login it routes to the saved route requested:
    $dispatch = $this->forward()->dispatch(trim($saveRouteTo['controller']), $saveRouteTo);
    return $dispatch;
    This is where we want the isPost to be false as it goes to the saved route. It is going in as true we believe because the submit button was pressed to login.

    Is this the code you are looking for?
     

Share This Page