Version Description
- Encrypt passwords in database.
Download this release
Release Info
Developer | husobj |
Plugin | Password Protected |
Version | 1.1 |
Comparing to | |
See all releases |
Code changes from version 1.0 to 1.1
- admin/admin.php +15 -12
- password-protected.php +24 -4
- readme.txt +9 -1
admin/admin.php
CHANGED
@@ -43,19 +43,22 @@ class Password_Protected_Admin {
|
|
43 |
*/
|
44 |
function sanitize_password_protected_password( $val ) {
|
45 |
$old_val = get_option( 'password_protected_password' );
|
46 |
-
if (
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
|
|
|
|
|
|
57 |
}
|
58 |
-
return
|
59 |
}
|
60 |
|
61 |
/**
|
43 |
*/
|
44 |
function sanitize_password_protected_password( $val ) {
|
45 |
$old_val = get_option( 'password_protected_password' );
|
46 |
+
if ( is_array( $val ) ) {
|
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.', 'password_protected' ) );
|
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.', 'password_protected' ) );
|
54 |
+
return $old_val;
|
55 |
+
} elseif ( $val['new'] == $val['confirm'] ) {
|
56 |
+
add_settings_error( 'password_protected_password', 'password_protected_password', __( 'New password saved.', 'password_protected' ), 'updated' );
|
57 |
+
return md5( $val['new'] );
|
58 |
+
}
|
59 |
+
return get_option( 'password_protected_password' );
|
60 |
}
|
61 |
+
return $val;
|
62 |
}
|
63 |
|
64 |
/**
|
password-protected.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
Plugin Name: Password Protected
|
5 |
Plugin URI: http://www.benhuson.co.uk/
|
6 |
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
|
@@ -37,14 +37,16 @@ $Password_Protected = new Password_Protected();
|
|
37 |
|
38 |
class Password_Protected {
|
39 |
|
40 |
-
var $
|
41 |
-
var $
|
|
|
42 |
|
43 |
/**
|
44 |
* Constructor
|
45 |
*/
|
46 |
function Password_Protected() {
|
47 |
$this->errors = new WP_Error();
|
|
|
48 |
add_action( 'init', array( $this, 'maybe_process_login' ), 1 );
|
49 |
add_action( 'template_redirect', array( $this, 'maybe_show_login' ), 1 );
|
50 |
$this->disable_feeds();
|
@@ -90,7 +92,7 @@ class Password_Protected {
|
|
90 |
$password_protected_pwd = $_REQUEST['password_protected_pwd'];
|
91 |
$pwd = get_option( 'password_protected_password' );
|
92 |
// If correct password...
|
93 |
-
if ( $password_protected_pwd == $pwd && $pwd != '' ) {
|
94 |
$_SESSION[$this->get_site_id() . '_password_protected_auth'] = 1;
|
95 |
} else {
|
96 |
// ... otherwise incorrect password
|
@@ -130,6 +132,24 @@ class Password_Protected {
|
|
130 |
global $blog_id;
|
131 |
return apply_filters( 'password_protected_blog_id', $blog_id );
|
132 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
|
134 |
}
|
135 |
|
4 |
Plugin Name: Password Protected
|
5 |
Plugin URI: http://www.benhuson.co.uk/
|
6 |
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.1
|
8 |
Author: Ben Huson
|
9 |
Author URI: http://www.benhuson.co.uk/
|
10 |
License: GPLv2
|
37 |
|
38 |
class Password_Protected {
|
39 |
|
40 |
+
var $version = '1.1';
|
41 |
+
var $admin = null;
|
42 |
+
var $errors = null;
|
43 |
|
44 |
/**
|
45 |
* Constructor
|
46 |
*/
|
47 |
function Password_Protected() {
|
48 |
$this->errors = new WP_Error();
|
49 |
+
register_activation_hook( __FILE__, array( &$this, 'install' ) );
|
50 |
add_action( 'init', array( $this, 'maybe_process_login' ), 1 );
|
51 |
add_action( 'template_redirect', array( $this, 'maybe_show_login' ), 1 );
|
52 |
$this->disable_feeds();
|
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 |
$_SESSION[$this->get_site_id() . '_password_protected_auth'] = 1;
|
97 |
} else {
|
98 |
// ... otherwise incorrect password
|
132 |
global $blog_id;
|
133 |
return apply_filters( 'password_protected_blog_id', $blog_id );
|
134 |
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Install
|
138 |
+
*/
|
139 |
+
function install() {
|
140 |
+
$old_version = get_option( 'password_protected_version' );
|
141 |
+
|
142 |
+
// 1.1 - Upgrade to MD5
|
143 |
+
if ( empty( $old_version ) || version_compare( '1.1', $old_version ) ) {
|
144 |
+
$pwd = get_option( 'password_protected_password' );
|
145 |
+
if ( ! empty( $pwd ) ) {
|
146 |
+
$new_pwd = md5( $pwd );
|
147 |
+
update_option( 'password_protected_password', $new_pwd );
|
148 |
+
}
|
149 |
+
}
|
150 |
+
|
151 |
+
update_option( 'password_protected_version', $this->version );
|
152 |
+
}
|
153 |
|
154 |
}
|
155 |
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ 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.3.1
|
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 |
|
@@ -26,6 +26,10 @@ To install and configure this plugin...
|
|
26 |
2. Activate the plugin via the 'Plugins' admin menu.
|
27 |
3. Configuration the password in your WordPress Privacy settings.
|
28 |
|
|
|
|
|
|
|
|
|
29 |
== Frequently Asked Questions ==
|
30 |
|
31 |
= How can I change the Wordpress logo to a different image? =
|
@@ -48,6 +52,10 @@ If you can, please [fork the code](https://github.com/benhuson/password-protecte
|
|
48 |
|
49 |
== Changelog ==
|
50 |
|
|
|
|
|
|
|
|
|
51 |
= 1.0 =
|
52 |
|
53 |
* First Release. If you spot any bugs or issues please [log them here](https://github.com/benhuson/password-protected/issues).
|
4 |
Tags: password, protect, password protect, login
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.3.1
|
7 |
+
Stable tag: 1.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 |
|
26 |
2. Activate the plugin via the 'Plugins' admin menu.
|
27 |
3. Configuration the password in your WordPress Privacy settings.
|
28 |
|
29 |
+
= Upgrading =
|
30 |
+
|
31 |
+
If you are upgrading manually via FTP rather that through the WordPress automatic upgrade link, please de-activate and re-activate the plugin to ensure the plugin upgrades correctly.
|
32 |
+
|
33 |
== Frequently Asked Questions ==
|
34 |
|
35 |
= How can I change the Wordpress logo to a different image? =
|
52 |
|
53 |
== Changelog ==
|
54 |
|
55 |
+
= 1.1 =
|
56 |
+
|
57 |
+
* Encrypt passwords in database.
|
58 |
+
|
59 |
= 1.0 =
|
60 |
|
61 |
* First Release. If you spot any bugs or issues please [log them here](https://github.com/benhuson/password-protected/issues).
|