Managing User Authentication

Hi,

I wrote a bit of code to manage users, and authentication. I had two classes, Auth (managed user login, registration, forgotten password, check if logged) and User (of which an object was instantiated when the user was logged ($auth->logged())).

I got a bit stuck on part of my code, and asked in an IRC channel for some advice, but was told this method would become hard to manage, my error management wasn’t the best etc.

Could anyone help me with the basic set up of my application? I’ve looked into the error management and noticed someone doing:
throw new Exception(self::CONSTANT)

Is the User class and Auth class a bad way to go about it?

Thanks,
Ryan

Don’t reinvent the wheel. Use a proven system like Zend Auth, so you can concentrate on making you site do what it does best.