| @@ -100,15 +100,15 @@ | ||
| 100 | 100 | if ( is_wp_error( $results ) ) { |
| 101 | 101 | return; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - $token = md5( wp_rand() ); | |
| 104 | + $token = hash( 'sha256', wp_rand() ); | |
| 105 | 105 | |
| 106 | 106 | // Only who own this key can use 'elementor-safe-mode'. |
| 107 | 107 | update_option( self::OPTION_TOKEN, $token ); |
| 108 | 108 | |
| 109 | 109 | // Save for later use. |
| 110 | - setcookie( self::OPTION_TOKEN, $token, time() + HOUR_IN_SECONDS, COOKIEPATH ); | |
| 110 | + setcookie( self::OPTION_TOKEN, $token, time() + HOUR_IN_SECONDS, COOKIEPATH, '', is_ssl(), true ); | |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | public function disable_safe_mode() { |
| 114 | 114 | if ( ! current_user_can( 'install_plugins' ) ) { |
| @@ -130,9 +130,9 @@ | ||
| 130 | 130 | delete_option( 'theme_mods_elementor-safe' ); |
| 131 | 131 | delete_option( 'elementor_safe_mode_created_mu_dir' ); |
| 132 | 132 | |
| 133 | 133 | delete_option( self::OPTION_TOKEN ); |
| 134 | - setcookie( self::OPTION_TOKEN, '', 1 ); | |
| 134 | + setcookie( self::OPTION_TOKEN, '', 1, '', '', is_ssl(), true ); | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | public function filter_preview_url( $url ) { |
| 138 | 138 | return add_query_arg( 'elementor-mode', 'safe', $url ); |