function mo2f_get_qr_code_for_mobile($email, $id) { $registerMobile = new Two_Factor_Setup(); $content = $registerMobile->register_mobile($email); $response = json_decode($content, true); if (json_last_error() == JSON_ERROR_NONE) { if ($response['status'] == 'ERROR') { update_option('mo2f_message', $response['message']); unset($_SESSION['mo2f_qrCode']); unset($_SESSION['mo2f_transactionId']); unset($_SESSION['mo2f_show_qr_code']); $this->mo_auth_show_error_message(); } else { if ($response['status'] == 'IN_PROGRESS') { update_option('mo2f_message', 'Please scan the QR Code now.'); $_SESSION['mo2f_qrCode'] = $response['qrCode']; $_SESSION['mo2f_transactionId'] = $response['txId']; $_SESSION['mo2f_show_qr_code'] = 'MO_2_FACTOR_SHOW_QR_CODE'; $this->mo_auth_show_success_message(); } else { update_option('mo2f_message', "An error occured while processing your request. Please Try again."); unset($_SESSION['mo2f_qrCode']); unset($_SESSION['mo2f_transactionId']); unset($_SESSION['mo2f_show_qr_code']); $this->mo_auth_show_error_message(); } } } }
function mo2f_inline_get_qr_code_for_mobile($email, $id) { $registerMobile = new Two_Factor_Setup(); $content = $registerMobile->register_mobile($email); $response = json_decode($content, true); if (json_last_error() == JSON_ERROR_NONE) { if ($response['status'] == 'ERROR') { $_SESSION['mo2f-login-message'] = $response['message']; unset($_SESSION['mo2f-login-qrCode']); unset($_SESSION['mo2f-login-transactionId']); unset($_SESSION['mo2f_show_qr_code']); } else { if ($response['status'] == 'IN_PROGRESS') { $_SESSION['mo2f-login-qrCode'] = $response['qrCode']; $_SESSION['mo2f-login-transactionId'] = $response['txId']; $_SESSION['mo2f_show_qr_code'] = 'MO_2_FACTOR_SHOW_QR_CODE'; } else { $_SESSION['mo2f-login-message'] = "An error occured while processing your request. Please Try again."; unset($_SESSION['mo2f-login-qrCode']); unset($_SESSION['mo2f-login-transactionId']); unset($_SESSION['mo2f_show_qr_code']); } } } }