$company, 'areaOfInterest' => 'WordPress 2 Factor Authentication Plugin', 'productInterest' => 'API_2FA', 'firstname' => $first_name, 'lastname' => $last_name, 'email' => $email, 'phone' => $phone, 'password' => $password ); $json = wp_json_encode($fields); $mo2f_api= new Molms_Mo2f_Api(); $response = $mo2f_api->make_curl_call($url, $json); return $response; } public static function get_customer_key($email, $password) { $url = molms_Constants::MOLMS_HOST_NAME. "/moas/rest/customer/key"; $fields = array( 'email' => $email, 'password' => $password ); $json = wp_json_encode($fields); $mo2f_api= new Molms_Mo2f_Api(); $response = $mo2f_api->make_curl_call($url, $json); return $response; } public function submit_contact_us($q_email, $q_phone, $query) { $current_user = wp_get_current_user(); $url = molms_Constants::MOLMS_HOST_NAME . "/moas/rest/customer/contact-us"; $is_nc_with_1_user = molms_Utility::get_mo2f_db_option('mo2f_is_NC', 'get_site_option') && molms_Utility::get_mo2f_db_option('mo2f_is_NNC', 'get_site_option'); $is_ec_with_1_user = ! molms_Utility::get_mo2f_db_option('mo2f_is_NC', 'get_site_option'); $onprem = MOLMS_IS_ONPREM ?'O':'C'; $customer_feature = ""; if ($is_ec_with_1_user) { $customer_feature = "V1"; } elseif ($is_nc_with_1_user) { $customer_feature = "V3"; } global $molms_utility; $query = '[WordPress 2FA for LMS Plugin: ' .$onprem.$customer_feature . ' - V '.MOLMS_VERSION.']: ' . $query; $fields = array( 'firstName' => $current_user->user_firstname, 'lastName' => $current_user->user_lastname, 'company' => $_SERVER['SERVER_NAME'], 'email' => $q_email, 'ccEmail' => '2fasupport@xecurify.com', 'phone' => $q_phone, 'query' => $query ); $field_string = wp_json_encode($fields); $mo2f_api= new Molms_Mo2f_Api(); $response = $mo2f_api->make_curl_call($url, $field_string); return true; } //CHECK public function send_otp_token($auth_type, $phone, $email) { $url = molms_Constants::MOLMS_HOST_NAME . '/moas/api/auth/challenge'; $customer_key = molms_Constants::DEFAULT_CUSTOMER_KEY; $api_key = molms_Constants::DEFAULT_API_KEY; $fields = array( 'customerKey' => $customer_key, 'email' => $email, 'phone' => $phone, 'authType' => $auth_type, 'transactionName' => 'miniOrange 2-Factor' ); $json = wp_json_encode($fields); $authHeader = $this->createAuthHeader($customer_key, $api_key); $mo2f_api= new Molms_Mo2f_Api(); $response = $mo2f_api->make_curl_call($url, $json, $authHeader); return $response; } public function validate_otp_token($transaction_id, $otpToken) { $url = molms_Constants::MOLMS_HOST_NAME . '/moas/api/auth/validate'; $customer_key = molms_Constants::DEFAULT_CUSTOMER_KEY; $api_key = molms_Constants::DEFAULT_API_KEY; $fields = array( 'txId' => $transaction_id, 'token' => $otpToken, ); $json = wp_json_encode($fields); $authHeader = $this->createAuthHeader($customer_key, $api_key); $mo2f_api= new Molms_Mo2f_Api(); $response = $mo2f_api->make_curl_call($url, $json, $authHeader); return $response; } public function check_customer($email) { $url = molms_Constants::MOLMS_HOST_NAME . "/moas/rest/customer/check-if-exists"; $fields = array( 'email' => $email, ); $json = wp_json_encode($fields); $mo2f_api= new Molms_Mo2f_Api(); $response = $mo2f_api->make_curl_call($url, $json); return $response; } public function mo_wpns_forgot_password() { $url = molms_Constants::MOLMS_HOST_NAME . '/moas/rest/customer/password-reset'; $email = get_site_option('mo2f_email'); $customer_key = get_site_option('mo2f_customerKey'); $api_key = get_site_option('mo2f_api_key'); $fields = array( 'email' => $email ); $json = wp_json_encode($fields); $authHeader = $this->createAuthHeader($customer_key, $api_key); $mo2f_api= new Molms_Mo2f_Api(); $response = $mo2f_api->make_curl_call($url, $json, $authHeader); return $response; } public function send_notification($toEmail, $subject, $content, $from_email, $fromName, $toName) { $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; $headers .= 'From: '.$fromName.'<'.$from_email.'>' . "\r\n"; mail($toEmail, $subject, $content, $headers); return wp_json_encode(array("status"=>'SUCCESS','statusMessage'=>'SUCCESS')); } //added for feedback public function send_email_alert($email, $phone, $message, $feedback_option) { global $molms_utility; global $user; $url = molms_Constants::MOLMS_HOST_NAME . '/moas/api/notify/send'; $customer_key = molms_Constants::DEFAULT_CUSTOMER_KEY; $api_key = molms_Constants::DEFAULT_API_KEY; $from_email = 'no-reply@xecurify.com'; if ($feedback_option == 'molms_skip_feedback') { $subject = "Deactivate [Feedback Skipped]: WordPress miniOrange 2FA for LMS Plugin"; } elseif ($feedback_option == 'molms_feedback') { $subject = "Feedback: WordPress miniOrange 2FA for LMS Plugin - ". $email; ; } elseif ($feedback_option == 'molms_rating') { $subject = "Feedback: WordPress miniOrange 2FA for LMS Plugin - ". $email; ; } $headers = array('Content-Type: text/html; charset=UTF-8'); $user = wp_get_current_user(); $is_nc_with_1_user = molms_Utility::get_mo2f_db_option('mo2f_is_NC', 'get_site_option') && molms_Utility::get_mo2f_db_option('mo2f_is_NNC', 'get_site_option'); $is_ec_with_1_user = ! molms_Utility::get_mo2f_db_option('mo2f_is_NC', 'get_site_option'); $onprem = MOLMS_IS_ONPREM ? 'O':'C'; $customer_feature = ""; if ($is_ec_with_1_user) { $customer_feature = "V1"; } elseif ($is_nc_with_1_user) { $customer_feature = "V3"; } $query = '[WordPress 2FA for LMS Plugin: ' .$onprem.$customer_feature . ' - V '.MOLMS_VERSION.']: ' . $message; if (isset($_SERVER['SERVER_NAME'])) { $server = sanitize_text_field($_SERVER['SERVER_NAME']); } else { $server = ''; } $content='