开发者

Authentication in CakePHP

how can i use myown login function to authenticate users in cakePHP

because my users table structure is different from the cakePHP structure.

even i overridden the login fu开发者_如何学Gonction it still executing the login function in parent class


When using models that don't reflect CakePHP's conventions, there are a few things you can configure to get things working.

When you create your User model (or whatever you have called it), you can specify which database the table is in, what the name of the table is, if the table has a prefix, what the primary key field is called (usually id), and what the display field is (usually name or title).

When setting up AuthComponent, you can also specify what model to use (usually User) and what the username and password fields are called.

A combination of the above configuration options should usually be enough to get CakePHP understanding how to your table schema is set up.

However, in some cases this isn't enough, so you can override or extends parts of the core AuthComponent to get it working the way you want (usually just the identify method is needed, as you pointed out). A few example scenarios would be LDAP authentication, trying to authenticate over multiple User tables, and trying to authenticate where there are joined User and Email tables.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜