diff --git a/core/lostpassword/controller.php b/core/lostpassword/controller.php
index 6037fefa4ba343993c4d111c8fb92f1ade4e301c..e616fe7dff89e6486b5fa3e3f3e778adb7041bd2 100644
--- a/core/lostpassword/controller.php
+++ b/core/lostpassword/controller.php
@@ -67,6 +67,7 @@ class OC_Core_LostPassword_Controller {
 			if (isset($_POST['password'])) {
 				if (OC_User::setPassword($args['user'], $_POST['password'])) {
 					OC_Preferences::deleteKey($args['user'], 'owncloud', 'lostpassword');
+					OC_User::unsetMagicInCookie();
 					self::displayResetPasswordPage(true, $args);
 				} else {
 					self::displayResetPasswordPage(false, $args);