protected function finalSuccess() { parent::finalSuccess(); $this->updateRublonSettings(); $updateMessage = 'PLUGIN_REGISTERED'; RublonHelper::setMessage($updateMessage, 'updated', 'CR'); RublonCookies::setAuthCookie(); $pluginMeta = RublonHelper::preparePluginMeta(); $pluginMeta['action'] = 'activation'; RublonHelper::pluginHistoryRequest($pluginMeta); $other_settings = RublonHelper::getSettings('other'); if (!empty($other_settings['newsletter_signup'])) { foreach ($other_settings['newsletter_signup'] as $email) { $rublon_req = new RublonRequests(); $rublon_req->subscribeToNewsletter($email); } unset($other_settings['newsletter_signup']); RublonHelper::saveSettings($other_settings, 'other'); } // Save project owner information RublonHelper::saveProjectOwner(); // Clear features cache if it is not a Business Editions RublonFeature::getFeatures(false); if (!RublonFeature::isBusinessEdition()) { RublonFeature::deleteFeaturesFromCache(); } $this->_redirect(admin_url(RublonHelper::WP_RUBLON_PAGE)); }
/** * Store WP authentication cookie params in the settings for future use * * Since the plugin needs to duplicate the WP cookie settings, we need to * store them for future use, as on this stage we do not authenticate * the user with the second factor yet - this will happen in a moment. * * @param string $auth_cookie Set cookie * @param int $expire Whether the cookie is a session or permanent one * @param int $expiration Expiration date (timestamp) * @param id $user_id Logged in user's WP ID * @param string $scheme Whether the cookie is secure * @return void */ function rublon2factor_store_auth_cookie_params($auth_cookie, $expire, $expiration, $user_id = null, $scheme) { // Deprecated? if ($user_id) { $user = get_user_by('id', $user_id); $secure = $scheme == 'secure_auth'; if ($user) { $secure_logged_in_cookie = apply_filters('secure_logged_in_cookie', false, $user_id, $secure); $cookieParams = array('secure' => $secure, 'remember' => $expire > 0, 'logged_in_secure' => $secure_logged_in_cookie); $settings = RublonHelper::getSettings(); $settings['wp_cookie_params'] = $cookieParams; $settings['wp_cookie_expiration'] = array('expire' => $expire, 'expiration' => $expiration); RublonHelper::saveSettings($settings); } $flag = RublonHelper::flag($user, RublonHelper::TRANSIENT_FLAG_UPDATE_AUTH_COOKIE); if ($flag === RublonHelper::YES) { RublonCookies::setAuthCookie($user); } } }