Skip to content

Commit

Permalink
Merge branch 'release/2.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
benhuson committed Jun 5, 2018
2 parents d6e1b2f + c15db0d commit 344bf0e
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 6 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ This project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## [2.2.2] - 2018-05-29

### Changed
- Change locked admin bar icon to green.

### Fixed
- Fix REST option and always allow access to REST API for logged in users.

## [2.2.1] - 2018-05-27

### Fixed
Expand Down Expand Up @@ -191,7 +199,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Added
- First Release. If you spot any bugs or issues please [log them here](https://github.com/benhuson/password-protected/issues).

[Unreleased]: https://github.com/benhuson/password-protected/compare/2.2.1...HEAD
[Unreleased]: https://github.com/benhuson/password-protected/compare/2.2.2...HEAD
[2.2.2]: https://github.com/benhuson/password-protected/compare/2.2.1...2.2.2
[2.2.1]: https://github.com/benhuson/password-protected/compare/2.2...2.2.1
[2.2]: https://github.com/benhuson/password-protected/compare/2.1...2.2
[2.1]: https://github.com/benhuson/password-protected/compare/2.0.3...2.1
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ More instructions can be found at [wp-translations.org](http://wp-translations.o
Upgrade Notice
--------------

### 2.2.2
Fix REST option and always allow access to REST API for logged in users. Change locked admin bar icon to green.

### 2.2.1
Fixed PHP error when calculating cookie expiration date.

Expand Down
2 changes: 1 addition & 1 deletion admin/admin-bar.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public static function styles() {

if ( self::is_enabled() ) {
$icon = '\f160'; // Locked
$background = '#C00';
$background = '#46b450';
} else {
$icon = '\f528'; // Unlocked
$background = 'transparent';
Expand Down
9 changes: 6 additions & 3 deletions password-protected.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Plugin Name: Password Protected
Plugin URI: https://wordpress.org/plugins/password-protected/
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.
Version: 2.2.1
Version: 2.2.2
Author: Ben Huson
Text Domain: password-protected
Author URI: http://github.com/benhuson/password-protected/
Expand Down Expand Up @@ -42,7 +42,7 @@

class Password_Protected {

var $version = '2.2.1';
var $version = '2.2.2';
var $admin = null;
var $errors = null;

Expand Down Expand Up @@ -793,13 +793,16 @@ static function is_plugin_supported() {
/**
* Check whether a given request has permissions
*
* Always allow logged in users who require REST API for Gutenberg
* and other admin/plugin compatibility.
*
* @param WP_REST_Request $access Full details about the request.
* @return WP_Error|boolean
*/
public function only_allow_logged_in_rest_access( $access ) {

// If user is not logged in
if ( ! $this->is_user_logged_in() && ! (bool) get_option( 'password_protected_rest' ) ) {die();
if ( ! $this->is_user_logged_in() && ! is_user_logged_in() && ! (bool) get_option( 'password_protected_rest' ) ) {
return new WP_Error( 'rest_cannot_access', __( 'Only authenticated users can access the REST API.', 'password-protected' ), array( 'status' => rest_authorization_required_code() ) );
}

Expand Down
12 changes: 11 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: password, protect, password protect, login
Requires at least: 3.9
Tested up to: 4.9.6
Requires PHP: 5.6
Stable tag: 2.2.1
Stable tag: 2.2.2
License: GPLv2 or later

A very simple way to quickly password protect your WordPress site with a single password.
Expand Down Expand Up @@ -82,6 +82,10 @@ More instructions can be found at [wp-translations.org](http://wp-translations.o

== Changelog ==

= 2.2.2 =
- Change locked admin bar icon to green.
- Fix REST option and always allow access to REST API for logged in users.

= 2.2.1 =
* Fixed PHP error when calculating cookie expiration date.

Expand Down Expand Up @@ -195,6 +199,12 @@ More instructions can be found at [wp-translations.org](http://wp-translations.o

== Upgrade Notice ==

= 2.2.2 =
Fix REST option and always allow access to REST API for logged in users. Change locked admin bar icon to green.

= 2.2.1 =
Fixed PHP error when calculating cookie expiration date.

= 2.2 =
Added admin bar icon to indicate wether password protection is enabled/disabled and disable REST API access (admin option to allow).

Expand Down

0 comments on commit 344bf0e

Please sign in to comment.