Intranoggin

Blither, Blather, Web Content Management.
Blog » AspNetProvider Database User Unlock

AspNetProvider Database User Unlock

I added a feature to my asp.net membership provider that automatically unlocks user accounts after a given amount of time.

I just created a stored procedure that unlocks the accounts and a job that runs the procedure every 10 minutes.

USE [AspNetProvider]

GO

/****** Object: StoredProcedure [dbo].[aspnet_UnlockAccounts] Script Date: 04/16/2008 21:34:26 ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

-- =============================================

-- Author:    Ryan Miller

-- Create date: 4/16/2008

-- Description: Unlocks asp.net membership accounts that were locked out more than timeoutminutes minutes ago.

-- =============================================

ALTER PROCEDURE [dbo].[aspnet_UnlockAccounts] (

@TimeOutMinutes int)

AS

BEGIN

Update dbo.aspnet_Membership

Set IsLockedOut = 0

WHERE (IsLockedOut = 1) and (LastLockoutDate < (GETDATE() - (@TimeOutMinutes/1440.0)))

END


Posted: 4/16/2008 8:15:00 AM by Ryan Miller | with 0 comments
Filed under: SharePoint