Adds test with encryption, fixes stupid bug

This commit is contained in:
nikolark committed 2014-07-10 19:26:45 +02:00
1 parent 6ffc0d2042
commit 0f1140939c
5 files changed
+64 -5

No files matched your search

+2 -2
View File
@@ -53,7 +53,7 @@ if(strlen($body) === 0) {
/* Decrypt body */
$crypt = new CryptoHelper(SNAP_IV, SNAP_KEY);
$body = $crypt->decrypt($body);
$body = $crypt->decrypt(trim($body));
$data = (array) json_decode($body);
if($data === NULL) {
set_response_code(400);
@@ -143,7 +143,7 @@ if( isset($data['purchased']) ) {
/* Create user */
$user_id = NULL;
try {
$user_id = add_user($user_id);
$user_id = add_user($data);
} catch(InsideDatabaseException $e) {
set_response_code(500);
echo $crypt->json_encode_and_encrypt(array('error' => 'db_error', 'error_message' => $e->getMessage()));