Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disallowing login for "inactive" users in Symfony2

Tags:

symfony

I set up my app's authentication system based on the Symfony2 security documentation.

Each one of my users has an active flag. I don't want users whose active = false to be able to log in.

I don't really understand where the logic is that says whether or not a user is allowed to log in, so I'm somewhat at a loss as to how to accomplish this. Can someone please steer me in the right direction?

like image 476
Jason Swett Avatar asked Apr 02 '12 20:04

Jason Swett


1 Answers

Make your User class implement AdvancedUserInterface — it has the isEnabled() method specifically for that purpose.

like image 95
Elnur Abdurrakhimov Avatar answered Nov 02 '22 07:11

Elnur Abdurrakhimov