Rohan210
Rohan210

Reputation: 885

Problems with Auth in CakePHP

I've been using CakePHP for some time now. But I still fail to solve some issues on my own. Its been difficult to understand how Cake Auth works but in these past few weeks I've managed to work with it.

Now to my issue: I have 2 separate tables(Say for Admin Users and Normal Users). Both have different Controllers (Lets say they are AdminsController and UsersController). Now I have completed Users module without any trouble. Users login and Admin Login are different views. As I dont want any normal User to be able to get their hands on Admin login page I've kept it separate from normal user login.

Users login works fine with Auth. But now I want to use another Auth for AdminController for some reason I am unable to make use the second Auth from AdminController and control automatically transfers to the Users Login

It would be great if someone could point in the correct direction. Please!

Thank You. In advance!!

P.S : I've also tried using Auth->userModel

Upvotes: 0

Views: 230

Answers (1)

Rohan210
Rohan210

Reputation: 885

Sorry everyone I was using Auth->userModel slightly wrong way. I was adding it to my Admin Controller but not in User Controller so if you came here looking for an answer please use

$this->Auth->userModel="User";

in every controller in beforeFilter()

enjoy.......

Upvotes: 1

Related Questions