开发者

Trigger or Stored for lock and unlock database for 15 minute

Dear Sir, I create a login form in which if you insert password 3 times wrong then u r account is locked for next 15 minute. and we send a random password on referenced emailid which is sent after开发者_JAVA技巧 15 minute. For these 15 minute the account isactive='false'.

So can u please help me to give code for a stored procedure or triggers which is fired after 15 minute,which update this account isactive = 'true'.

Please help me.

Thanks In Advance


You wouldn't use a trigger for this. It might be possible to do something with service broker (I'm not sure).

The simplest way of doing it would be to just have a non nullable LockedOutUntil smalldatetime column in the Users table (defaulting to a date in the past) and have your code check that

isactive='true' or LockedOutUntil<getdate()

This would consume 4 bytes per row for all users though and presumably at any one time very few will be locked out so a more space efficient way would be to create a new table containing lockout details. Either your code would need to check this table to determine if the user is locked out or you could deactivate the user up front and have a SQL Server Agent job scheduled to run every minute to reactivate users whose lockout period had expired. The job could also delete these from the lockout table unless you wanted to maintain a history of these events.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜