summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--backend/php/src/index.php7
1 files changed, 5 insertions, 2 deletions
diff --git a/backend/php/src/index.php b/backend/php/src/index.php
index eb3d75a..35752f4 100644
--- a/backend/php/src/index.php
+++ b/backend/php/src/index.php
@@ -676,69 +676,72 @@ error_log("message");
676 //"srpSharedSecret":"f1c25322e1478c8fb26063e9eef2f6fc25e0460065a31cb718f80bcff8f8a735", 676 //"srpSharedSecret":"f1c25322e1478c8fb26063e9eef2f6fc25e0460065a31cb718f80bcff8f8a735",
677 //"parameters":{ 677 //"parameters":{
678 // "user":{ 678 // "user":{
679 // "header":"{\"reco...sion\":\"0.1\"}", 679 // "header":"{\"reco...sion\":\"0.1\"}",
680 // "statistics":"s72Xva+w7CLgH+ihwqwXUbyu", 680 // "statistics":"s72Xva+w7CLgH+ihwqwXUbyu",
681 // "version":"0.3", 681 // "version":"0.3",
682 // "lock":"----" 682 // "lock":"----"
683 // }, 683 // },
684 // "credentials":{ 684 // "credentials":{
685 // "C":"57d15a8afbc1ae08103bd991d387ddfd8d26824276476fe709d754f098b6c26d", 685 // "C":"57d15a8afbc1ae08103bd991d387ddfd8d26824276476fe709d754f098b6c26d",
686 // "s":"d6735fc0486f391c4f3c947928f9e61a2418e7bed2bc9b25bb43f93acc52f636", 686 // "s":"d6735fc0486f391c4f3c947928f9e61a2418e7bed2bc9b25bb43f93acc52f636",
687 // "v":"540c2ebbf941a481b6b2c9026c07fb46e8202e4408ed96864a696deb622baece", 687 // "v":"540c2ebbf941a481b6b2c9026c07fb46e8202e4408ed96864a696deb622baece",
688 // "version":"0.2" 688 // "version":"0.2"
689 // }, 689 // },
690 // "oneTimePasswords":{ 690 // "oneTimePasswords":{
691 // "923cdc61c4b877b263236124c44d69b459d240453a461cce8ddf7518b423ca94": "1HD6Ta0xsifEDhDwE....9WDK6tvrS6w==", 691 // "923cdc61c4b877b263236124c44d69b459d240453a461cce8ddf7518b423ca94": "1HD6Ta0xsifEDhDwE....9WDK6tvrS6w==",
692 // "fb1573cb9497652a81688a099a524fb116e604c6fbc191cf33406eb8438efa5f": "CocN0cSxLmMRdgNF9....o3xhGUEY68Q==" 692 // "fb1573cb9497652a81688a099a524fb116e604c6fbc191cf33406eb8438efa5f": "CocN0cSxLmMRdgNF9....o3xhGUEY68Q=="
693 // } 693 // }
694 //} 694 //}
695//} 695//}
696 696
697 $user = new user(); 697 $user = new user();
698 $user->Get($_SESSION["userId"]); 698 $user->Get($_SESSION["userId"]);
699 699
700 $otp = new onetimepassword(); 700 $otp = new onetimepassword();
701 701
702 updateUserCredentials($parameters["parameters"]["credentials"], $user); 702 updateUserCredentials($parameters["parameters"]["credentials"], $user);
703 updateUserData($parameters["parameters"]["user"], $user); 703 updateUserData($parameters["parameters"]["user"], $user);
704 704
705 $otpList = $parameters["parameters"]["oneTimePasswords"]; 705 $otpList = $parameters["parameters"]["oneTimePasswords"];
706 foreach($otpList as $otpReference=>$otpData) { 706 foreach($otpList as $otpReference=>$otpData) {
707 $otpList = $otp->GetList(array(array("reference", "=", $otpReference))); 707 $otpList = $otp->GetList(array(array("reference", "=", $otpReference)));
708 $currentOtp = $otpList[0]; 708 $currentOtp = $otpList[0];
709 $currentOtp->data = $otpData; 709 $currentOtp->data = $otpData;
710 $currentOtp->Save(); 710 $currentOtp->Save();
711 } 711 }
712 712
713 $user->Save(); 713 $user->Save();
714 714
715 $result["lock"] = $user->lock; 715 $result["lock"] = $user->lock;
716 $result["result"] = "done"; 716 $result["result"] = "done";
717 717
718 //============================================================= 718 //=============================================================
719 } else if ($message == "echo") { 719 } else if ($message == "echo") {
720 $result["result"] = $parameters; 720 $result["result"] = $parameters;
721 } 721 }
722 722
723 //============================================================= 723 //=============================================================
724 } else { 724 } else if (isset($_SESSION['K'])) {
725 $result["error"] = "Wrong shared secret!"; 725 $result["error"] = "Wrong shared secret!";
726 } else {
727 $result["result"] = "EXCEPTION";
728 $result["message"] = "Trying to communicate without an active connection";
726 } 729 }
727 break; 730 break;
728 731
729 case "logout": 732 case "logout":
730error_log("logout"); 733error_log("logout");
731 session_destroy(); 734 session_destroy();
732 break; 735 break;
733 736
734 default: 737 default:
735error_log("default"); 738error_log("default");
736 $result["result"] = $parameters; 739 $result["result"] = $parameters;
737 break; 740 break;
738 } 741 }
739 742
740 session_write_close(); 743 session_write_close();
741 744
742 echo(json_encode($result)); 745 echo(json_encode($result));
743error_log("result: ".json_encode($result)); 746error_log("result: ".json_encode($result));
744?> \ No newline at end of file 747?>