How to deal with Ajax Auth errors in CakePHP

I'm using the Auth component on my pages and I would like to show a login overlay when an Ajax action is called for which the user doesn't have permission.


User wants to edit a jeditable field, then when the users wants to change the value, he will first get a login/register overlay.

My current way is to check in the action for $_SESSION['Auth']['User'], however this seems to be very dirty and I want to do it in a clean way.

Currently my code is:


$this->layout = 'ajax';


I would love the input of more experienced users, I'm using Jquery as my javascript library. Thanks in advance!