diff --git a/index.php b/index.php
index d2d0700c577c9c92fa969423800587c79f666dbc..2e55827a62a9144ba0a1942196dc9d4bf6991b8f 100644
--- a/index.php
+++ b/index.php
@@ -68,6 +68,9 @@ else {
 			OC_User::setUserId($_COOKIE['oc_username']);
 			OC_Util::redirectToDefaultPage();
 		}
+		else {
+			OC_User::unsetMagicInCookie();
+		}
 	}
 	
 	// Someone wants to log in :