开发者

MVC authentication - it's own model?

I have a social network-esque site with a nice User model that seems to be covering all my bases right now.

I am reworking the code from spaghetti and want to find the best-practice solution for logging in / registering a user. Here are my options (I think):

  1. Create a separate Auth class (model?) that simply searches for a record of a user and returns a new User object if found.

  2. Add "login" functionality to the User class that will allow me to log my user in as any User object that I'd like.

  3. 开发者_如何转开发

Please let me know the cleanest way to go about this, as I am new to good coding practices (admittedly)


Just do it separately in such a manner that you can extend the class later to do stuff like FB, OAuth, OpenID login, etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜