May 27, 2008 - DotNetNuke    Comments Off on DotNetNuke Password Reset via SQL (Option 1)

DotNetNuke Password Reset via SQL (Option 1)

If your DotNetNuke passwords all of a sudden stop working (like due to a failed upgrade), have no fear, you can reset them at the database! This is not a hack, it uses the official aspnet Password Reset.

Open [b:2ei3quwf]SQL Query Analyzer [/b:2ei3quwf]- Connect to your dotNetNuke database.

Paste the following Stored Procedure code into the window, this will create a stored procedure for later use called [b:2ei3quwf]uap_ResetPassword[/b:2ei3quwf]. This should survive DNN upgrades because we are predicating the stored procedure name with uap_

[code:2ei3quwf]
create procedure uap_ResetPassword
@UserName NVarChar(255),
@NewPassword NVarChar(255)
as
begin
Declare @PasswordSalt NVarChar(128)
Declare @Application NVarChar(255)

Set @Application = (SELECT [ApplicationID] FROM aspnet_Users WHERE UserName=@UserName)
Set @PasswordSalt = (SELECT PasswordSalt FROM aspnet_Membership WHERE UserID IN (SELECT UserID FROM aspnet_Users WHERE UserName=@UserName))

Exec dbo.aspnet_Membership_ResetPassword @Application, @UserName, @NewPassword, 10, 10, @PasswordSalt, -5
end[/code:2ei3quwf]

Now you can reset your DotNetNuke passwords by simply opening up SQL Query Analyzer, connecting to your dotNetNuke database, then typing [color=#339966:2ei3quwf]uap_ResetPassword ‘username’, ‘newpassword’[/color:2ei3quwf]