I will post the code from diferent file... In both cases user is logged and $this->session->get('auth') returns an array.
Situation 1.
$router->add('/resetpassword', array(
"controller" => "user",
"action" => "resetpassword",
));
public function resetpasswordAction()
{
/* redirect to profile if user is logged */
if ($this->session->get('auth')) {
$this->response->redirect('profile');
}
}
Volt file:
<form role="form" method="POST" action="/reset" id="registration-form">
<div class="form-group col-xs-12 col-md-4">
<label for="email" class="highlighted-text">Email address</label>
{{ form.render("email") }}
</div>
<div class="form-group col-xs-12 col-md-4 form-button-wrap">
<button type="submit" value="Submit" class="btn btn-primary">Reset Password</button>
</div>
</form>
In the log file :
[Thu Dec 18 20:24:22 2014] [error] [client 127.0.0.1] PHP Notice: Undefined variable: form in /Users/IGonza/git/xxx/app/cache/_users_igonza_git_xxx_app_views_user_reset.volt.php on line 8
[Thu Dec 18 20:24:22 2014] [error] [client 127.0.0.1] PHP Fatal error: Call to a member function render() on a non-object in /Users/IGonza/git/xxx/app/cache/_users_igonza_git_xxx_app_views_user_reset.volt.php on line 8
And page is redirected to /profile.
Situation 2.
$router->add('/reset', array(
"controller" => "user",
"action" => "reset",
));
public function resetAction()
{
/* redirect to profile if user is logged */
if ($this->session->get('auth')) {
$this->response->redirect('profile');
}
}
Volt file is the same, everything else is the same except I changed 'resetpassword' to 'reset'.
The same error messages are on the screen and page is not redirected.
So I have 2 questions:
-
Why is there that inconsistence? 'reset' is reserved word?
- Is there any difference between return true and return false after redirect functon?