I am using Symfony 1.4 with Propel as ORM. I Have created a login system for my frontend page, where user can login and edit there account details.The page is set with Permission ="user" and Group ="user". But on loging in with a user which doesnot belong to this group, redirects to the symfonys default page(showing user dont have credentials to view this page). can these pages be customized and set our own custom messages..and how can we set custom error pages??
the code that i have used,
if($this->getContext()->getUser()->hasCredential("user"))
{
$user_name=$this->getUser()->getGuardUser()->getUsername();
$this->name=$user_name;
}
else
{
$this->forward("userlogin", "error");
}
but i dont know this is the best way..
You can change templates by overwriting them in Your app:
apps/<appname>/modules/default/templates/error404Success.php
To see list of possible templates look at:
lib/vendor/symfony/lib/controller/default/templates/
Now about credentials. At file apps/<appname>/config/settings.yml
:
# ...
all:
# ...
.actions:
login_module: sfGuardAuth # Change this to whatewer You want.
login_action: signin # Change this to whatewer You want.
error_404_module: default # Change this to whatewer You want.
error_404_action: error404 # Change this to whatewer You want.
So if You want to change just template -- change just template. But if You want something more powerful -- change settings.yml
and write custom code.