Version Description
- Made compatibility with login designer; Now you can customize the password-protected screen with the customizer using login designer plugin.
Download this release
Release Info
Developer | wpexpertsio |
Plugin | Password Protected |
Version | 2.5.2 |
Comparing to | |
See all releases |
Code changes from version 2.5.1 to 2.5.2
- CHANGELOG.md +3 -0
- README.md +4 -2
- assets/banner-1544x500.png +0 -0
- assets/banner-772x250.png +0 -0
- assets/icon-128x128.png +0 -0
- assets/icon-256x256.png +0 -0
- assets/screenshot-1.png +0 -0
- assets/screenshot-2.png +0 -0
- assets/src/Banner.fw.png +0 -0
- assets/src/Icon.fw.png +0 -0
- password-protected.php +60 -52
- readme.txt +23 -3
- theme/password-protected-login.php +11 -4
CHANGELOG.md
CHANGED
@@ -2,6 +2,9 @@
|
|
2 |
All notable changes to this project will be documented in this file.
|
3 |
This project adheres to [Semantic Versioning](http://semver.org/).
|
4 |
|
|
|
|
|
|
|
5 |
## [2.5] - 2021-09-01
|
6 |
|
7 |
### Fixed
|
2 |
All notable changes to this project will be documented in this file.
|
3 |
This project adheres to [Semantic Versioning](http://semver.org/).
|
4 |
|
5 |
+
### 2.5.2 - 2022-05-26
|
6 |
+
Made compatibility with [login designer](https://wp.org/plugins/login-designer); Now you can customize the password-protected screen with the customizer using login designer plugin.
|
7 |
+
|
8 |
## [2.5] - 2021-09-01
|
9 |
|
10 |
### Fixed
|
README.md
CHANGED
@@ -10,8 +10,7 @@ Features include:
|
|
10 |
- Password protect your WordPress site with a single password.
|
11 |
- Option to allow access to feeds.
|
12 |
- Option to allow administrators access without entering password.
|
13 |
-
-
|
14 |
-
- Works with the [Uber Login Logo](https://wordpress.org/plugins/uber-login-logo/) plugin.
|
15 |
|
16 |
> Please note, this plugin works by setting a cookie to allow access to the site. If you are using a caching plugin or web hosting such as WP Engine that has in-built caching, you will need to configure the caching service to be disabled if the Password Protected cookie is set.
|
17 |
|
@@ -74,6 +73,9 @@ If you would like to translate this plugin you can easily contribute at the [Tra
|
|
74 |
Upgrade Notice
|
75 |
--------------
|
76 |
|
|
|
|
|
|
|
77 |
### 2.5
|
78 |
Fixes robots tag for WordPress 5.7+
|
79 |
|
10 |
- Password protect your WordPress site with a single password.
|
11 |
- Option to allow access to feeds.
|
12 |
- Option to allow administrators access without entering password.
|
13 |
+
- *New* 👉 Now you can customize the whole password protected screen including the background, font, logo, color e.t.c.
|
|
|
14 |
|
15 |
> Please note, this plugin works by setting a cookie to allow access to the site. If you are using a caching plugin or web hosting such as WP Engine that has in-built caching, you will need to configure the caching service to be disabled if the Password Protected cookie is set.
|
16 |
|
73 |
Upgrade Notice
|
74 |
--------------
|
75 |
|
76 |
+
### 2.5.2
|
77 |
+
Made compatibility with [login designer](https://wp.org/plugins/login-designer); Now you can customize the password-protected screen with the customizer using login designer plugin.
|
78 |
+
|
79 |
### 2.5
|
80 |
Fixes robots tag for WordPress 5.7+
|
81 |
|
assets/banner-1544x500.png
ADDED
Binary file
|
assets/banner-772x250.png
ADDED
Binary file
|
assets/icon-128x128.png
ADDED
Binary file
|
assets/icon-256x256.png
ADDED
Binary file
|
assets/screenshot-1.png
ADDED
Binary file
|
assets/screenshot-2.png
ADDED
Binary file
|
assets/src/Banner.fw.png
ADDED
Binary file
|
assets/src/Icon.fw.png
ADDED
Binary file
|
password-protected.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Password Protected
|
4 |
Plugin URI: https://wordpress.org/plugins/password-protected/
|
5 |
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.
|
6 |
-
Version: 2.5.
|
7 |
Author: WPExperts
|
8 |
Text Domain: password-protected
|
9 |
Author URI: https://wpexperts.io/
|
@@ -39,7 +39,7 @@ $Password_Protected = new Password_Protected();
|
|
39 |
|
40 |
class Password_Protected {
|
41 |
|
42 |
-
var $version = '2.5.
|
43 |
var $admin = null;
|
44 |
var $errors = null;
|
45 |
|
@@ -76,15 +76,15 @@ class Password_Protected {
|
|
76 |
|
77 |
add_shortcode( 'password_protected_logout_link', array( $this, 'logout_link_shortcode' ) );
|
78 |
|
79 |
-
include_once
|
80 |
|
81 |
if ( is_admin() ) {
|
82 |
|
83 |
-
include_once
|
84 |
-
include_once
|
85 |
|
86 |
$this->admin_caching = new Password_Protected_Admin_Caching( $this );
|
87 |
-
$this->admin
|
88 |
|
89 |
}
|
90 |
|
@@ -171,7 +171,7 @@ class Password_Protected {
|
|
171 |
/**
|
172 |
* Allow Feeds
|
173 |
*
|
174 |
-
* @param boolean
|
175 |
* @return boolean True/false.
|
176 |
*/
|
177 |
public function allow_feeds( $bool ) {
|
@@ -187,7 +187,7 @@ class Password_Protected {
|
|
187 |
/**
|
188 |
* Allow Administrators
|
189 |
*
|
190 |
-
* @param boolean
|
191 |
* @return boolean True/false.
|
192 |
*/
|
193 |
public function allow_administrators( $bool ) {
|
@@ -203,7 +203,7 @@ class Password_Protected {
|
|
203 |
/**
|
204 |
* Allow Users
|
205 |
*
|
206 |
-
* @param boolean
|
207 |
* @return boolean True/false.
|
208 |
*/
|
209 |
public function allow_users( $bool ) {
|
@@ -221,7 +221,7 @@ class Password_Protected {
|
|
221 |
*
|
222 |
* If user has a valid email address, return false to disable password protection.
|
223 |
*
|
224 |
-
* @param boolean
|
225 |
* @return boolean True/false.
|
226 |
*/
|
227 |
public function allow_ip_addresses( $bool ) {
|
@@ -261,7 +261,7 @@ class Password_Protected {
|
|
261 |
/**
|
262 |
* Encrypt Password
|
263 |
*
|
264 |
-
* @param string
|
265 |
* @return string Encrypted password.
|
266 |
*/
|
267 |
public function encrypt_password( $password ) {
|
@@ -299,7 +299,7 @@ class Password_Protected {
|
|
299 |
|
300 |
if ( $this->is_active() && isset( $_REQUEST['password_protected_pwd'] ) ) {
|
301 |
$password_protected_pwd = $_REQUEST['password_protected_pwd'];
|
302 |
-
$pwd
|
303 |
|
304 |
// If correct password...
|
305 |
if ( ( hash_equals( $pwd, $this->encrypt_password( $password_protected_pwd ) ) && $pwd != '' ) || apply_filters( 'password_protected_process_login', false, $password_protected_pwd ) ) {
|
@@ -321,7 +321,6 @@ class Password_Protected {
|
|
321 |
$this->safe_redirect( remove_query_arg( 'password-protected' ) );
|
322 |
exit;
|
323 |
}
|
324 |
-
|
325 |
} else {
|
326 |
|
327 |
// ... otherwise incorrect password
|
@@ -329,7 +328,6 @@ class Password_Protected {
|
|
329 |
$this->errors->add( 'incorrect_password', __( 'Incorrect Password', 'password-protected' ) );
|
330 |
|
331 |
}
|
332 |
-
|
333 |
}
|
334 |
|
335 |
}
|
@@ -349,12 +347,17 @@ class Password_Protected {
|
|
349 |
* Maybe Show Login
|
350 |
*/
|
351 |
public function maybe_show_login() {
|
|
|
|
|
|
|
|
|
|
|
352 |
|
353 |
// Filter for adding exceptions.
|
354 |
$show_login = apply_filters( 'password_protected_show_login', $this->is_active() );
|
355 |
|
356 |
// Logged in
|
357 |
-
if ( $this->is_user_logged_in() )
|
358 |
$show_login = false;
|
359 |
}
|
360 |
|
@@ -432,14 +435,14 @@ class Password_Protected {
|
|
432 |
/**
|
433 |
* Logout URL
|
434 |
*
|
435 |
-
* @param string
|
436 |
* @return string Logout URL.
|
437 |
*/
|
438 |
public function logout_url( $redirect_to = '' ) {
|
439 |
|
440 |
$query = array(
|
441 |
'password-protected' => 'logout',
|
442 |
-
'redirect_to' => esc_url_raw( $redirect_to )
|
443 |
);
|
444 |
|
445 |
if ( empty( $query['redirect_to'] ) ) {
|
@@ -453,7 +456,7 @@ class Password_Protected {
|
|
453 |
/**
|
454 |
* Logout Link
|
455 |
*
|
456 |
-
* @param array
|
457 |
* @return string HTML link tag.
|
458 |
*/
|
459 |
public function logout_link( $args = null ) {
|
@@ -463,10 +466,13 @@ class Password_Protected {
|
|
463 |
return '';
|
464 |
}
|
465 |
|
466 |
-
$args = wp_parse_args(
|
467 |
-
|
468 |
-
|
469 |
-
|
|
|
|
|
|
|
470 |
|
471 |
if ( empty( $args['text'] ) ) {
|
472 |
$args['text'] = __( 'Logout', 'password-protected' );
|
@@ -479,15 +485,19 @@ class Password_Protected {
|
|
479 |
/**
|
480 |
* Logout Link Shortcode
|
481 |
*
|
482 |
-
* @param array
|
483 |
* @return string HTML link tag.
|
484 |
*/
|
485 |
public function logout_link_shortcode( $atts, $content = null ) {
|
486 |
|
487 |
-
$atts = shortcode_atts(
|
488 |
-
|
489 |
-
|
490 |
-
|
|
|
|
|
|
|
|
|
491 |
|
492 |
return $this->logout_link( $atts );
|
493 |
|
@@ -507,8 +517,8 @@ class Password_Protected {
|
|
507 |
/**
|
508 |
* Validate Auth Cookie
|
509 |
*
|
510 |
-
* @param string
|
511 |
-
* @param string
|
512 |
* @return boolean Validation successful?
|
513 |
*/
|
514 |
public function validate_auth_cookie( $cookie = '', $scheme = '' ) {
|
@@ -529,12 +539,12 @@ class Password_Protected {
|
|
529 |
|
530 |
// Quick check to see if an honest cookie has expired
|
531 |
if ( $expired < current_time( 'timestamp' ) ) {
|
532 |
-
do_action('password_protected_auth_cookie_expired', $cookie_elements);
|
533 |
return false;
|
534 |
}
|
535 |
|
536 |
-
$key
|
537 |
-
$hash = hash_hmac( 'md5', $this->get_site_id() . '|' . $expiration, $key);
|
538 |
|
539 |
if ( $hmac != $hash ) {
|
540 |
do_action( 'password_protected_auth_cookie_bad_hash', $cookie_elements );
|
@@ -552,14 +562,14 @@ class Password_Protected {
|
|
552 |
/**
|
553 |
* Generate Auth Cookie
|
554 |
*
|
555 |
-
* @param int
|
556 |
-
* @param string
|
557 |
* @return string Cookie.
|
558 |
*/
|
559 |
public function generate_auth_cookie( $expiration, $scheme = 'auth' ) {
|
560 |
|
561 |
-
$key
|
562 |
-
$hash
|
563 |
$cookie = $this->get_site_id() . '|' . $expiration . '|' . $hash;
|
564 |
|
565 |
return $cookie;
|
@@ -569,8 +579,8 @@ class Password_Protected {
|
|
569 |
/**
|
570 |
* Parse Auth Cookie
|
571 |
*
|
572 |
-
* @param string
|
573 |
-
* @param string
|
574 |
* @return string Cookie string.
|
575 |
*/
|
576 |
public function parse_auth_cookie( $cookie = '', $scheme = '' ) {
|
@@ -604,18 +614,18 @@ class Password_Protected {
|
|
604 |
*
|
605 |
* @todo
|
606 |
*
|
607 |
-
* @param boolean
|
608 |
-
* @param string
|
609 |
*/
|
610 |
-
public function set_auth_cookie( $remember = false, $secure = '') {
|
611 |
|
612 |
if ( $remember ) {
|
613 |
$expiration_time = apply_filters( 'password_protected_auth_cookie_expiration', get_option( 'password_protected_remember_me_lifetime', 14 ) * DAY_IN_SECONDS, $remember );
|
614 |
-
$expiration
|
615 |
} else {
|
616 |
$expiration_time = apply_filters( 'password_protected_auth_cookie_expiration', DAY_IN_SECONDS * 20, $remember );
|
617 |
-
$expiration
|
618 |
-
$expire
|
619 |
}
|
620 |
|
621 |
if ( '' === $secure ) {
|
@@ -623,7 +633,7 @@ class Password_Protected {
|
|
623 |
}
|
624 |
|
625 |
$secure_password_protected_cookie = apply_filters( 'password_protected_secure_password_protected_cookie', false, $secure );
|
626 |
-
$password_protected_cookie
|
627 |
|
628 |
setcookie( $this->cookie_name(), $password_protected_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure_password_protected_cookie, true );
|
629 |
if ( COOKIEPATH != SITECOOKIEPATH ) {
|
@@ -689,7 +699,7 @@ class Password_Protected {
|
|
689 |
if ( class_exists( 'CWS_Login_Logo_Plugin' ) ) {
|
690 |
|
691 |
// Add support for Mark Jaquith's Login Logo plugin
|
692 |
-
add_action( 'password_protected_login_head', array( new CWS_Login_Logo_Plugin, 'login_head' ) );
|
693 |
|
694 |
} elseif ( class_exists( 'UberLoginLogo' ) ) {
|
695 |
|
@@ -714,7 +724,7 @@ class Password_Protected {
|
|
714 |
|
715 |
if ( $this->errors->get_error_code() ) {
|
716 |
|
717 |
-
$errors
|
718 |
$messages = '';
|
719 |
|
720 |
foreach ( $this->errors->get_error_codes() as $code ) {
|
@@ -734,7 +744,6 @@ class Password_Protected {
|
|
734 |
if ( ! empty( $messages ) ) {
|
735 |
echo '<p class="message">' . apply_filters( 'password_protected_login_messages', $messages ) . "</p>\n";
|
736 |
}
|
737 |
-
|
738 |
}
|
739 |
|
740 |
}
|
@@ -759,14 +768,13 @@ class Password_Protected {
|
|
759 |
if ( ! empty( $located ) ) {
|
760 |
|
761 |
$stylesheet_directory = trailingslashit( get_stylesheet_directory() );
|
762 |
-
$template_directory
|
763 |
|
764 |
if ( $stylesheet_directory == substr( $located, 0, strlen( $stylesheet_directory ) ) ) {
|
765 |
wp_enqueue_style( 'password-protected-login', get_stylesheet_directory_uri() . '/' . $filename );
|
766 |
-
}
|
767 |
wp_enqueue_style( 'password-protected-login', get_template_directory_uri() . '/' . $filename );
|
768 |
}
|
769 |
-
|
770 |
}
|
771 |
|
772 |
}
|
@@ -807,7 +815,7 @@ class Password_Protected {
|
|
807 |
* Always allow logged in users who require REST API for Gutenberg
|
808 |
* and other admin/plugin compatibility.
|
809 |
*
|
810 |
-
* @param WP_REST_Request
|
811 |
* @return WP_Error|boolean
|
812 |
*/
|
813 |
public function only_allow_logged_in_rest_access( $access ) {
|
3 |
Plugin Name: Password Protected
|
4 |
Plugin URI: https://wordpress.org/plugins/password-protected/
|
5 |
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.
|
6 |
+
Version: 2.5.2
|
7 |
Author: WPExperts
|
8 |
Text Domain: password-protected
|
9 |
Author URI: https://wpexperts.io/
|
39 |
|
40 |
class Password_Protected {
|
41 |
|
42 |
+
var $version = '2.5.2';
|
43 |
var $admin = null;
|
44 |
var $errors = null;
|
45 |
|
76 |
|
77 |
add_shortcode( 'password_protected_logout_link', array( $this, 'logout_link_shortcode' ) );
|
78 |
|
79 |
+
include_once dirname( __FILE__ ) . '/admin/admin-bar.php';
|
80 |
|
81 |
if ( is_admin() ) {
|
82 |
|
83 |
+
include_once dirname( __FILE__ ) . '/admin/admin-caching.php';
|
84 |
+
include_once dirname( __FILE__ ) . '/admin/admin.php';
|
85 |
|
86 |
$this->admin_caching = new Password_Protected_Admin_Caching( $this );
|
87 |
+
$this->admin = new Password_Protected_Admin();
|
88 |
|
89 |
}
|
90 |
|
171 |
/**
|
172 |
* Allow Feeds
|
173 |
*
|
174 |
+
* @param boolean $bool Allow feeds.
|
175 |
* @return boolean True/false.
|
176 |
*/
|
177 |
public function allow_feeds( $bool ) {
|
187 |
/**
|
188 |
* Allow Administrators
|
189 |
*
|
190 |
+
* @param boolean $bool Allow administrators.
|
191 |
* @return boolean True/false.
|
192 |
*/
|
193 |
public function allow_administrators( $bool ) {
|
203 |
/**
|
204 |
* Allow Users
|
205 |
*
|
206 |
+
* @param boolean $bool Allow administrators.
|
207 |
* @return boolean True/false.
|
208 |
*/
|
209 |
public function allow_users( $bool ) {
|
221 |
*
|
222 |
* If user has a valid email address, return false to disable password protection.
|
223 |
*
|
224 |
+
* @param boolean $bool Allow IP addresses.
|
225 |
* @return boolean True/false.
|
226 |
*/
|
227 |
public function allow_ip_addresses( $bool ) {
|
261 |
/**
|
262 |
* Encrypt Password
|
263 |
*
|
264 |
+
* @param string $password Password.
|
265 |
* @return string Encrypted password.
|
266 |
*/
|
267 |
public function encrypt_password( $password ) {
|
299 |
|
300 |
if ( $this->is_active() && isset( $_REQUEST['password_protected_pwd'] ) ) {
|
301 |
$password_protected_pwd = $_REQUEST['password_protected_pwd'];
|
302 |
+
$pwd = get_option( 'password_protected_password' );
|
303 |
|
304 |
// If correct password...
|
305 |
if ( ( hash_equals( $pwd, $this->encrypt_password( $password_protected_pwd ) ) && $pwd != '' ) || apply_filters( 'password_protected_process_login', false, $password_protected_pwd ) ) {
|
321 |
$this->safe_redirect( remove_query_arg( 'password-protected' ) );
|
322 |
exit;
|
323 |
}
|
|
|
324 |
} else {
|
325 |
|
326 |
// ... otherwise incorrect password
|
328 |
$this->errors->add( 'incorrect_password', __( 'Incorrect Password', 'password-protected' ) );
|
329 |
|
330 |
}
|
|
|
331 |
}
|
332 |
|
333 |
}
|
347 |
* Maybe Show Login
|
348 |
*/
|
349 |
public function maybe_show_login() {
|
350 |
+
if ( in_array( 'login-designer/login-designer.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ), true ) ) {
|
351 |
+
if ( is_customize_preview() ) {
|
352 |
+
return;
|
353 |
+
}
|
354 |
+
}
|
355 |
|
356 |
// Filter for adding exceptions.
|
357 |
$show_login = apply_filters( 'password_protected_show_login', $this->is_active() );
|
358 |
|
359 |
// Logged in
|
360 |
+
if ( $this->is_user_logged_in() ) {
|
361 |
$show_login = false;
|
362 |
}
|
363 |
|
435 |
/**
|
436 |
* Logout URL
|
437 |
*
|
438 |
+
* @param string $redirect_to Optional. Redirect URL.
|
439 |
* @return string Logout URL.
|
440 |
*/
|
441 |
public function logout_url( $redirect_to = '' ) {
|
442 |
|
443 |
$query = array(
|
444 |
'password-protected' => 'logout',
|
445 |
+
'redirect_to' => esc_url_raw( $redirect_to ),
|
446 |
);
|
447 |
|
448 |
if ( empty( $query['redirect_to'] ) ) {
|
456 |
/**
|
457 |
* Logout Link
|
458 |
*
|
459 |
+
* @param array $args Link args.
|
460 |
* @return string HTML link tag.
|
461 |
*/
|
462 |
public function logout_link( $args = null ) {
|
466 |
return '';
|
467 |
}
|
468 |
|
469 |
+
$args = wp_parse_args(
|
470 |
+
$args,
|
471 |
+
array(
|
472 |
+
'redirect_to' => '',
|
473 |
+
'text' => __( 'Logout', 'password-protected' ),
|
474 |
+
)
|
475 |
+
);
|
476 |
|
477 |
if ( empty( $args['text'] ) ) {
|
478 |
$args['text'] = __( 'Logout', 'password-protected' );
|
485 |
/**
|
486 |
* Logout Link Shortcode
|
487 |
*
|
488 |
+
* @param array $args Link args.
|
489 |
* @return string HTML link tag.
|
490 |
*/
|
491 |
public function logout_link_shortcode( $atts, $content = null ) {
|
492 |
|
493 |
+
$atts = shortcode_atts(
|
494 |
+
array(
|
495 |
+
'redirect_to' => '',
|
496 |
+
'text' => $content,
|
497 |
+
),
|
498 |
+
$atts,
|
499 |
+
'logout_link_shortcode'
|
500 |
+
);
|
501 |
|
502 |
return $this->logout_link( $atts );
|
503 |
|
517 |
/**
|
518 |
* Validate Auth Cookie
|
519 |
*
|
520 |
+
* @param string $cookie Cookie string.
|
521 |
+
* @param string $scheme Cookie scheme.
|
522 |
* @return boolean Validation successful?
|
523 |
*/
|
524 |
public function validate_auth_cookie( $cookie = '', $scheme = '' ) {
|
539 |
|
540 |
// Quick check to see if an honest cookie has expired
|
541 |
if ( $expired < current_time( 'timestamp' ) ) {
|
542 |
+
do_action( 'password_protected_auth_cookie_expired', $cookie_elements );
|
543 |
return false;
|
544 |
}
|
545 |
|
546 |
+
$key = md5( $this->get_site_id() . $this->get_hashed_password() . '|' . $expiration );
|
547 |
+
$hash = hash_hmac( 'md5', $this->get_site_id() . '|' . $expiration, $key );
|
548 |
|
549 |
if ( $hmac != $hash ) {
|
550 |
do_action( 'password_protected_auth_cookie_bad_hash', $cookie_elements );
|
562 |
/**
|
563 |
* Generate Auth Cookie
|
564 |
*
|
565 |
+
* @param int $expiration Expiration time in seconds.
|
566 |
+
* @param string $scheme Cookie scheme.
|
567 |
* @return string Cookie.
|
568 |
*/
|
569 |
public function generate_auth_cookie( $expiration, $scheme = 'auth' ) {
|
570 |
|
571 |
+
$key = md5( $this->get_site_id() . $this->get_hashed_password() . '|' . $expiration );
|
572 |
+
$hash = hash_hmac( 'md5', $this->get_site_id() . '|' . $expiration, $key );
|
573 |
$cookie = $this->get_site_id() . '|' . $expiration . '|' . $hash;
|
574 |
|
575 |
return $cookie;
|
579 |
/**
|
580 |
* Parse Auth Cookie
|
581 |
*
|
582 |
+
* @param string $cookie Cookie string.
|
583 |
+
* @param string $scheme Cookie scheme.
|
584 |
* @return string Cookie string.
|
585 |
*/
|
586 |
public function parse_auth_cookie( $cookie = '', $scheme = '' ) {
|
614 |
*
|
615 |
* @todo
|
616 |
*
|
617 |
+
* @param boolean $remember Remember logged in.
|
618 |
+
* @param string $secure Secure cookie.
|
619 |
*/
|
620 |
+
public function set_auth_cookie( $remember = false, $secure = '' ) {
|
621 |
|
622 |
if ( $remember ) {
|
623 |
$expiration_time = apply_filters( 'password_protected_auth_cookie_expiration', get_option( 'password_protected_remember_me_lifetime', 14 ) * DAY_IN_SECONDS, $remember );
|
624 |
+
$expiration = $expire = current_time( 'timestamp' ) + $expiration_time;
|
625 |
} else {
|
626 |
$expiration_time = apply_filters( 'password_protected_auth_cookie_expiration', DAY_IN_SECONDS * 20, $remember );
|
627 |
+
$expiration = current_time( 'timestamp' ) + $expiration_time;
|
628 |
+
$expire = 0;
|
629 |
}
|
630 |
|
631 |
if ( '' === $secure ) {
|
633 |
}
|
634 |
|
635 |
$secure_password_protected_cookie = apply_filters( 'password_protected_secure_password_protected_cookie', false, $secure );
|
636 |
+
$password_protected_cookie = $this->generate_auth_cookie( $expiration, 'password_protected' );
|
637 |
|
638 |
setcookie( $this->cookie_name(), $password_protected_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure_password_protected_cookie, true );
|
639 |
if ( COOKIEPATH != SITECOOKIEPATH ) {
|
699 |
if ( class_exists( 'CWS_Login_Logo_Plugin' ) ) {
|
700 |
|
701 |
// Add support for Mark Jaquith's Login Logo plugin
|
702 |
+
add_action( 'password_protected_login_head', array( new CWS_Login_Logo_Plugin(), 'login_head' ) );
|
703 |
|
704 |
} elseif ( class_exists( 'UberLoginLogo' ) ) {
|
705 |
|
724 |
|
725 |
if ( $this->errors->get_error_code() ) {
|
726 |
|
727 |
+
$errors = '';
|
728 |
$messages = '';
|
729 |
|
730 |
foreach ( $this->errors->get_error_codes() as $code ) {
|
744 |
if ( ! empty( $messages ) ) {
|
745 |
echo '<p class="message">' . apply_filters( 'password_protected_login_messages', $messages ) . "</p>\n";
|
746 |
}
|
|
|
747 |
}
|
748 |
|
749 |
}
|
768 |
if ( ! empty( $located ) ) {
|
769 |
|
770 |
$stylesheet_directory = trailingslashit( get_stylesheet_directory() );
|
771 |
+
$template_directory = trailingslashit( get_template_directory() );
|
772 |
|
773 |
if ( $stylesheet_directory == substr( $located, 0, strlen( $stylesheet_directory ) ) ) {
|
774 |
wp_enqueue_style( 'password-protected-login', get_stylesheet_directory_uri() . '/' . $filename );
|
775 |
+
} elseif ( $template_directory == substr( $located, 0, strlen( $template_directory ) ) ) {
|
776 |
wp_enqueue_style( 'password-protected-login', get_template_directory_uri() . '/' . $filename );
|
777 |
}
|
|
|
778 |
}
|
779 |
|
780 |
}
|
815 |
* Always allow logged in users who require REST API for Gutenberg
|
816 |
* and other admin/plugin compatibility.
|
817 |
*
|
818 |
+
* @param WP_REST_Request $access Full details about the request.
|
819 |
* @return WP_Error|boolean
|
820 |
*/
|
821 |
public function only_allow_logged_in_rest_access( $access ) {
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: password, protect, password protect, login
|
|
4 |
Requires at least: 4.6
|
5 |
Tested up to: 6.0
|
6 |
Requires PHP: 5.6
|
7 |
-
Stable tag: 2.5.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
A very simple way to quickly password protect your WordPress site with a single password.
|
@@ -20,11 +20,28 @@ Features include:
|
|
20 |
* Password protect your WordPress site with a single password.
|
21 |
* Option to allow access to feeds.
|
22 |
* Option to allow administrators access without entering password.
|
23 |
-
*
|
24 |
-
* Works with the [Uber Login Logo](https://wordpress.org/plugins/uber-login-logo/) plugin.
|
25 |
|
26 |
> Please note, this plugin works by setting a cookie to allow access to the site. If you are using a caching plugin or web hosting such as WP Engine that has in-built caching, you will need to configure the caching service to be disabled if the Password Protected cookie is set.
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
= Translations =
|
29 |
|
30 |
If you would like to translate this plugin you can easily contribute at the [Translating WordPress](https://translate.wordpress.org/projects/wp-plugins/password-protected/) page. The stable plugin needs to be 95% translated for a language file to be available to download/update via WordPress.
|
@@ -84,6 +101,9 @@ If you would like to translate this plugin you can easily contribute at the [Tra
|
|
84 |
|
85 |
== Changelog ==
|
86 |
|
|
|
|
|
|
|
87 |
= 2.5.1 =
|
88 |
- Fix - Author name conflict resolved
|
89 |
|
4 |
Requires at least: 4.6
|
5 |
Tested up to: 6.0
|
6 |
Requires PHP: 5.6
|
7 |
+
Stable tag: 2.5.2
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
A very simple way to quickly password protect your WordPress site with a single password.
|
20 |
* Password protect your WordPress site with a single password.
|
21 |
* Option to allow access to feeds.
|
22 |
* Option to allow administrators access without entering password.
|
23 |
+
* *New* 👉 Now you can customize the whole password protected screen including the background, font, logo, color e.t.c.
|
|
|
24 |
|
25 |
> Please note, this plugin works by setting a cookie to allow access to the site. If you are using a caching plugin or web hosting such as WP Engine that has in-built caching, you will need to configure the caching service to be disabled if the Password Protected cookie is set.
|
26 |
|
27 |
+
= Customize your website’s login page with Login Designer. =
|
28 |
+
|
29 |
+
[Login Designer](https://wordpress.org/plugins/login-designer/) is the best login customizer plugin for WordPress. It offers contextually displayed options and plugin settings, Custom event triggers, Context-aware previews, powerful custom controls, Live editing…. the list goes on.
|
30 |
+
|
31 |
+
= LOGIN DESIGNER FEATURES =
|
32 |
+
|
33 |
+
* Login error messages customization.
|
34 |
+
* WordPress login translation.
|
35 |
+
* Added enable/disable button in customizer for a language translator.
|
36 |
+
* Added pencil icons on editable settings.
|
37 |
+
* Customize the background color, radius, padding, shadow, transparency, and checkbox width.
|
38 |
+
* Edit the text, font, size, and color of username and password fields.
|
39 |
+
* Customize the full display appearance of the login form input fields.
|
40 |
+
* Customize the “Remember me” checkbox input element and on the login form.
|
41 |
+
* Customize the full display appearance of the login submit button.
|
42 |
+
* Import & Export settings by custom CSS.
|
43 |
+
* Google ReCaptcha settings.
|
44 |
+
|
45 |
= Translations =
|
46 |
|
47 |
If you would like to translate this plugin you can easily contribute at the [Translating WordPress](https://translate.wordpress.org/projects/wp-plugins/password-protected/) page. The stable plugin needs to be 95% translated for a language file to be available to download/update via WordPress.
|
101 |
|
102 |
== Changelog ==
|
103 |
|
104 |
+
= 2.5.2 =
|
105 |
+
- Made compatibility with [login designer](https://wp.org/plugins/login-designer); Now you can customize the password-protected screen with the customizer using login designer plugin.
|
106 |
+
|
107 |
= 2.5.1 =
|
108 |
- Fix - Author name conflict resolved
|
109 |
|
theme/password-protected-login.php
CHANGED
@@ -107,6 +107,9 @@ if ( $is_iphone ) {
|
|
107 |
}
|
108 |
|
109 |
do_action( 'login_enqueue_scripts' );
|
|
|
|
|
|
|
110 |
do_action( 'password_protected_login_head' );
|
111 |
|
112 |
?>
|
@@ -115,16 +118,16 @@ do_action( 'password_protected_login_head' );
|
|
115 |
<body class="login login-password-protected login-action-password-protected-login wp-core-ui">
|
116 |
|
117 |
<div id="login">
|
118 |
-
<h1><a href="<?php echo esc_url( apply_filters( 'password_protected_login_headerurl', home_url( '/' ) ) ); ?>" title="<?php echo esc_attr( apply_filters( 'password_protected_login_headertitle', get_bloginfo( 'name' ) ) ); ?>"><?php bloginfo( 'name' ); ?></a></h1>
|
119 |
|
120 |
<?php do_action( 'password_protected_login_messages' ); ?>
|
121 |
<?php do_action( 'password_protected_before_login_form' ); ?>
|
122 |
|
123 |
<form name="loginform" id="loginform" action="<?php echo esc_url( $Password_Protected->login_url() ); ?>" method="post">
|
124 |
<p>
|
125 |
-
<label for="password_protected_pass"><?php echo apply_filters( 'password_protected_login_password_title', __( 'Password', 'password-protected' ) );
|
126 |
-
<input type="password" name="password_protected_pwd" id="password_protected_pass" class="input" value="" size="20" tabindex="20"
|
127 |
-
|
128 |
|
129 |
<?php if ( $Password_Protected->allow_remember_me() ) : ?>
|
130 |
<p class="forgetmenot">
|
@@ -153,5 +156,9 @@ if(typeof wpOnload=='function')wpOnload();
|
|
153 |
|
154 |
<div class="clear"></div>
|
155 |
|
|
|
|
|
|
|
|
|
156 |
</body>
|
157 |
</html>
|
107 |
}
|
108 |
|
109 |
do_action( 'login_enqueue_scripts' );
|
110 |
+
if ( in_array( 'login-designer/login-designer.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ), true ) ) {
|
111 |
+
do_action( 'password_protected_enqueue_scripts' );
|
112 |
+
}
|
113 |
do_action( 'password_protected_login_head' );
|
114 |
|
115 |
?>
|
118 |
<body class="login login-password-protected login-action-password-protected-login wp-core-ui">
|
119 |
|
120 |
<div id="login">
|
121 |
+
<h1 id="password-protected-logo"><a href="<?php echo esc_url( apply_filters( 'password_protected_login_headerurl', home_url( '/' ) ) ); ?>" title="<?php echo esc_attr( apply_filters( 'password_protected_login_headertitle', get_bloginfo( 'name' ) ) ); ?>"><?php bloginfo( 'name' ); ?></a></h1>
|
122 |
|
123 |
<?php do_action( 'password_protected_login_messages' ); ?>
|
124 |
<?php do_action( 'password_protected_before_login_form' ); ?>
|
125 |
|
126 |
<form name="loginform" id="loginform" action="<?php echo esc_url( $Password_Protected->login_url() ); ?>" method="post">
|
127 |
<p>
|
128 |
+
<label for="password_protected_pass"><?php echo esc_attr( apply_filters( 'password_protected_login_password_title', __( 'Password', 'password-protected' ) ) ); ?></label>
|
129 |
+
<input type="password" name="password_protected_pwd" id="password_protected_pass" class="input" value="" size="20" tabindex="20" />
|
130 |
+
</p>
|
131 |
|
132 |
<?php if ( $Password_Protected->allow_remember_me() ) : ?>
|
133 |
<p class="forgetmenot">
|
156 |
|
157 |
<div class="clear"></div>
|
158 |
|
159 |
+
<?php if ( in_array( 'login-designer/login-designer.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ), true ) ) : ?>
|
160 |
+
<div id="password-protected-background" style="position:absolute; inset: 0;width: 100%;height: 100%;z-index: -1;transition: opacity 300ms cubic-bezier(0.694, 0, 0.335, 1) 0s"></div>
|
161 |
+
<?php endif; ?>
|
162 |
+
|
163 |
</body>
|
164 |
</html>
|