Password Protected - Version 2.2.2

Version Description

  • Change locked admin bar icon to green.
  • Fix REST option and always allow access to REST API for logged in users.
Download this release

Release Info

Developer husobj
Plugin Icon 128x128 Password Protected
Version 2.2.2
Comparing to
See all releases

Code changes from version 2.2.1 to 2.2.2

Files changed (5) hide show
  1. CHANGELOG.md +10 -1
  2. README.md +3 -0
  3. admin/admin-bar.php +1 -1
  4. password-protected.php +6 -3
  5. readme.txt +11 -1
CHANGELOG.md CHANGED
@@ -4,6 +4,14 @@ This project adheres to [Semantic Versioning](http://semver.org/).
4
 
5
  ## [Unreleased]
6
 
 
 
 
 
 
 
 
 
7
  ## [2.2.1] - 2018-05-27
8
 
9
  ### Fixed
@@ -191,7 +199,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
191
  ### Added
192
  - First Release. If you spot any bugs or issues please [log them here](https://github.com/benhuson/password-protected/issues).
193
 
194
- [Unreleased]: https://github.com/benhuson/password-protected/compare/2.2.1...HEAD
 
195
  [2.2.1]: https://github.com/benhuson/password-protected/compare/2.2...2.2.1
196
  [2.2]: https://github.com/benhuson/password-protected/compare/2.1...2.2
197
  [2.1]: https://github.com/benhuson/password-protected/compare/2.0.3...2.1
4
 
5
  ## [Unreleased]
6
 
7
+ ## [2.2.2] - 2018-05-29
8
+
9
+ ### Changed
10
+ - Change locked admin bar icon to green.
11
+
12
+ ### Fixed
13
+ - Fix REST option and always allow access to REST API for logged in users.
14
+
15
  ## [2.2.1] - 2018-05-27
16
 
17
  ### Fixed
199
  ### Added
200
  - First Release. If you spot any bugs or issues please [log them here](https://github.com/benhuson/password-protected/issues).
201
 
202
+ [Unreleased]: https://github.com/benhuson/password-protected/compare/2.2.2...HEAD
203
+ [2.2.2]: https://github.com/benhuson/password-protected/compare/2.2.1...2.2.2
204
  [2.2.1]: https://github.com/benhuson/password-protected/compare/2.2...2.2.1
205
  [2.2]: https://github.com/benhuson/password-protected/compare/2.1...2.2
206
  [2.1]: https://github.com/benhuson/password-protected/compare/2.0.3...2.1
README.md CHANGED
@@ -71,6 +71,9 @@ More instructions can be found at [wp-translations.org](http://wp-translations.o
71
  Upgrade Notice
72
  --------------
73
 
 
 
 
74
  ### 2.2.1
75
  Fixed PHP error when calculating cookie expiration date.
76
 
71
  Upgrade Notice
72
  --------------
73
 
74
+ ### 2.2.2
75
+ Fix REST option and always allow access to REST API for logged in users. Change locked admin bar icon to green.
76
+
77
  ### 2.2.1
78
  Fixed PHP error when calculating cookie expiration date.
79
 
admin/admin-bar.php CHANGED
@@ -93,7 +93,7 @@ class Admin_Bar {
93
 
94
  if ( self::is_enabled() ) {
95
  $icon = '\f160'; // Locked
96
- $background = '#C00';
97
  } else {
98
  $icon = '\f528'; // Unlocked
99
  $background = 'transparent';
93
 
94
  if ( self::is_enabled() ) {
95
  $icon = '\f160'; // Locked
96
+ $background = '#46b450';
97
  } else {
98
  $icon = '\f528'; // Unlocked
99
  $background = 'transparent';
password-protected.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Password Protected
5
  Plugin URI: https://wordpress.org/plugins/password-protected/
6
  Description: A very simple way to quickly password protect your WordPress site with a single password. Please note: This plugin does not restrict access to uploaded files and images and does not work with some caching setups.
7
- Version: 2.2.1
8
  Author: Ben Huson
9
  Text Domain: password-protected
10
  Author URI: http://github.com/benhuson/password-protected/
@@ -42,7 +42,7 @@ $Password_Protected = new Password_Protected();
42
 
43
  class Password_Protected {
44
 
45
- var $version = '2.2.1';
46
  var $admin = null;
47
  var $errors = null;
48
 
@@ -793,13 +793,16 @@ class Password_Protected {
793
  /**
794
  * Check whether a given request has permissions
795
  *
 
 
 
796
  * @param WP_REST_Request $access Full details about the request.
797
  * @return WP_Error|boolean
798
  */
799
  public function only_allow_logged_in_rest_access( $access ) {
800
 
801
  // If user is not logged in
802
- if ( ! $this->is_user_logged_in() && ! (bool) get_option( 'password_protected_rest' ) ) {die();
803
  return new WP_Error( 'rest_cannot_access', __( 'Only authenticated users can access the REST API.', 'password-protected' ), array( 'status' => rest_authorization_required_code() ) );
804
  }
805
 
4
  Plugin Name: Password Protected
5
  Plugin URI: https://wordpress.org/plugins/password-protected/
6
  Description: A very simple way to quickly password protect your WordPress site with a single password. Please note: This plugin does not restrict access to uploaded files and images and does not work with some caching setups.
7
+ Version: 2.2.2
8
  Author: Ben Huson
9
  Text Domain: password-protected
10
  Author URI: http://github.com/benhuson/password-protected/
42
 
43
  class Password_Protected {
44
 
45
+ var $version = '2.2.2';
46
  var $admin = null;
47
  var $errors = null;
48
 
793
  /**
794
  * Check whether a given request has permissions
795
  *
796
+ * Always allow logged in users who require REST API for Gutenberg
797
+ * and other admin/plugin compatibility.
798
+ *
799
  * @param WP_REST_Request $access Full details about the request.
800
  * @return WP_Error|boolean
801
  */
802
  public function only_allow_logged_in_rest_access( $access ) {
803
 
804
  // If user is not logged in
805
+ if ( ! $this->is_user_logged_in() && ! is_user_logged_in() && ! (bool) get_option( 'password_protected_rest' ) ) {
806
  return new WP_Error( 'rest_cannot_access', __( 'Only authenticated users can access the REST API.', 'password-protected' ), array( 'status' => rest_authorization_required_code() ) );
807
  }
808
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: password, protect, password protect, login
5
  Requires at least: 3.9
6
  Tested up to: 4.9.6
7
  Requires PHP: 5.6
8
- Stable tag: 2.2.1
9
  License: GPLv2 or later
10
 
11
  A very simple way to quickly password protect your WordPress site with a single password.
@@ -82,6 +82,10 @@ More instructions can be found at [wp-translations.org](http://wp-translations.o
82
 
83
  == Changelog ==
84
 
 
 
 
 
85
  = 2.2.1 =
86
  * Fixed PHP error when calculating cookie expiration date.
87
 
@@ -195,6 +199,12 @@ More instructions can be found at [wp-translations.org](http://wp-translations.o
195
 
196
  == Upgrade Notice ==
197
 
 
 
 
 
 
 
198
  = 2.2 =
199
  Added admin bar icon to indicate wether password protection is enabled/disabled and disable REST API access (admin option to allow).
200
 
5
  Requires at least: 3.9
6
  Tested up to: 4.9.6
7
  Requires PHP: 5.6
8
+ Stable tag: 2.2.2
9
  License: GPLv2 or later
10
 
11
  A very simple way to quickly password protect your WordPress site with a single password.
82
 
83
  == Changelog ==
84
 
85
+ = 2.2.2 =
86
+ - Change locked admin bar icon to green.
87
+ - Fix REST option and always allow access to REST API for logged in users.
88
+
89
  = 2.2.1 =
90
  * Fixed PHP error when calculating cookie expiration date.
91
 
199
 
200
  == Upgrade Notice ==
201
 
202
+ = 2.2.2 =
203
+ Fix REST option and always allow access to REST API for logged in users. Change locked admin bar icon to green.
204
+
205
+ = 2.2.1 =
206
+ Fixed PHP error when calculating cookie expiration date.
207
+
208
  = 2.2 =
209
  Added admin bar icon to indicate wether password protection is enabled/disabled and disable REST API access (admin option to allow).
210