Symfony-check

Check if your symfony application is ready for deployment

"Credentials Required" error page
  • design

When a user doesn't have the credentials required for an action, symfony tries to access to the default/secure action.

Credentials Required

To customize the "Credentials Required" page, add the executeLogin() method in the apps/frontend/modules/default/actions/actions.class.php file:

/**
 * Warning page for restricted area - requires login
 *
 */
public function executeSecure()
{
}

Then create the apps/frontend/modules/default/templates/secureSuccess.php template.

If you want, you can grab the original file and modify it.

Display the "Credentials Required" page to test it

  1. Pass in the production environement
  2. Login, but not as super admin.
  3. In one of your modules, add in apps/frontend/modules/yourModule/config/security.yml:

    all:
      credentials: [ aCredentialYouDontHave ]
    
  4. Clear cache
  5. Try to access to one of the module actions

Using an other module

If you want to use an other module, modify apps/frontend/config/settings.yml:

all:
  .actions:
    secure_module: foo   # To be called when a user doesn't have
    secure_action: bar   # The credentials required for an action

Clear your cache.

php symfony cc