How to Enable CAPTCHA Manually in DNN

Overview

In newer versions of DNN CMS, there is a CAPTCHA setting that is currently hidden. This setting has been in place for many years, but recent releases have omitted it from the persona bar, because it's not the best feature to use in DNN. It really needs some updates. Anyhow, this article will tell you how to enable this setting if you wish to do so.

Requirements

The following prerequisites will be necessary to accomplish the goals of this article:

  • Have a basic understanding of how to use DNN as an administrator.
  • Have superuser access to your DNN website.
  • Be comfortable with and/or know how to write T-SQL.

Getting Started

There are no prerequisites to beginning with this task.

Manually Turn ON Login CAPTCHA in DNN

The CAPTCHA you'll find in the default DNN login is not something you'll be bragging about. It mostly works, but is easily bypassed by anyone that is technical enough to know how to look for and follow instructions on how to get around it. If this is important to you, I'd suggest using a third-party authentication provider.

By default, your login form will look something like this to everyone.

dnn-captcha-enabling-01.jpg

The frst thing is always first... Navigate to your DNN website, and log in as a superuser. If you're not logged in as a superuser, you will not be able to perform any of the tasks below.

Now that you're logged in, use the persona bar to navigate to the Settings menu, and then select SQL Console.

dnn-captcha-enabling-03.jpg

You'll want to enable the CAPTCHA setting, but you may not have the setting in the database at all yet. So, you'll want to run the following T-SQL query to add the setting if it's missing, or update it if it's not missing.

DECLARE @PortalID INT; 
SET @PortalID = 0; /* update this if you have more than one site */ 

IF EXISTS (SELECT * FROM {databaseOwner}[{objectQualifier}PortalSettings] WHERE [SettingName] = N'DNN_UseCaptcha' AND [PortalId] = @PortalID) 
BEGIN 
	UPDATE {databaseOwner}[{objectQualifier}PortalSettings] 
	SET [SettingValue] = N'True', 
		[LastModifiedByUserID] = -1, 
		[LastModifiedOnDate] = GETDATE() 
	WHERE [SettingName] = N'DNN_UseCaptcha' AND [PortalId] = @PortalID; 
END
ELSE
BEGIN 
	INSERT INTO {databaseOwner}[{objectQualifier}PortalSettings] ([PortalID],[SettingName],[SettingValue],[CreatedByUserID],[CreatedOnDate],[LastModifiedByUserID],[LastModifiedOnDate],[IsSecure]) 
	VALUES (@PortalID, N'DNN_UseCaptcha', N'True', -1, GETDATE(), -1, GETDATE(), 0); 
END

Next, you'll need to clear the data cache before you or anyone else will see this setting take effect.

Go back to the persona bar, and select Servers this time.

dnn-captcha-enabling-04.jpg

Simply click on the Clear Cache button.

dnn-captcha-enabling-05.jpg

Now, the next time the login reloads, it will look like the example below.

dnn-captcha-enabling-02.jpg

Manually Turn OFF Login CAPTCHA in DNN

At some point, you may want to turn this setting off. If this ever comes to be the case, you can run the following T-SQL command the same way as the one above. Once you do this, clear the cache again, also using the same steps outlined above.

DECLARE @PortalID INT; 
SET @PortalID = 0; /* update this if you have more than one site */ 

IF EXISTS (SELECT * FROM [dbo].[PortalSettings] WHERE [SettingName] = N'DNN_UseCaptcha' AND [PortalId] = @PortalID) 
BEGIN 
	UPDATE [dbo].[PortalSettings] 
	SET [SettingValue] = N'False', 
		[LastModifiedByUserID] = -1, 
		[LastModifiedOnDate] = GETDATE() 
	WHERE [SettingName] = N'DNN_UseCaptcha' AND [PortalId] = @PortalID; 
END

Once the cache is cleared, the next time the login form loads, it will no longer have the CATPCHA field displayed.

Have more questions? Submit a request

Need More Help?

Do you need more assistance with this article? Please review your support options.