diff --git a/apps/calendar/ajax/activation.php b/apps/calendar/ajax/activation.php
index 3c2bc6de23..ada2e44547 100644
--- a/apps/calendar/ajax/activation.php
+++ b/apps/calendar/ajax/activation.php
@@ -7,9 +7,7 @@
*/
require_once ("../../../lib/base.php");
-if(!OC_USER::isLoggedIn()) {
- die("");
-}
+OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
$calendarid = $_POST['calendarid'];
$calendar = OC_Calendar_App::getCalendar($calendarid);//access check
diff --git a/apps/calendar/ajax/choosecalendar.php b/apps/calendar/ajax/choosecalendar.php
index 0935a4c42a..9281c8edbd 100644
--- a/apps/calendar/ajax/choosecalendar.php
+++ b/apps/calendar/ajax/choosecalendar.php
@@ -8,9 +8,7 @@
require_once('../../../lib/base.php');
$l10n = new OC_L10N('calendar');
-if(!OC_USER::isLoggedIn()) {
- die("");
-}
+OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
$output = new OC_TEMPLATE("calendar", "part.choosecalendar");
$output -> printpage();
diff --git a/apps/calendar/ajax/deletecalendar.php b/apps/calendar/ajax/deletecalendar.php
index fc308da6da..901cbbfcb0 100644
--- a/apps/calendar/ajax/deletecalendar.php
+++ b/apps/calendar/ajax/deletecalendar.php
@@ -7,9 +7,7 @@
*/
require_once('../../../lib/base.php');
-if(!OC_USER::isLoggedIn()) {
- die('');
-}
+OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
$cal = $_POST["calendarid"];
diff --git a/apps/calendar/ajax/deleteevent.php b/apps/calendar/ajax/deleteevent.php
index 269f4a47f4..b25a5af1a2 100644
--- a/apps/calendar/ajax/deleteevent.php
+++ b/apps/calendar/ajax/deleteevent.php
@@ -9,9 +9,7 @@ require_once('../../../lib/base.php');
$l10n = new OC_L10N('calendar');
-if(!OC_USER::isLoggedIn()) {
- die('');
-}
+OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
$id = $_POST['id'];
diff --git a/apps/calendar/ajax/editcalendar.php b/apps/calendar/ajax/editcalendar.php
index e44763c9aa..7aeb5bbe30 100644
--- a/apps/calendar/ajax/editcalendar.php
+++ b/apps/calendar/ajax/editcalendar.php
@@ -7,9 +7,7 @@
*/
require_once('../../../lib/base.php');
-if(!OC_USER::isLoggedIn()) {
- die("");
-}
+OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
$calendarcolor_options = OC_Calendar_Calendar::getCalendarColorOptions();
diff --git a/apps/calendar/ajax/editevent.php b/apps/calendar/ajax/editevent.php
index f00ab1d960..5a487da175 100644
--- a/apps/calendar/ajax/editevent.php
+++ b/apps/calendar/ajax/editevent.php
@@ -7,9 +7,7 @@
*/
require_once('../../../lib/base.php');
-if(!OC_USER::isLoggedIn()) {
- die('');
-}
+OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
$errarr = OC_Calendar_Object::validateRequest($_POST);
diff --git a/apps/calendar/ajax/editeventform.php b/apps/calendar/ajax/editeventform.php
index fe6c6f7357..2c81539d2e 100644
--- a/apps/calendar/ajax/editeventform.php
+++ b/apps/calendar/ajax/editeventform.php
@@ -8,9 +8,7 @@
require_once('../../../lib/base.php');
-if(!OC_USER::isLoggedIn()) {
- die('');
-}
+OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
$id = $_GET['id'];
diff --git a/apps/calendar/ajax/importdialog.php b/apps/calendar/ajax/importdialog.php
index 232b4ba580..8d8430da7a 100644
--- a/apps/calendar/ajax/importdialog.php
+++ b/apps/calendar/ajax/importdialog.php
@@ -10,9 +10,7 @@ require_once('../../../lib/base.php');
$l10n = new OC_L10N('calendar');
-if(!OC_USER::isLoggedIn()) {
- die("");
-}
+OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
$tmpl = new OC_Template('calendar', 'part.import');
diff --git a/apps/calendar/ajax/newcalendar.php b/apps/calendar/ajax/newcalendar.php
index a7935c9567..af3ba4fbbe 100644
--- a/apps/calendar/ajax/newcalendar.php
+++ b/apps/calendar/ajax/newcalendar.php
@@ -8,9 +8,7 @@
require_once('../../../lib/base.php');
$l10n = new OC_L10N('calendar');
-if(!OC_USER::isLoggedIn()) {
- die("");
-}
+OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
$calendarcolor_options = OC_Calendar_Calendar::getCalendarColorOptions();
$calendar = array(
diff --git a/apps/calendar/ajax/newevent.php b/apps/calendar/ajax/newevent.php
index 1a696cf778..c7c4d29943 100644
--- a/apps/calendar/ajax/newevent.php
+++ b/apps/calendar/ajax/newevent.php
@@ -10,9 +10,7 @@ require_once('../../../lib/base.php');
$l10n = new OC_L10N('calendar');
-if(!OC_USER::isLoggedIn()) {
- die("");
-}
+OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
$errarr = OC_Calendar_Object::validateRequest($_POST);
diff --git a/apps/calendar/ajax/neweventform.php b/apps/calendar/ajax/neweventform.php
index e12e99219e..6de1f8ca30 100644
--- a/apps/calendar/ajax/neweventform.php
+++ b/apps/calendar/ajax/neweventform.php
@@ -8,9 +8,7 @@
require_once('../../../lib/base.php');
-if(!OC_USER::isLoggedIn()) {
- die('');
-}
+OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
if (!isset($_POST['start'])){