author | Josh <jokajak@gmail.com> | 2011-10-04 00:29:48 (UTC) |
---|---|---|
committer | Josh <jokajak@gmail.com> | 2011-10-04 00:29:48 (UTC) |
commit | d6f7343c97ab28c88ade2b4e4edf0ac29f7c5117 (patch) (unidiff) | |
tree | b5300ed7e98865e375881caa0966658f1fa204c3 | |
parent | 27e2d4e631656cff15b09d3b6441ac853771f5ee (diff) | |
download | clipperz-d6f7343c97ab28c88ade2b4e4edf0ac29f7c5117.zip clipperz-d6f7343c97ab28c88ade2b4e4edf0ac29f7c5117.tar.gz clipperz-d6f7343c97ab28c88ade2b4e4edf0ac29f7c5117.tar.bz2 |
send an exception when a session has timed out on the server side
-rw-r--r-- | backend/php/src/index.php | 7 |
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 | |||
@@ -660,85 +660,88 @@ error_log("message"); | |||
660 | updateUserData($parameters["parameters"]["user"], $user); | 660 | updateUserData($parameters["parameters"]["user"], $user); |
661 | $user->Save(); | 661 | $user->Save(); |
662 | 662 | ||
663 | $result["result"] = $user->lock; | 663 | $result["result"] = $user->lock; |
664 | 664 | ||
665 | //============================================================= | 665 | //============================================================= |
666 | } else if ($message == "getOneTimePasswordsDetails") { | 666 | } else if ($message == "getOneTimePasswordsDetails") { |
667 | 667 | ||
668 | //============================================================= | 668 | //============================================================= |
669 | } else if ($message == "getLoginHistory") { | 669 | } else if ($message == "getLoginHistory") { |
670 | $result["result"] = array(); | 670 | $result["result"] = array(); |
671 | 671 | ||
672 | //============================================================= | 672 | //============================================================= |
673 | } else if ($message == "upgradeUserCredentials") { | 673 | } else if ($message == "upgradeUserCredentials") { |
674 | //{ | 674 | //{ |
675 | //"message":"upgradeUserCredentials", | 675 | //"message":"upgradeUserCredentials", |
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": |
730 | error_log("logout"); | 733 | error_log("logout"); |
731 | session_destroy(); | 734 | session_destroy(); |
732 | break; | 735 | break; |
733 | 736 | ||
734 | default: | 737 | default: |
735 | error_log("default"); | 738 | error_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)); |
743 | error_log("result: ".json_encode($result)); | 746 | error_log("result: ".json_encode($result)); |
744 | ?> \ No newline at end of file | 747 | ?> |