diff --git a/simplesamlphp_auth.module b/simplesamlphp_auth.module
index 847c8f5..0ee1bb8 100644
--- a/simplesamlphp_auth.module
+++ b/simplesamlphp_auth.module
@@ -150,6 +150,7 @@ function _simplesaml_auth_autoload() {
  */
 function simplesamlphp_auth_init() {
   if (user_is_anonymous()) {
+    _simplesamlphp_auth_get_logged_out_cookie();
     return FALSE;
   }
@@ -177,12 +182,65 @@ function simplesamlphp_auth_init() {

   // Logs out user if not SAML authenticated and not allowed default login.
   if (!$_simplesamlphp_auth_as->isAuthenticated() && !$user_allowed_default_login) {
+    _simplesamlphp_auth_set_logged_out_cookie("local_disabled");
     module_load_include('pages.inc', 'user');
     user_logout();
   }
 }

 /**
+ * @param $type string
+ *   The key of the cookie message type.
+ */
+function _simplesamlphp_auth_set_logged_out_cookie($type = "") {
+  global $base_url;
+  $name = "simplesamlphp_auth_message";
+  $expire = time() + (60 * 60); // 1 hour
+  $path = base_path();
+  $domain = $base_url;
+  $value = "";
+  $error_type = "";
+  $text = "";
+
+  // Destroy any cookie first:
+  setcookie($name, $value, -1, $path, $domain);
+
+  switch($type) {
+    case "local_disabled":
+      $text = "We're sorry, but local Drupal account login has been disabled.";
+      $error_type  = "error";
+      break;
+
+    default:
+      $value = "";
+      $error_type  = "";
+  }
+
+  if (empty($text)) {
+    return;
+  }
+
+  $value = array($text, $error_type);
+  $value = serialize($value);
+  setcookie($name, $value, $expire, $path, $domain);
+}
+
+/**
+ * Gets and processes the cookie in order to set a message for the logged out user.
+ */
+function _simplesamlphp_auth_get_logged_out_cookie() {
+  if (isset($_COOKIE['simplesamlphp_auth_message'])) {
+    global $base_url;
+    $path = base_path();
+    $domain = $base_url;
+    $values = unserialize($_COOKIE['simplesamlphp_auth_message']);
+    drupal_set_message(check_plain($values[0]), check_plain($values[1]));
+    setcookie("simplesamlphp_auth_message", "", -1, $path, $domain);
+  }
+}
+
+
+/**
  * Implements hook_user_insert().
  */
 function simplesamlphp_auth_user_insert(&$edit, $account, $category = NULL) {
