0
votes

Auth Flash params are not working for me.

AppController: class AppController extends Controller {

public $helpers = array(
    'Session', 
    'Facebook.Facebook', 
    'Html' => array('className' => 'BoostCake.BoostCakeHtml'), 
    'Form' => array('className' => 'BoostCake.BoostCakeForm'),
    'Paginator' => array('className' => 'BoostCake.BoostCakePaginator'), 
    'AssetCompress.AssetCompress',
    'PhpThumb.PhpThumb' 
);
public $components = array(
    'Session',
    'RequestHandler',
    'Auth' => array(
        'authenticate' => array('Custom'),
        'loginRedirect' => array('controller' => 'users', 'action' => 'index'),
        'logoutRedirect' => array('controller' => 'pages', 'action' => 'index'),
        'flash' => array(
            'element' => 'alert',
            'key' => 'auth',
            'params' => array(
                'plugin' => 'BoostCake',
                'class' => 'alert-danger'
            )
        )
    ),
);

Default layout: Session->flash(); echo $this->Session->flash('auth');

echo $this->fetch('content');
?>

I've debugged the params to make sure they're outputting correctly, but when the alert pops up this is what I see:

<div id="authMessage" class="message">Username or password is incorrect</div>

Thanks in advance

1

1 Answers

0
votes

You need to create a ctp with the name alert.ctp in your view as follows:

<div id="authMessage" class="message">
    <?php 
         echo $plugin;
         echo $class;
    ?>
    Username or password is incorrect
</div>

Have a look at this CakePHP custom flash for loginError