2009年4月15日星期三

Re: [fw-auth] blocking users

If you are using a database, and thus using the
Zend_Auth_Adapter_DbTable, here is one way to handle this:

In your users table, add a column called failed_auth_attempts as an integer.

As Hector points out, setup the adapter to check that the value in this
column is not larger than 3 as part of the credential treatment.

http://framework.zend.com/manual/en/zend.auth.adapter.dbtable.html#zend.auth.adapter.dbtable.advanced.advanced_usage

(BTW, as of 1.8 you will be able to get the select object from this
adapter).

Then, if there is an unsuccessful login, check the code for the
authentication attempt getCode(). If the code is
Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, I would then use the
credential as the key for the row to update.. and update the
failed_auth_attempts = its value + 1.

On a successful login, be sure to set the failed_auth_attempts back to 0.

Hope this helps.

-ralph

Doood wrote:
> hi,
> I want to know how to block an account after logining in for more than 3
> times using the zend framework.
>
> thanks in advance

没有评论: