summaryrefslogtreecommitdiffstats
path: root/lib/private/json.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-07-04 14:08:48 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2014-07-04 16:20:27 +0200
commit4fe1cdd2a7a1930d8ca0cb5bc23e5bfa22be6e55 (patch)
treebabd66d6a90c887c7bc6f97162b7b27156e608ec /lib/private/json.php
parent2327d41b11e11ca0553c829b5d7adeb0f000a474 (diff)
downloadnextcloud-server-4fe1cdd2a7a1930d8ca0cb5bc23e5bfa22be6e55.tar.gz
nextcloud-server-4fe1cdd2a7a1930d8ca0cb5bc23e5bfa22be6e55.zip
Add machine readable error messages to OC\JSON
Reload the files app in case of authentication errors, expired tokens or disabled app Reloading will triger the full server side handeling of those errors formatting fix missing semicolon + some jshint warnings
Diffstat (limited to 'lib/private/json.php')
-rw-r--r--lib/private/json.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/private/json.php b/lib/private/json.php
index 4634d7adfea..da38654997f 100644
--- a/lib/private/json.php
+++ b/lib/private/json.php
@@ -26,7 +26,7 @@ class OC_JSON{
public static function checkAppEnabled($app) {
if( !OC_App::isEnabled($app)) {
$l = OC_L10N::get('lib');
- self::error(array( 'data' => array( 'message' => $l->t('Application is not enabled') )));
+ self::error(array( 'data' => array( 'message' => $l->t('Application is not enabled'), 'error' => 'application_not_enabled' )));
exit();
}
}
@@ -37,7 +37,7 @@ class OC_JSON{
public static function checkLoggedIn() {
if( !OC_User::isLoggedIn()) {
$l = OC_L10N::get('lib');
- self::error(array( 'data' => array( 'message' => $l->t('Authentication error') )));
+ self::error(array( 'data' => array( 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' )));
exit();
}
}
@@ -48,7 +48,7 @@ class OC_JSON{
public static function callCheck() {
if( !OC_Util::isCallRegistered()) {
$l = OC_L10N::get('lib');
- self::error(array( 'data' => array( 'message' => $l->t('Token expired. Please reload page.') )));
+ self::error(array( 'data' => array( 'message' => $l->t('Token expired. Please reload page.'), 'error' => 'token_expired' )));
exit();
}
}
@@ -59,7 +59,7 @@ class OC_JSON{
public static function checkAdminUser() {
if( !OC_User::isAdminUser(OC_User::getUser())) {
$l = OC_L10N::get('lib');
- self::error(array( 'data' => array( 'message' => $l->t('Authentication error') )));
+ self::error(array( 'data' => array( 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' )));
exit();
}
}
@@ -71,7 +71,7 @@ class OC_JSON{
public static function checkUserExists($user) {
if (!OCP\User::userExists($user)) {
$l = OC_L10N::get('lib');
- OCP\JSON::error(array('data' => array('message' => $l->t('Unknown user'))));
+ OCP\JSON::error(array('data' => array('message' => $l->t('Unknown user'), 'error' => 'unknown_user' )));
exit;
}
}
@@ -84,7 +84,7 @@ class OC_JSON{
public static function checkSubAdminUser() {
if(!OC_SubAdmin::isSubAdmin(OC_User::getUser())) {
$l = OC_L10N::get('lib');
- self::error(array( 'data' => array( 'message' => $l->t('Authentication error') )));
+ self::error(array( 'data' => array( 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' )));
exit();
}
}