private function InstapageCmsPluginAjaxController::loginUser in Instapage plugin 7.3
Same name and namespace in other branches
- 8.3 core/InstapageCmsPluginAjaxController.php \InstapageCmsPluginAjaxController::loginUser()
Performs login by email and password in Instapage APP.
1 call to InstapageCmsPluginAjaxController::loginUser()
- InstapageCmsPluginAjaxController::doAction in core/
InstapageCmsPluginAjaxController.php - Executes an action set in the request.
File
- core/
InstapageCmsPluginAjaxController.php, line 165
Class
- InstapageCmsPluginAjaxController
- Main controller for AJAX actions. Results are returned as encoded JSON objects. Data for actions are stored in $_POST['data'] table.
Code
private function loginUser() {
$api = InstapageCmsPluginAPIModel::getInstance();
$post = InstapageCmsPluginHelper::getPostData();
$email = urldecode(isset($post->data->email) ? $post->data->email : '');
$password = urldecode(isset($post->data->password) ? $post->data->password : '');
$response = json_decode($api
->authorise($email, $password));
if (!InstapageCmsPluginHelper::checkResponse($response, null, false) || !$response->success) {
$message = isset($response->message) ? $response->message : '';
echo InstapageCmsPluginHelper::formatJsonMessage($message, 'ERROR');
return false;
}
else {
echo json_encode((object) array(
'status' => 'OK',
'data' => (object) $response->data,
));
}
}