diff --git a/logintoboggan.module b/logintoboggan.module
index 7ec765f..e6b2939 100755
--- a/logintoboggan.module
+++ b/logintoboggan.module
@@ -888,12 +888,32 @@ function _logintoboggan_toggleboggan ($form) {
   return $form;
 }
 
+/**
+ * Returns an appropriate authentication form based on the configuration.
+ *
+ * @param $active_form
+ *   Which form to display, should be 'login' or 'register'.
+ */
+function logintoboggan_get_authentication_form($active_form = 'login') {
+  $output = '';
+  if (variable_get('logintoboggan_unified_login', 0)) {
+    $output = logintoboggan_unified_login_page($active_form);
+  }
+  elseif ($active_form == 'login') {
+    $output = drupal_get_form('user_login');
+  }
+  elseif ($active_form == 'register') {
+    $output = drupal_get_form('user_register_form');
+  }
+  return $output;
+}
+
 function logintoboggan_denied() {
   if ($GLOBALS['user']->uid == 0) {
     // Output the user login form.
-    drupal_set_title(t('Access Denied / User log in'));
-    $output = drupal_get_form('user_login');
+    $output = logintoboggan_get_authentication_form('login');
     drupal_set_page_content($output);
+    drupal_set_title(t('Access Denied / User log in'));
     // Return page attributes, hide blocks.
     $page = element_info('page');
     $page['#logintoboggan_denied'] = TRUE;
