exit; } } else { echo JsonResponse::error('Invalid combination of registration number and passcode!'); exit; } } else { echo JsonResponse::error('Registration number or passcode not set!'); exit; } } elseif ($intent == "changePassword") { if (isset($_REQUEST['userid'], $_REQUEST['passcode'])) { # code... $status = CxSessionHandler::getItem('status') == INACTIVE ? PROCESSING : CxSessionHandler::getItem('status'); $authenticator = new AuthenticationController(); $change = $authenticator->changePassword($_REQUEST['userid'], $_REQUEST['passcode'], $status); if ($change) { //DESTROY SESSION TO LOG USER OUT CxSessionHandler::destroy(); //CONSTRUCT RESPONSE $response = array(); $response[P_MESSAGE] = "Password change successful!"; //SET MESSAGE FOR USER ON NEXT LOGIN CxSessionHandler::setViewBag("You just changed your password. Log in again with your new password."); //ECHO RESPONSE echo JsonResponse::success($response); exit; } else { echo JsonResponse::error("Unable to change password! Please try again."); exit; }