} else {
                     throw new Exception('Niekompletne dane.', 400);
                 }
             }
         }
         $result = $user->authorize($arguments);
         jsonSuccess($app, $result);
     } catch (Exception $e) {
         jsonError($app, $e);
     }
 });
 $app->get('/unauthorize', validatePrivileges(array('user', 'moderator', 'administrator')), function () use($app, $user) {
     try {
         // Walidacja danych
         $token = validateToken($GLOBALS['token']);
         $result = $user->unauthorize($token);
         jsonSuccess($app, $result);
     } catch (Exception $e) {
         echo "walidacja";
         jsonError($app, $e);
     }
 });
 $app->post('/lostpassword', function () use($app, $user, $config) {
     try {
         // Walidacja danych
         $postVars = $app->request->post();
         // Walidacja danych
         if (empty($postVars['email'])) {
             throw new Exception('Niekompletne dane.', 400);
         }
         $email = validateEmail($postVars['email']);