Version Description
- Added checkbox to allow access to feeds when protection is enabled.
- Prepare for WordPress 3.5 Settings API changes.
- Added 'password_protected_before_login_form' and 'password_protected_after_login_form' actions.
- Added 'password_protected_process_login' filter to make it possible to extend login functionality.
- Now possible to use 'pre_update_option_password_protected_password' filter to use password before it is encrypted and saved.
- Ready for translations.
Download this release
Release Info
Developer | husobj |
Plugin | Password Protected |
Version | 1.3 |
Comparing to | |
See all releases |
Code changes from version 1.2.2 to 1.3
- admin/admin.php +58 -18
- admin/js/settings.js +13 -0
- password-protected.php +32 -7
- readme.txt +27 -2
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- theme/login.php +10 -6
admin/admin.php
CHANGED
@@ -2,12 +2,32 @@
|
|
2 |
|
3 |
class Password_Protected_Admin {
|
4 |
|
|
|
|
|
5 |
/**
|
6 |
* Constructor
|
7 |
*/
|
8 |
function Password_Protected_Admin() {
|
|
|
9 |
add_action( 'admin_init', array( $this, 'privacy_settings' ) );
|
10 |
add_action( 'admin_notices', array( $this, 'password_protected_admin_notices' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
}
|
12 |
|
13 |
/**
|
@@ -16,26 +36,27 @@ class Password_Protected_Admin {
|
|
16 |
function privacy_settings() {
|
17 |
add_settings_section(
|
18 |
'password_protected',
|
19 |
-
'Password Protected Settings',
|
20 |
array( $this, 'password_protected_settings_section' ),
|
21 |
-
|
22 |
);
|
23 |
add_settings_field(
|
24 |
'password_protected_status',
|
25 |
-
'Password
|
26 |
array( $this, 'password_protected_status_field' ),
|
27 |
-
|
28 |
'password_protected'
|
29 |
);
|
30 |
add_settings_field(
|
31 |
'password_protected_password',
|
32 |
-
'New Password',
|
33 |
array( $this, 'password_protected_password_field' ),
|
34 |
-
|
35 |
'password_protected'
|
36 |
);
|
37 |
-
register_setting(
|
38 |
-
register_setting(
|
|
|
39 |
}
|
40 |
|
41 |
/**
|
@@ -47,14 +68,14 @@ class Password_Protected_Admin {
|
|
47 |
if ( empty( $val['new'] ) ) {
|
48 |
return $old_val;
|
49 |
} elseif ( empty( $val['confirm'] ) ) {
|
50 |
-
add_settings_error( 'password_protected_password', 'password_protected_password', __( 'New password not saved. When setting a new password please enter it in both fields.', '
|
51 |
return $old_val;
|
52 |
} elseif ( $val['new'] != $val['confirm'] ) {
|
53 |
-
add_settings_error( 'password_protected_password', 'password_protected_password', __( 'New password not saved. Password fields did not match.', '
|
54 |
return $old_val;
|
55 |
} elseif ( $val['new'] == $val['confirm'] ) {
|
56 |
-
add_settings_error( 'password_protected_password', 'password_protected_password', __( 'New password saved.', '
|
57 |
-
return
|
58 |
}
|
59 |
return get_option( 'password_protected_password' );
|
60 |
}
|
@@ -65,22 +86,41 @@ class Password_Protected_Admin {
|
|
65 |
* Password Protected Section
|
66 |
*/
|
67 |
function password_protected_settings_section() {
|
68 |
-
echo '<p>' . __( 'Password protect your web site. Users will be asked to enter a password to view the site.', '
|
69 |
}
|
70 |
|
71 |
/**
|
72 |
* Password Protection Status Field
|
73 |
*/
|
74 |
function password_protected_status_field() {
|
75 |
-
echo '<input name="password_protected_status" id="password_protected_status" type="checkbox" value="1" ' . checked( 1, get_option( 'password_protected_status' ), false ) . ' /> ' . __( 'Enabled', '
|
|
|
76 |
}
|
77 |
|
78 |
/**
|
79 |
* Password Field
|
80 |
*/
|
81 |
function password_protected_password_field() {
|
82 |
-
echo '<input type="password" name="password_protected_password[new]" id="password_protected_password_new" size="16" value="" autocomplete="off"> <span class="description">' . __( 'If you would like to change the password type a new one. Otherwise leave this blank.', '
|
83 |
-
<input type="password" name="password_protected_password[confirm]" id="password_protected_password_confirm" size="16" value="" autocomplete="off"> <span class="description">' . __( 'Type your new password again.', '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
}
|
85 |
|
86 |
/**
|
@@ -89,11 +129,11 @@ class Password_Protected_Admin {
|
|
89 |
*/
|
90 |
function password_protected_admin_notices(){
|
91 |
global $current_screen;
|
92 |
-
if ( $current_screen->id == 'options-
|
93 |
$status = get_option( 'password_protected_status' );
|
94 |
$pwd = get_option( 'password_protected_password' );
|
95 |
if ( (bool) $status && empty( $pwd ) ) {
|
96 |
-
echo '<div class="error"><p>' . __( 'You have enabled password protection but not yet set a password. Please set one below.', '
|
97 |
}
|
98 |
}
|
99 |
}
|
2 |
|
3 |
class Password_Protected_Admin {
|
4 |
|
5 |
+
var $options_group = 'reading';
|
6 |
+
|
7 |
/**
|
8 |
* Constructor
|
9 |
*/
|
10 |
function Password_Protected_Admin() {
|
11 |
+
global $wp_version;
|
12 |
add_action( 'admin_init', array( $this, 'privacy_settings' ) );
|
13 |
add_action( 'admin_notices', array( $this, 'password_protected_admin_notices' ) );
|
14 |
+
add_filter( 'pre_update_option_password_protected_password', array( $this, 'pre_update_option_password_protected_password' ), 10, 2 );
|
15 |
+
add_filter( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
|
16 |
+
|
17 |
+
// Pre WordPress 3.5 settings group compatibility
|
18 |
+
if ( version_compare( $wp_version, '3.5.dev', '<' ) ) {
|
19 |
+
$this->options_group = 'privacy';
|
20 |
+
}
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Admin Enqueue Scripts
|
25 |
+
*/
|
26 |
+
function admin_enqueue_scripts() {
|
27 |
+
global $current_screen;
|
28 |
+
if ( 'options-' . $this->options_group == $current_screen->id ) {
|
29 |
+
wp_enqueue_script( 'password_protected_settings', PASSWORD_PROTECTED_URL . '/admin/js/settings.js', array( 'jquery' ) );
|
30 |
+
}
|
31 |
}
|
32 |
|
33 |
/**
|
36 |
function privacy_settings() {
|
37 |
add_settings_section(
|
38 |
'password_protected',
|
39 |
+
__( 'Password Protected Settings', 'password-protected' ),
|
40 |
array( $this, 'password_protected_settings_section' ),
|
41 |
+
$this->options_group
|
42 |
);
|
43 |
add_settings_field(
|
44 |
'password_protected_status',
|
45 |
+
__( 'Password Protected Status', 'password-protected' ),
|
46 |
array( $this, 'password_protected_status_field' ),
|
47 |
+
$this->options_group,
|
48 |
'password_protected'
|
49 |
);
|
50 |
add_settings_field(
|
51 |
'password_protected_password',
|
52 |
+
__( 'New Password', 'password-protected' ),
|
53 |
array( $this, 'password_protected_password_field' ),
|
54 |
+
$this->options_group,
|
55 |
'password_protected'
|
56 |
);
|
57 |
+
register_setting( $this->options_group, 'password_protected_status', 'intval' );
|
58 |
+
register_setting( $this->options_group, 'password_protected_password', array( $this, 'sanitize_password_protected_password' ) );
|
59 |
+
register_setting( $this->options_group, 'password_protected_feeds', 'intval' );
|
60 |
}
|
61 |
|
62 |
/**
|
68 |
if ( empty( $val['new'] ) ) {
|
69 |
return $old_val;
|
70 |
} elseif ( empty( $val['confirm'] ) ) {
|
71 |
+
add_settings_error( 'password_protected_password', 'password_protected_password', __( 'New password not saved. When setting a new password please enter it in both fields.', 'password-protected' ) );
|
72 |
return $old_val;
|
73 |
} elseif ( $val['new'] != $val['confirm'] ) {
|
74 |
+
add_settings_error( 'password_protected_password', 'password_protected_password', __( 'New password not saved. Password fields did not match.', 'password-protected' ) );
|
75 |
return $old_val;
|
76 |
} elseif ( $val['new'] == $val['confirm'] ) {
|
77 |
+
add_settings_error( 'password_protected_password', 'password_protected_password', __( 'New password saved.', 'password-protected' ), 'updated' );
|
78 |
+
return $val['new'];
|
79 |
}
|
80 |
return get_option( 'password_protected_password' );
|
81 |
}
|
86 |
* Password Protected Section
|
87 |
*/
|
88 |
function password_protected_settings_section() {
|
89 |
+
echo '<p>' . __( 'Password protect your web site. Users will be asked to enter a password to view the site.', 'password-protected' ) . '</p>';
|
90 |
}
|
91 |
|
92 |
/**
|
93 |
* Password Protection Status Field
|
94 |
*/
|
95 |
function password_protected_status_field() {
|
96 |
+
echo '<input name="password_protected_status" id="password_protected_status" type="checkbox" value="1" ' . checked( 1, get_option( 'password_protected_status' ), false ) . ' /> ' . __( 'Enabled', 'password-protected' );
|
97 |
+
echo '<input name="password_protected_feeds" id="password_protected_feeds" type="checkbox" value="1" ' . checked( 1, get_option( 'password_protected_feeds' ), false ) . ' style="margin-left: 20px;" /> ' . __( 'Allow Feeds', 'password-protected' );
|
98 |
}
|
99 |
|
100 |
/**
|
101 |
* Password Field
|
102 |
*/
|
103 |
function password_protected_password_field() {
|
104 |
+
echo '<input type="password" name="password_protected_password[new]" id="password_protected_password_new" size="16" value="" autocomplete="off"> <span class="description">' . __( 'If you would like to change the password type a new one. Otherwise leave this blank.', 'password-protected' ) . '</span><br>
|
105 |
+
<input type="password" name="password_protected_password[confirm]" id="password_protected_password_confirm" size="16" value="" autocomplete="off"> <span class="description">' . __( 'Type your new password again.', 'password-protected' ) . '</span>';
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Pre-update 'password_protected_password' Option
|
110 |
+
*
|
111 |
+
* Before the password is saved, MD5 it!
|
112 |
+
* Doing it in this way allows developers to intercept with an earlier filter if they
|
113 |
+
* need to do something with the plaintext password.
|
114 |
+
*
|
115 |
+
* @param string $newvalue New Value.
|
116 |
+
* @param string $oldvalue Old Value.
|
117 |
+
* @return string Filtered new value.
|
118 |
+
*/
|
119 |
+
function pre_update_option_password_protected_password( $newvalue, $oldvalue ) {
|
120 |
+
if ( $newvalue != $oldvalue ) {
|
121 |
+
$newvalue = md5( $newvalue );
|
122 |
+
}
|
123 |
+
return $newvalue;
|
124 |
}
|
125 |
|
126 |
/**
|
129 |
*/
|
130 |
function password_protected_admin_notices(){
|
131 |
global $current_screen;
|
132 |
+
if ( $current_screen->id == 'options-' . $this->options_group ) {
|
133 |
$status = get_option( 'password_protected_status' );
|
134 |
$pwd = get_option( 'password_protected_password' );
|
135 |
if ( (bool) $status && empty( $pwd ) ) {
|
136 |
+
echo '<div class="error"><p>' . __( 'You have enabled password protection but not yet set a password. Please set one below.', 'password-protected' ) . '</p></div>';
|
137 |
}
|
138 |
}
|
139 |
}
|
admin/js/settings.js
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
jQuery(document).ready( function($) {
|
3 |
+
|
4 |
+
// Disable 'Allow Feeds' Checkbox
|
5 |
+
$('input#password_protected_status').change(function(e){
|
6 |
+
if ($(this).attr('checked') == 'checked') {
|
7 |
+
$('input#password_protected_feeds').removeAttr('disabled');
|
8 |
+
} else {
|
9 |
+
$('input#password_protected_feeds').attr('disabled', 'disabled');
|
10 |
+
}
|
11 |
+
}).trigger('change');
|
12 |
+
|
13 |
+
});
|
password-protected.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
Plugin Name: Password Protected
|
5 |
Plugin URI: http://www.benhuson.co.uk/
|
6 |
Description: A very simple way to quickly password protect your WordPress site with a single password. Integrates seamlessly into your WordPress privacy settings.
|
7 |
-
Version: 1.
|
8 |
Author: Ben Huson
|
9 |
Author URI: http://www.benhuson.co.uk/
|
10 |
License: GPLv2
|
@@ -27,13 +27,20 @@ along with this program; if not, write to the Free Software
|
|
27 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
28 |
*/
|
29 |
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
global $Password_Protected;
|
32 |
$Password_Protected = new Password_Protected();
|
33 |
|
34 |
class Password_Protected {
|
35 |
|
36 |
-
var $version = '1.
|
37 |
var $admin = null;
|
38 |
var $errors = null;
|
39 |
|
@@ -43,15 +50,24 @@ class Password_Protected {
|
|
43 |
function Password_Protected() {
|
44 |
$this->errors = new WP_Error();
|
45 |
register_activation_hook( __FILE__, array( &$this, 'install' ) );
|
|
|
46 |
add_action( 'init', array( $this, 'maybe_process_login' ), 1 );
|
|
|
47 |
add_action( 'template_redirect', array( $this, 'maybe_show_login' ), 1 );
|
48 |
-
$this
|
49 |
if ( is_admin() ) {
|
50 |
include_once( dirname( __FILE__ ) . '/admin/admin.php' );
|
51 |
$this->admin = new Password_Protected_Admin();
|
52 |
}
|
53 |
}
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
/**
|
56 |
* Is Active?
|
57 |
*/
|
@@ -81,7 +97,16 @@ class Password_Protected {
|
|
81 |
* @todo Make Translatable
|
82 |
*/
|
83 |
function disable_feed() {
|
84 |
-
wp_die( __( 'Feeds are not available for this site. Please visit the <a href="'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
}
|
86 |
|
87 |
/**
|
@@ -92,7 +117,7 @@ class Password_Protected {
|
|
92 |
$password_protected_pwd = $_REQUEST['password_protected_pwd'];
|
93 |
$pwd = get_option( 'password_protected_password' );
|
94 |
// If correct password...
|
95 |
-
if ( md5( $password_protected_pwd ) == $pwd && $pwd != '' ) {
|
96 |
$this->set_auth_cookie();
|
97 |
if ( ! empty( $_REQUEST['redirect_to'] ) ) {
|
98 |
wp_redirect( $_REQUEST['redirect_to'] );
|
@@ -101,7 +126,7 @@ class Password_Protected {
|
|
101 |
} else {
|
102 |
// ... otherwise incorrect password
|
103 |
$this->clear_auth_cookie();
|
104 |
-
$this->errors->add( 'incorrect_password', 'Incorrect Password' );
|
105 |
}
|
106 |
}
|
107 |
|
4 |
Plugin Name: Password Protected
|
5 |
Plugin URI: http://www.benhuson.co.uk/
|
6 |
Description: A very simple way to quickly password protect your WordPress site with a single password. Integrates seamlessly into your WordPress privacy settings.
|
7 |
+
Version: 1.3
|
8 |
Author: Ben Huson
|
9 |
Author URI: http://www.benhuson.co.uk/
|
10 |
License: GPLv2
|
27 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
28 |
*/
|
29 |
|
30 |
+
/**
|
31 |
+
* @todo Use wp_hash_password() ?
|
32 |
+
*/
|
33 |
+
|
34 |
+
define( 'PASSWORD_PROTECTED_SUBDIR', '/' . str_replace( basename( __FILE__ ), '', plugin_basename( __FILE__ ) ) );
|
35 |
+
define( 'PASSWORD_PROTECTED_URL', plugins_url( PASSWORD_PROTECTED_SUBDIR ) );
|
36 |
+
define( 'PASSWORD_PROTECTED_DIR', plugin_dir_path( __FILE__ ) );
|
37 |
+
|
38 |
global $Password_Protected;
|
39 |
$Password_Protected = new Password_Protected();
|
40 |
|
41 |
class Password_Protected {
|
42 |
|
43 |
+
var $version = '1.3';
|
44 |
var $admin = null;
|
45 |
var $errors = null;
|
46 |
|
50 |
function Password_Protected() {
|
51 |
$this->errors = new WP_Error();
|
52 |
register_activation_hook( __FILE__, array( &$this, 'install' ) );
|
53 |
+
add_action( 'plugins_loaded', array( $this, 'load_plugin_textdomain' ) );
|
54 |
add_action( 'init', array( $this, 'maybe_process_login' ), 1 );
|
55 |
+
add_action( 'wp', array( $this, 'disable_feeds' ) );
|
56 |
add_action( 'template_redirect', array( $this, 'maybe_show_login' ), 1 );
|
57 |
+
add_filter( 'pre_option_password_protected_status', array( $this, 'allow_feeds' ) );
|
58 |
if ( is_admin() ) {
|
59 |
include_once( dirname( __FILE__ ) . '/admin/admin.php' );
|
60 |
$this->admin = new Password_Protected_Admin();
|
61 |
}
|
62 |
}
|
63 |
|
64 |
+
/**
|
65 |
+
* I18n
|
66 |
+
*/
|
67 |
+
function load_plugin_textdomain() {
|
68 |
+
load_plugin_textdomain( 'password-protected', false, basename( dirname( __FILE__ ) ) . '/languages' );
|
69 |
+
}
|
70 |
+
|
71 |
/**
|
72 |
* Is Active?
|
73 |
*/
|
97 |
* @todo Make Translatable
|
98 |
*/
|
99 |
function disable_feed() {
|
100 |
+
wp_die( sprintf( __( 'Feeds are not available for this site. Please visit the <a href="%s">website</a>.', 'password-protected' ), get_bloginfo( 'url' ) ) );
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Allow Feeds
|
105 |
+
*/
|
106 |
+
function allow_feeds( $bool ) {
|
107 |
+
if ( is_feed() && (bool) get_option( 'password_protected_feeds' ) )
|
108 |
+
return 0;
|
109 |
+
return $bool;
|
110 |
}
|
111 |
|
112 |
/**
|
117 |
$password_protected_pwd = $_REQUEST['password_protected_pwd'];
|
118 |
$pwd = get_option( 'password_protected_password' );
|
119 |
// If correct password...
|
120 |
+
if ( ( md5( $password_protected_pwd ) == $pwd && $pwd != '' ) || apply_filters( 'password_protected_process_login', false, $password_protected_pwd ) ) {
|
121 |
$this->set_auth_cookie();
|
122 |
if ( ! empty( $_REQUEST['redirect_to'] ) ) {
|
123 |
wp_redirect( $_REQUEST['redirect_to'] );
|
126 |
} else {
|
127 |
// ... otherwise incorrect password
|
128 |
$this->clear_auth_cookie();
|
129 |
+
$this->errors->add( 'incorrect_password', __( 'Incorrect Password', 'password-protected' ) );
|
130 |
}
|
131 |
}
|
132 |
|
readme.txt
CHANGED
@@ -3,8 +3,9 @@ Contributors: husobj
|
|
3 |
Donate link: http://www.benhuson.co.uk/donate/
|
4 |
Tags: password, protect, password protect, login
|
5 |
Requires at least: 3.0
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 1.
|
|
|
8 |
|
9 |
A very simple way to quickly password protect your WordPress site with a single password. Integrates seamlessly into your WordPress privacy settings.
|
10 |
|
@@ -36,6 +37,10 @@ If you are upgrading manually via FTP rather that through the WordPress automati
|
|
36 |
|
37 |
Install and configure the [Login Logo](http://wordpress.org/extend/plugins/login-logo/) plugin by Mark Jaquith. This will change the logo on your password entry page AND also your admin login page.
|
38 |
|
|
|
|
|
|
|
|
|
39 |
= How can I log out? =
|
40 |
|
41 |
Just add a "password-protected=logout" query to your URL.
|
@@ -57,6 +62,15 @@ If you can, please [fork the code](https://github.com/benhuson/password-protecte
|
|
57 |
|
58 |
== Changelog ==
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
= 1.2.2 =
|
61 |
|
62 |
* Escape 'redirect_to' attribute. Props A. Alagha.
|
@@ -78,3 +92,14 @@ If you can, please [fork the code](https://github.com/benhuson/password-protecte
|
|
78 |
= 1.0 =
|
79 |
|
80 |
* First Release. If you spot any bugs or issues please [log them here](https://github.com/benhuson/password-protected/issues).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
Donate link: http://www.benhuson.co.uk/donate/
|
4 |
Tags: password, protect, password protect, login
|
5 |
Requires at least: 3.0
|
6 |
+
Tested up to: 3.4.2
|
7 |
+
Stable tag: 1.3
|
8 |
+
License: GPLv2 or later
|
9 |
|
10 |
A very simple way to quickly password protect your WordPress site with a single password. Integrates seamlessly into your WordPress privacy settings.
|
11 |
|
37 |
|
38 |
Install and configure the [Login Logo](http://wordpress.org/extend/plugins/login-logo/) plugin by Mark Jaquith. This will change the logo on your password entry page AND also your admin login page.
|
39 |
|
40 |
+
= How can I enable feeds while the site is password protected? =
|
41 |
+
|
42 |
+
In the settings, check the 'Allow Feeds' checkbox.
|
43 |
+
|
44 |
= How can I log out? =
|
45 |
|
46 |
Just add a "password-protected=logout" query to your URL.
|
62 |
|
63 |
== Changelog ==
|
64 |
|
65 |
+
= 1.3 =
|
66 |
+
|
67 |
+
* Added checkbox to allow access to feeds when protection is enabled.
|
68 |
+
* Prepare for WordPress 3.5 Settings API changes.
|
69 |
+
* Added 'password_protected_before_login_form' and 'password_protected_after_login_form' actions.
|
70 |
+
* Added 'password_protected_process_login' filter to make it possible to extend login functionality.
|
71 |
+
* Now possible to use 'pre_update_option_password_protected_password' filter to use password before it is encrypted and saved.
|
72 |
+
* Ready for [translations](http://codex.wordpress.org/I18n_for_WordPress_Developers).
|
73 |
+
|
74 |
= 1.2.2 =
|
75 |
|
76 |
* Escape 'redirect_to' attribute. Props A. Alagha.
|
92 |
= 1.0 =
|
93 |
|
94 |
* First Release. If you spot any bugs or issues please [log them here](https://github.com/benhuson/password-protected/issues).
|
95 |
+
|
96 |
+
== Upgrade Notice ==
|
97 |
+
|
98 |
+
= 1.3 =
|
99 |
+
Allow access to feeds. Ready for translation.
|
100 |
+
|
101 |
+
= 1.2 =
|
102 |
+
Use cookies instead of sessions.
|
103 |
+
|
104 |
+
= 1.1 =
|
105 |
+
Passwords saved encrypted.
|
screenshot-1.png
DELETED
Binary file
|
screenshot-2.png
DELETED
Binary file
|
theme/login.php
CHANGED
@@ -37,7 +37,7 @@ if ( SITECOOKIEPATH != COOKIEPATH )
|
|
37 |
|
38 |
// If cookies are disabled we can't log in even with a valid password.
|
39 |
if ( isset( $_POST['testcookie'] ) && empty( $_COOKIE[TEST_COOKIE] ) )
|
40 |
-
$Password_Protected->errors->add( 'test_cookie', __( "<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress." ) );
|
41 |
|
42 |
// Shake it!
|
43 |
$shake_error_codes = array( 'empty_password', 'incorrect_password' );
|
@@ -106,23 +106,27 @@ do_action( 'password_protected_login_head' );
|
|
106 |
echo '<p class="message">' . apply_filters( 'password_protected_login_messages', $messages ) . "</p>\n";
|
107 |
}
|
108 |
?>
|
109 |
-
|
|
|
|
|
110 |
<form name="loginform" id="loginform" action="<?php echo esc_url( home_url( '/' ) ); ?>" method="post">
|
111 |
<p>
|
112 |
-
<label for="password_protected_pass"><?php _e( 'Password' ) ?><br />
|
113 |
<input type="password" name="password_protected_pwd" id="password_protected_pass" class="input" value="" size="20" tabindex="20" /></label>
|
114 |
</p>
|
115 |
<!--
|
116 |
-
<p class="forgetmenot"><label for="rememberme"><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="90"<?php checked( ! empty( $_POST['rememberme'] ) ); ?> /> <?php esc_attr_e( 'Remember Me' ); ?></label></p>
|
117 |
-->
|
118 |
<p class="submit">
|
119 |
-
<input type="submit" name="wp-submit" id="wp-submit" class="button-primary" value="<?php esc_attr_e( 'Log In' ); ?>" tabindex="100" />
|
120 |
<input type="hidden" name="testcookie" value="1" />
|
121 |
<input type="hidden" name="password-protected" value="login" />
|
122 |
<input type="hidden" name="redirect_to" value="<?php echo esc_attr( $_REQUEST['redirect_to'] ); ?>" />
|
123 |
</p>
|
124 |
</form>
|
125 |
-
|
|
|
|
|
126 |
</div>
|
127 |
|
128 |
<script type="text/javascript">
|
37 |
|
38 |
// If cookies are disabled we can't log in even with a valid password.
|
39 |
if ( isset( $_POST['testcookie'] ) && empty( $_COOKIE[TEST_COOKIE] ) )
|
40 |
+
$Password_Protected->errors->add( 'test_cookie', __( "<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress.", 'password-protected' ) );
|
41 |
|
42 |
// Shake it!
|
43 |
$shake_error_codes = array( 'empty_password', 'incorrect_password' );
|
106 |
echo '<p class="message">' . apply_filters( 'password_protected_login_messages', $messages ) . "</p>\n";
|
107 |
}
|
108 |
?>
|
109 |
+
|
110 |
+
<?php do_action( 'password_protected_before_login_form' ); ?>
|
111 |
+
|
112 |
<form name="loginform" id="loginform" action="<?php echo esc_url( home_url( '/' ) ); ?>" method="post">
|
113 |
<p>
|
114 |
+
<label for="password_protected_pass"><?php _e( 'Password', 'password-protected' ) ?><br />
|
115 |
<input type="password" name="password_protected_pwd" id="password_protected_pass" class="input" value="" size="20" tabindex="20" /></label>
|
116 |
</p>
|
117 |
<!--
|
118 |
+
<p class="forgetmenot"><label for="rememberme"><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="90"<?php checked( ! empty( $_POST['rememberme'] ) ); ?> /> <?php esc_attr_e( 'Remember Me', 'password-protected' ); ?></label></p>
|
119 |
-->
|
120 |
<p class="submit">
|
121 |
+
<input type="submit" name="wp-submit" id="wp-submit" class="button-primary" value="<?php esc_attr_e( 'Log In', 'password-protected' ); ?>" tabindex="100" />
|
122 |
<input type="hidden" name="testcookie" value="1" />
|
123 |
<input type="hidden" name="password-protected" value="login" />
|
124 |
<input type="hidden" name="redirect_to" value="<?php echo esc_attr( $_REQUEST['redirect_to'] ); ?>" />
|
125 |
</p>
|
126 |
</form>
|
127 |
+
|
128 |
+
<?php do_action( 'password_protected_after_login_form' ); ?>
|
129 |
+
|
130 |
</div>
|
131 |
|
132 |
<script type="text/javascript">
|