|
@@ 294-298 (lines=5) @@
|
| 291 |
|
return $response; |
| 292 |
|
} |
| 293 |
|
|
| 294 |
|
if ($data == '') { |
| 295 |
|
$response['error'] = 2; |
| 296 |
|
$response['message'] = 'data must be a string representing a JSON object.'; |
| 297 |
|
return $response; |
| 298 |
|
} |
| 299 |
|
$userDataObj = json_decode($data, true); |
| 300 |
|
if (json_last_error() !== 0) { |
| 301 |
|
$response['error'] = 2; |
|
@@ 300-305 (lines=6) @@
|
| 297 |
|
return $response; |
| 298 |
|
} |
| 299 |
|
$userDataObj = json_decode($data, true); |
| 300 |
|
if (json_last_error() !== 0) { |
| 301 |
|
$response['error'] = 2; |
| 302 |
|
$response['message'] = 'invalid JSON - data was unable to be parsed'; |
| 303 |
|
return $response; |
| 304 |
|
} |
| 305 |
|
|
| 306 |
|
foreach ($userDataObj as $field => $value) { |
| 307 |
|
switch ($field) { |
| 308 |
|
case 'name': |
|
@@ 546-553 (lines=8) @@
|
| 543 |
|
} |
| 544 |
|
|
| 545 |
|
|
| 546 |
|
if ($resulting_error !== "") { |
| 547 |
|
$response['error'] = 3; |
| 548 |
|
$response['message'] = 'invalid email or email domain - must be a valid Government of Canada email address'; |
| 549 |
|
return $response; |
| 550 |
|
} |
| 551 |
|
$user_entity->set('email', $value); |
| 552 |
|
$user_entity->save(); |
| 553 |
|
|
| 554 |
|
elgg_set_ignore_access(false); |
| 555 |
|
break; |
| 556 |
|
case 'secondLanguage': |
|
@@ 578-582 (lines=5) @@
|
| 575 |
|
// create account |
| 576 |
|
// send password reset email |
| 577 |
|
// fill in profile data |
| 578 |
|
if ($data == '') { |
| 579 |
|
$response['error'] = 2; |
| 580 |
|
$response['message'] = 'data must be a string representing a JSON object.'; |
| 581 |
|
return $response; |
| 582 |
|
} |
| 583 |
|
$userDataObj = json_decode($data, true); |
| 584 |
|
if (json_last_error() !== 0) { |
| 585 |
|
$response['error'] = 2; |
|
@@ 584-589 (lines=6) @@
|
| 581 |
|
return $response; |
| 582 |
|
} |
| 583 |
|
$userDataObj = json_decode($data, true); |
| 584 |
|
if (json_last_error() !== 0) { |
| 585 |
|
$response['error'] = 2; |
| 586 |
|
$response['message'] = 'invalid JSON - data was unable to be parsed'; |
| 587 |
|
return $response; |
| 588 |
|
} |
| 589 |
|
|
| 590 |
|
/////////////////////////////////////////////////////////////////// |
| 591 |
|
//error check data field |
| 592 |
|
/////////////////////////////////////////////////////////////////// |
|
@@ 792-799 (lines=8) @@
|
| 789 |
|
} |
| 790 |
|
} |
| 791 |
|
|
| 792 |
|
if ($resulting_error !== "") { |
| 793 |
|
$response['error'] = 3; |
| 794 |
|
$response['message'] = 'invalid email or email domain - must be a valid Government of Canada email address'; |
| 795 |
|
return $response; |
| 796 |
|
} |
| 797 |
|
break; |
| 798 |
|
} |
| 799 |
|
} |
| 800 |
|
|
| 801 |
|
//check for existing email |
| 802 |
|
$email = $userDataObj['email']; |
|
@@ 830-834 (lines=5) @@
|
| 827 |
|
|
| 828 |
|
//register user using data passed |
| 829 |
|
$userGUID = register_user($username, $tempPass, $name, $userDataObj['email']); |
| 830 |
|
if ($userGUID==false) { |
| 831 |
|
$response['error'] = 1; |
| 832 |
|
$response['message'] = 'Failed creating account'; |
| 833 |
|
return $response; |
| 834 |
|
} |
| 835 |
|
|
| 836 |
|
$user_entity = get_user($userGUID); |
| 837 |
|
|