Version Description
- 2017-09-08 =
- New Feature: Custom Password Field on Registration Form.
- New Feature: Should be Login with Username and/or Email Address.
- Enhancement: LoginPress Customization array in configuration. "Help Page"
- Bugfix: array_key_exists(); on installation.
Download this release
Release Info
Developer | hiddenpearls |
Plugin | Custom Login Page Customizer | LoginPress |
Version | 1.0.22 |
Comparing to | |
See all releases |
Code changes from version 1.0.21 to 1.0.22
- classes/class-loginpress-custom-password.php +117 -0
- classes/class-loginpress-email.php +0 -101
- classes/class-loginpress-log.php +4 -3
- classes/class-loginpress-login-order.php +139 -0
- classes/class-loginpress-setup.php +22 -9
- css/style-login.php +6 -2
- custom.php +4 -4
- include/compatibility.php +43 -0
- loginpress.php +29 -32
- readme.txt +9 -3
classes/class-loginpress-custom-password.php
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* LoginPresss_Custom_Password
|
4 |
+
*
|
5 |
+
* Description: Enable Custom Password for Register User.
|
6 |
+
*
|
7 |
+
* @package LoginPress
|
8 |
+
* @since 1.0.22
|
9 |
+
*/
|
10 |
+
|
11 |
+
if ( ! class_exists( 'LoginPresss_Custom_Password' ) ) :
|
12 |
+
/**
|
13 |
+
* LoginPress Custom Passwords class
|
14 |
+
*
|
15 |
+
* @since 1.0.22
|
16 |
+
*/
|
17 |
+
class LoginPresss_Custom_Password {
|
18 |
+
|
19 |
+
/* * * * * * * * * *
|
20 |
+
* Class constructor
|
21 |
+
* * * * * * * * * */
|
22 |
+
public function __construct() {
|
23 |
+
|
24 |
+
$this->_hooks();
|
25 |
+
}
|
26 |
+
|
27 |
+
public function _hooks() {
|
28 |
+
|
29 |
+
add_action( 'register_form', array( $this, 'loginpress_reg_password_fields' ) );
|
30 |
+
add_filter( 'registration_errors', array( $this, 'loginpress_reg_pass_errors' ), 10, 3 );
|
31 |
+
add_filter( 'random_password', array( $this, 'loginpress_set_password' ) );
|
32 |
+
add_action( 'register_new_user', array( $this, 'update_default_password_nag' ) );
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Custom Password Fields on Registration Form.
|
37 |
+
*
|
38 |
+
* @since 1.0.22
|
39 |
+
* @access public
|
40 |
+
* @return string html.
|
41 |
+
*/
|
42 |
+
public function loginpress_reg_password_fields() {
|
43 |
+
?>
|
44 |
+
<p class="loginpress-reg-pass-wrap">
|
45 |
+
<label for="loginpress-reg-pass"><?php _e( 'Password', 'loginpress' ); ?></label>
|
46 |
+
<input autocomplete="off" name="loginpress-reg-pass" id="loginpress-reg-pass" class="input" size="20" value="" type="password" />
|
47 |
+
</p>
|
48 |
+
<p class="loginpress-reg-pass-2-wrap">
|
49 |
+
<label for="loginpress-reg-pass-2"><?php _e( 'Confirm Password', 'loginpress' ); ?></label>
|
50 |
+
<input autocomplete="off" name="loginpress-reg-pass-2" id="loginpress-reg-pass-2" class="input" size="20" value="" type="password" />
|
51 |
+
</p>
|
52 |
+
<?php
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Handles password field errors for registration form.
|
57 |
+
*
|
58 |
+
* @since 1.0.22
|
59 |
+
* @access public
|
60 |
+
*
|
61 |
+
* @param Object $errors WP_Error
|
62 |
+
* @param Object $sanitized_user_login user login.
|
63 |
+
* @param Object $user_email user email.
|
64 |
+
* @return WP_Error object.
|
65 |
+
*/
|
66 |
+
public function loginpress_reg_pass_errors( $errors, $sanitized_user_login, $user_email ) {
|
67 |
+
|
68 |
+
// Ensure passwords aren't empty.
|
69 |
+
if ( empty( $_POST['loginpress-reg-pass'] ) || empty( $_POST['loginpress-reg-pass-2'] ) ) {
|
70 |
+
$errors->add( 'empty_password', __( '<strong>ERROR</strong>: Please enter your password twice.', 'loginpress' ) );
|
71 |
+
|
72 |
+
// Ensure passwords are matched.
|
73 |
+
} elseif ( $_POST['loginpress-reg-pass'] != $_POST['loginpress-reg-pass-2'] ) {
|
74 |
+
$errors->add( 'password_mismatch', __( '<strong>ERROR</strong>: Please enter the same password in the end password fields.', 'loginpress' ) );
|
75 |
+
|
76 |
+
// Password Set? assign password to a user_pass
|
77 |
+
} else {
|
78 |
+
$_POST['user_pass'] = $_POST['loginpress-reg-pass'];
|
79 |
+
}
|
80 |
+
|
81 |
+
return $errors;
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Let's set the user password.
|
86 |
+
*
|
87 |
+
* @since 1.0.22
|
88 |
+
* @access public
|
89 |
+
* @param string $password Auto-generated password passed in from filter.
|
90 |
+
* @return string Password Choose by User.
|
91 |
+
*/
|
92 |
+
public function loginpress_set_password( $password ) {
|
93 |
+
|
94 |
+
// Make sure password field isn't empty.
|
95 |
+
if ( ! empty( $_POST['user_pass'] ) ) {
|
96 |
+
$password = $_POST['user_pass'];
|
97 |
+
}
|
98 |
+
|
99 |
+
return $password;
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Sets the value of default password nag.
|
104 |
+
*
|
105 |
+
* @since 1.0.22
|
106 |
+
* @access public
|
107 |
+
* @param int $user_id.
|
108 |
+
*/
|
109 |
+
public function update_default_password_nag( $user_id ) {
|
110 |
+
|
111 |
+
// False => User not using WordPress default password.
|
112 |
+
update_user_meta( $user_id, 'default_password_nag', false );
|
113 |
+
}
|
114 |
+
|
115 |
+
} // End Of Class.
|
116 |
+
|
117 |
+
endif;
|
classes/class-loginpress-email.php
DELETED
@@ -1,101 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* LoginPress_Email_Auth.
|
5 |
-
*
|
6 |
-
* @description Login user with email address only instead username.
|
7 |
-
* @since 1.0.18
|
8 |
-
*/
|
9 |
-
|
10 |
-
if ( ! class_exists( 'LoginPress_Email_Auth' ) ) :
|
11 |
-
|
12 |
-
class LoginPress_Email_Auth {
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Variable that Check for LoginPress Key.
|
16 |
-
* @access public
|
17 |
-
* @var string
|
18 |
-
*/
|
19 |
-
public $loginpress_key;
|
20 |
-
|
21 |
-
/* * * * * * * * * *
|
22 |
-
* Class constructor
|
23 |
-
* * * * * * * * * */
|
24 |
-
public function __construct() {
|
25 |
-
|
26 |
-
$this->loginpress_key = get_option( 'loginpress_customization' );
|
27 |
-
$this->_hooks();
|
28 |
-
}
|
29 |
-
|
30 |
-
public function _hooks(){
|
31 |
-
|
32 |
-
remove_filter( 'authenticate', 'wp_authenticate_username_password', 20, 3 );
|
33 |
-
add_filter( 'authenticate', array( $this, 'loginpress_email_login' ), 20, 3 );
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* If an email address is entered in the username field, then look up the matching username and authenticate as per normal, using that.
|
38 |
-
*
|
39 |
-
* @param string $user
|
40 |
-
* @param string $username
|
41 |
-
* @param string $password
|
42 |
-
* @return Results of autheticating via wp_authenticate_username_password(), using the username found when looking up via email.
|
43 |
-
*/
|
44 |
-
function loginpress_email_login( $user, $username, $password ) {
|
45 |
-
|
46 |
-
if ( $user instanceof WP_User ) {
|
47 |
-
return $user;
|
48 |
-
}
|
49 |
-
|
50 |
-
// is username or password foeld is empty.
|
51 |
-
if ( empty($username) || empty($password) ) {
|
52 |
-
|
53 |
-
if ( is_wp_error( $user ) )
|
54 |
-
return $user;
|
55 |
-
|
56 |
-
$error = new WP_Error();
|
57 |
-
|
58 |
-
$empty_username = isset( $this->loginpress_key['empty_username'] ) && ! empty( $this->loginpress_key['empty_username'] ) ? $this->loginpress_key['empty_username'] : sprintf( __( '%1$sError:%2$s The username field is empty.', 'loginpress' ), '<strong>', '</strong>' );
|
59 |
-
|
60 |
-
$empty_password = isset( $this->loginpress_key['empty_password'] ) && ! empty( $this->loginpress_key['empty_password'] ) ? $this->loginpress_key['empty_password'] : sprintf( __( '%1$sError:%2$s The password field is empty.', 'loginpress' ), '<strong>', '</strong>' );
|
61 |
-
|
62 |
-
if ( empty( $username ) )
|
63 |
-
$error->add( 'empty_username', $empty_username );
|
64 |
-
|
65 |
-
if ( empty( $password ) )
|
66 |
-
$error->add( 'empty_password', $empty_password );
|
67 |
-
|
68 |
-
return $error;
|
69 |
-
}
|
70 |
-
|
71 |
-
// if email is not set.
|
72 |
-
if ( ! empty( $username ) && ! is_email( $username ) ) {
|
73 |
-
|
74 |
-
$error = new WP_Error();
|
75 |
-
|
76 |
-
$force_email_login= isset( $this->loginpress_key['force_email_login'] ) && ! empty( $this->loginpress_key['force_email_login'] ) ? $this->loginpress_key['force_email_login'] : sprintf( __( '%1$sError:%2$s Invalid Email Address', 'loginpress' ), '<strong>', '</strong>' );
|
77 |
-
|
78 |
-
$error->add( 'loginpress_use_email', $force_email_login );
|
79 |
-
|
80 |
-
return $error;
|
81 |
-
}
|
82 |
-
|
83 |
-
if ( ! empty( $username ) && is_email( $username ) ) {
|
84 |
-
|
85 |
-
$username = str_replace( '&', '&', stripslashes( $username ) );
|
86 |
-
$user = get_user_by( 'email', $username );
|
87 |
-
|
88 |
-
if ( isset( $user, $user->user_login, $user->user_status ) && 0 === intval( $user->user_status ) )
|
89 |
-
$username = $user->user_login;
|
90 |
-
return wp_authenticate_username_password( null, $username, $password );
|
91 |
-
}
|
92 |
-
|
93 |
-
if ( ! empty( $username ) || ! empty( $password ) ) {
|
94 |
-
return false;
|
95 |
-
} else {
|
96 |
-
return wp_authenticate_username_password( null, "", "" );
|
97 |
-
}
|
98 |
-
}
|
99 |
-
|
100 |
-
} // End Of Class.
|
101 |
-
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/class-loginpress-log.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/**
|
4 |
* Log file to know more about users website environment.
|
5 |
* helps in debugging and providing support.
|
6 |
-
*
|
7 |
* @package LoginPress
|
8 |
* @since 1.0.19
|
9 |
*/
|
@@ -22,7 +22,7 @@ class LoginPress_Log_Info {
|
|
22 |
$loginpress_config = get_option( 'loginpress_customization' );
|
23 |
$session_expiration = ( isset( $loginpress_setting['session_expiration'] ) && '0' != $loginpress_setting['session_expiration'] ) ? $loginpress_setting['session_expiration'] . ' Seconds' : 'Not Set';
|
24 |
$login_with_email = isset( $loginpress_setting['login_with_email'] ) ? $loginpress_setting['login_with_email'] : 'off';
|
25 |
-
$
|
26 |
|
27 |
$html = '### Begin System Info ###' . "\n\n";
|
28 |
|
@@ -42,7 +42,8 @@ class LoginPress_Log_Info {
|
|
42 |
$html .= 'Plugin Version: ' . LOGINPRESS_VERSION . "\n";
|
43 |
$html .= 'Expiration: ' . $session_expiration . "\n";
|
44 |
$html .= 'Force Login with Email: ' . $login_with_email . "\n";
|
45 |
-
$html .= '
|
|
|
46 |
|
47 |
// Pro Plugin Configuration
|
48 |
if ( class_exists( 'LoginPress_Pro' ) ) {
|
3 |
/**
|
4 |
* Log file to know more about users website environment.
|
5 |
* helps in debugging and providing support.
|
6 |
+
*
|
7 |
* @package LoginPress
|
8 |
* @since 1.0.19
|
9 |
*/
|
22 |
$loginpress_config = get_option( 'loginpress_customization' );
|
23 |
$session_expiration = ( isset( $loginpress_setting['session_expiration'] ) && '0' != $loginpress_setting['session_expiration'] ) ? $loginpress_setting['session_expiration'] . ' Seconds' : 'Not Set';
|
24 |
$login_with_email = isset( $loginpress_setting['login_with_email'] ) ? $loginpress_setting['login_with_email'] : 'off';
|
25 |
+
$customization = isset( $loginpress_config ) ? print_r( $loginpress_config, true ) : 'No customization yet';
|
26 |
|
27 |
$html = '### Begin System Info ###' . "\n\n";
|
28 |
|
42 |
$html .= 'Plugin Version: ' . LOGINPRESS_VERSION . "\n";
|
43 |
$html .= 'Expiration: ' . $session_expiration . "\n";
|
44 |
$html .= 'Force Login with Email: ' . $login_with_email . "\n";
|
45 |
+
$html .= 'Total Customized Fields: ' . count( $loginpress_config ) . "\n";
|
46 |
+
$html .= 'Customization Detail: ' . $customization . "\n";
|
47 |
|
48 |
// Pro Plugin Configuration
|
49 |
if ( class_exists( 'LoginPress_Pro' ) ) {
|
classes/class-loginpress-login-order.php
ADDED
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* LoginPress_Login_Order.
|
5 |
+
*
|
6 |
+
* @description Enable user to login using their username and/or email address.
|
7 |
+
* @since 1.0.18
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( ! class_exists( 'LoginPress_Login_Order' ) ) :
|
11 |
+
|
12 |
+
class LoginPress_Login_Order {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Variable that Check for LoginPress Key.
|
16 |
+
* @access public
|
17 |
+
* @var string
|
18 |
+
*/
|
19 |
+
public $loginpress_key;
|
20 |
+
|
21 |
+
/* * * * * * * * * *
|
22 |
+
* Class constructor
|
23 |
+
* * * * * * * * * */
|
24 |
+
public function __construct() {
|
25 |
+
|
26 |
+
$this->loginpress_key = get_option( 'loginpress_customization' );
|
27 |
+
$this->_hooks();
|
28 |
+
}
|
29 |
+
|
30 |
+
public function _hooks(){
|
31 |
+
|
32 |
+
$wp_version = get_bloginfo( 'version' );
|
33 |
+
$loginpress_setting = get_option( 'loginpress_setting' );
|
34 |
+
$login_order = isset( $loginpress_setting['login_order'] ) ? $loginpress_setting['login_order'] : '';
|
35 |
+
|
36 |
+
remove_filter( 'authenticate', 'wp_authenticate_username_password', 20, 3 );
|
37 |
+
add_filter( 'authenticate', array( $this, 'loginpress_login_order' ), 20, 3 );
|
38 |
+
|
39 |
+
if ( 'username' == $login_order && '4.5.0' < $wp_version ) {
|
40 |
+
// For WP 4.5.0 remove email authentication.
|
41 |
+
remove_filter( 'authenticate', 'wp_authenticate_email_password', 20 );
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* If an email address is entered in the username field, then look up the matching username and authenticate as per normal, using that.
|
47 |
+
*
|
48 |
+
* @param string $user
|
49 |
+
* @param string $username
|
50 |
+
* @param string $password
|
51 |
+
* @since 1.0.18
|
52 |
+
* @version 1.0.22
|
53 |
+
* @return Results of autheticating via wp_authenticate_username_password(), using the username found when looking up via email.
|
54 |
+
*/
|
55 |
+
function loginpress_login_order( $user, $username, $password ) {
|
56 |
+
|
57 |
+
if ( $user instanceof WP_User ) {
|
58 |
+
return $user;
|
59 |
+
}
|
60 |
+
|
61 |
+
// Is username or password field empty?
|
62 |
+
if ( empty( $username ) || empty( $password ) ) {
|
63 |
+
|
64 |
+
if ( is_wp_error( $user ) )
|
65 |
+
return $user;
|
66 |
+
|
67 |
+
$error = new WP_Error();
|
68 |
+
|
69 |
+
$empty_username = isset( $this->loginpress_key['empty_username'] ) && ! empty( $this->loginpress_key['empty_username'] ) ? $this->loginpress_key['empty_username'] : sprintf( __( '%1$sError:%2$s The username field is empty.', 'loginpress' ), '<strong>', '</strong>' );
|
70 |
+
|
71 |
+
$empty_password = isset( $this->loginpress_key['empty_password'] ) && ! empty( $this->loginpress_key['empty_password'] ) ? $this->loginpress_key['empty_password'] : sprintf( __( '%1$sError:%2$s The password field is empty.', 'loginpress' ), '<strong>', '</strong>' );
|
72 |
+
|
73 |
+
if ( empty( $username ) )
|
74 |
+
$error->add( 'empty_username', $empty_username );
|
75 |
+
|
76 |
+
if ( empty( $password ) )
|
77 |
+
$error->add( 'empty_password', $empty_password );
|
78 |
+
|
79 |
+
return $error;
|
80 |
+
} // close empty_username || empty_password.
|
81 |
+
|
82 |
+
$loginpress_setting = get_option( 'loginpress_setting' );
|
83 |
+
$login_order = isset( $loginpress_setting['login_order'] ) ? $loginpress_setting['login_order'] : '';
|
84 |
+
|
85 |
+
// Is login order is set to be 'email'.
|
86 |
+
if ( 'email' == $login_order ) {
|
87 |
+
|
88 |
+
if ( ! empty( $username ) && ! is_email( $username ) ) {
|
89 |
+
|
90 |
+
$error = new WP_Error();
|
91 |
+
|
92 |
+
$force_email_login= isset( $this->loginpress_key['force_email_login'] ) && ! empty( $this->loginpress_key['force_email_login'] ) ? $this->loginpress_key['force_email_login'] : sprintf( __( '%1$sError:%2$s Invalid Email Address', 'loginpress' ), '<strong>', '</strong>' );
|
93 |
+
|
94 |
+
$error->add( 'loginpress_use_email', $force_email_login );
|
95 |
+
|
96 |
+
return $error;
|
97 |
+
}
|
98 |
+
|
99 |
+
if ( ! empty( $username ) && is_email( $username ) ) {
|
100 |
+
|
101 |
+
$username = str_replace( '&', '&', stripslashes( $username ) );
|
102 |
+
$user = get_user_by( 'email', $username );
|
103 |
+
|
104 |
+
if ( isset( $user, $user->user_login, $user->user_status ) && 0 === intval( $user->user_status ) )
|
105 |
+
$username = $user->user_login;
|
106 |
+
return wp_authenticate_username_password( null, $username, $password );
|
107 |
+
}
|
108 |
+
} // login order 'email'.
|
109 |
+
|
110 |
+
// Is login order is set to be 'username'.
|
111 |
+
if ( 'username' == $login_order ) {
|
112 |
+
$user = get_user_by('login', $username);
|
113 |
+
|
114 |
+
$invalid_usrname = array_key_exists( 'incorrect_username', $this->loginpress_key ) && ! empty( $this->loginpress_key['incorrect_username'] ) ? $this->loginpress_key['incorrect_username'] : sprintf( __( '%1$sError:%2$s Invalid Username.', 'loginpress' ), '<strong>', '</strong>' );
|
115 |
+
|
116 |
+
if ( ! $user ) {
|
117 |
+
return new WP_Error( 'invalid_username', $invalid_usrname );
|
118 |
+
}
|
119 |
+
|
120 |
+
if ( ! empty( $username ) || ! empty( $password ) ) {
|
121 |
+
|
122 |
+
$username = str_replace( '&', '&', stripslashes( $username ) );
|
123 |
+
$user = get_user_by( 'login', $username );
|
124 |
+
|
125 |
+
if ( isset( $user, $user->user_login, $user->user_status ) && 0 === intval( $user->user_status ) )
|
126 |
+
$username = $user->user_login;
|
127 |
+
if ( ! empty( $username ) && is_email( $username ) ) {
|
128 |
+
return wp_authenticate_username_password( null, "", "" );
|
129 |
+
} else {
|
130 |
+
return wp_authenticate_username_password( null, $username, $password );
|
131 |
+
}
|
132 |
+
|
133 |
+
}
|
134 |
+
} // login order 'username'.
|
135 |
+
|
136 |
+
}
|
137 |
+
|
138 |
+
} // End Of Class.
|
139 |
+
endif;
|
classes/class-loginpress-setup.php
CHANGED
@@ -78,11 +78,6 @@ class LoginPress_Settings {
|
|
78 |
'title' => __( 'Settings', 'loginpress' ),
|
79 |
'desc' => sprintf( __( 'Everything else is customizable through %1$sWordPress Customizer%2$s.', 'loginpress' ), '<a href="' . admin_url( 'admin.php?page=loginpress' ) . '">', '</a>' ),
|
80 |
),
|
81 |
-
// array(
|
82 |
-
// 'id' => 'loginpress_configure',
|
83 |
-
// 'title' => __( 'Import/Export', 'loginpress' ),
|
84 |
-
// 'desc' => __( 'Let\'s Import/Export your LoginPress Settings for/from other site', 'loginpress' ),
|
85 |
-
// )
|
86 |
);
|
87 |
// if ( has_action( 'loginpress_pro_add_template' ) ) {
|
88 |
//
|
@@ -148,11 +143,29 @@ class LoginPress_Settings {
|
|
148 |
// 'default' => __( sprintf( __( '%1$sPrivacy Policy%2$s.', 'loginpress' ), '<a href="' . admin_url( 'admin.php?page=loginpress-settings' ) . '">', '</a>' ) )
|
149 |
// ),
|
150 |
array(
|
151 |
-
'name' => '
|
152 |
-
'label' => __( '
|
153 |
-
'desc' => __( '
|
154 |
'type' => 'checkbox'
|
155 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
array(
|
157 |
'name' => 'reset_settings',
|
158 |
'label' => __( 'Reset Default Settings', 'loginpress' ),
|
@@ -180,7 +193,7 @@ class LoginPress_Settings {
|
|
180 |
}
|
181 |
|
182 |
function plugin_page() {
|
183 |
-
|
184 |
echo '<div class="wrap loginpress-admin-setting">';
|
185 |
echo '<h2 style="margin: 20px 0 20px 0;">';
|
186 |
esc_html_e( 'LoginPress - Rebranding your boring WordPress Login pages', 'loginpress' );
|
78 |
'title' => __( 'Settings', 'loginpress' ),
|
79 |
'desc' => sprintf( __( 'Everything else is customizable through %1$sWordPress Customizer%2$s.', 'loginpress' ), '<a href="' . admin_url( 'admin.php?page=loginpress' ) . '">', '</a>' ),
|
80 |
),
|
|
|
|
|
|
|
|
|
|
|
81 |
);
|
82 |
// if ( has_action( 'loginpress_pro_add_template' ) ) {
|
83 |
//
|
143 |
// 'default' => __( sprintf( __( '%1$sPrivacy Policy%2$s.', 'loginpress' ), '<a href="' . admin_url( 'admin.php?page=loginpress-settings' ) . '">', '</a>' ) )
|
144 |
// ),
|
145 |
array(
|
146 |
+
'name' => 'enable_reg_pass_field',
|
147 |
+
'label' => __( 'Custom Password Fields', 'loginpress' ),
|
148 |
+
'desc' => __( 'Enable custom password fields on registration form.', 'loginpress' ),
|
149 |
'type' => 'checkbox'
|
150 |
),
|
151 |
+
array(
|
152 |
+
'name' => 'login_order',
|
153 |
+
'label' => __( 'Login Order', 'loginpress' ),
|
154 |
+
'desc' => __( 'Enable users to login using their username and/or email address.', 'loginpress' ),
|
155 |
+
'type' => 'radio',
|
156 |
+
'default' => 'default',
|
157 |
+
'options' => array(
|
158 |
+
'default' => 'Both Username Or Email Address',
|
159 |
+
'username' => 'Only Username',
|
160 |
+
'email' => 'Only Email Address'
|
161 |
+
)
|
162 |
+
),
|
163 |
+
// array(
|
164 |
+
// 'name' => 'login_with_email',
|
165 |
+
// 'label' => __( 'Login with Email', 'loginpress' ),
|
166 |
+
// 'desc' => __( 'Force user to login with Email Only Instead Username.', 'loginpress' ),
|
167 |
+
// 'type' => 'checkbox'
|
168 |
+
// ),
|
169 |
array(
|
170 |
'name' => 'reset_settings',
|
171 |
'label' => __( 'Reset Default Settings', 'loginpress' ),
|
193 |
}
|
194 |
|
195 |
function plugin_page() {
|
196 |
+
|
197 |
echo '<div class="wrap loginpress-admin-setting">';
|
198 |
echo '<h2 style="margin: 20px 0 20px 0;">';
|
199 |
esc_html_e( 'LoginPress - Rebranding your boring WordPress Login pages', 'loginpress' );
|
css/style-login.php
CHANGED
@@ -35,7 +35,9 @@ function loginpress_check_px( $value ) {
|
|
35 |
if ( strpos( $value, "px" ) ) {
|
36 |
return $value;
|
37 |
} else {
|
38 |
-
|
|
|
|
|
39 |
}
|
40 |
}
|
41 |
|
@@ -208,7 +210,9 @@ body.login {
|
|
208 |
.interim-login.login h1 a{
|
209 |
<?php if ( ! empty( $loginpress_logo_width ) ) : ?>
|
210 |
width: <?php echo $loginpress_logo_width; ?>;
|
211 |
-
<?php
|
|
|
|
|
212 |
}
|
213 |
|
214 |
.login h1 a {
|
35 |
if ( strpos( $value, "px" ) ) {
|
36 |
return $value;
|
37 |
} else {
|
38 |
+
if ( ! empty( $value ) ) {
|
39 |
+
return $value . 'px';
|
40 |
+
}
|
41 |
}
|
42 |
}
|
43 |
|
210 |
.interim-login.login h1 a{
|
211 |
<?php if ( ! empty( $loginpress_logo_width ) ) : ?>
|
212 |
width: <?php echo $loginpress_logo_width; ?>;
|
213 |
+
<?php else : ?>
|
214 |
+
width: 84px;
|
215 |
+
<?php endif; ?>
|
216 |
}
|
217 |
|
218 |
.login h1 a {
|
custom.php
CHANGED
@@ -1235,7 +1235,7 @@ class LoginPress_Entities {
|
|
1235 |
* * * * * * * * * * * */
|
1236 |
public function login_page_custom_head() {
|
1237 |
|
1238 |
-
add_filter( 'gettext',
|
1239 |
// Include CSS File in heared.
|
1240 |
|
1241 |
include( LOGINPRESS_DIR_PATH . 'css/style-presets.php' );
|
@@ -1366,14 +1366,14 @@ class LoginPress_Entities {
|
|
1366 |
*
|
1367 |
* @param $text
|
1368 |
* @since 1.0.0
|
1369 |
-
* @version 1.0.
|
1370 |
* @return mixed
|
1371 |
* * * * * * * * * * * * * * * * * * */
|
1372 |
public function change_lostpassword_message ( $translated_text, $text, $domain ) {
|
1373 |
|
1374 |
-
if ( array_key_exists( 'login_footer_text', $this->loginpress_key ) && $text == 'Lost your password?' && 'default' == $domain && trim( $this->loginpress_key['login_footer_text'] ) ) {
|
1375 |
|
1376 |
-
return trim( $this->loginpress_key['login_footer_text'] );
|
1377 |
}
|
1378 |
|
1379 |
return $translated_text;
|
1235 |
* * * * * * * * * * * */
|
1236 |
public function login_page_custom_head() {
|
1237 |
|
1238 |
+
add_filter( 'gettext', array( $this, 'change_lostpassword_message' ), 20, 3 );
|
1239 |
// Include CSS File in heared.
|
1240 |
|
1241 |
include( LOGINPRESS_DIR_PATH . 'css/style-presets.php' );
|
1366 |
*
|
1367 |
* @param $text
|
1368 |
* @since 1.0.0
|
1369 |
+
* @version 1.0.21
|
1370 |
* @return mixed
|
1371 |
* * * * * * * * * * * * * * * * * * */
|
1372 |
public function change_lostpassword_message ( $translated_text, $text, $domain ) {
|
1373 |
|
1374 |
+
if ( is_array( $this->loginpress_key ) && array_key_exists( 'login_footer_text', $this->loginpress_key ) && $text == 'Lost your password?' && 'default' == $domain && trim( $this->loginpress_key['login_footer_text'] ) ) {
|
1375 |
|
1376 |
+
return trim( $this->loginpress_key['login_footer_text'] );
|
1377 |
}
|
1378 |
|
1379 |
return $translated_text;
|
include/compatibility.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* This is a LoginPress Compatibility to make it compatible for older versions.
|
5 |
+
*
|
6 |
+
* @since 1.0.22
|
7 |
+
*/
|
8 |
+
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Run a compatibility check on 1.0.21 and change the settings.
|
12 |
+
*
|
13 |
+
*/
|
14 |
+
add_action( 'init', 'loginpress_upgrade_1_0_22', 1 );
|
15 |
+
|
16 |
+
|
17 |
+
/**
|
18 |
+
* loginpress_upgrade_1_0_22 remove 'login_with_email' from loginpress setting and update 'login_order'
|
19 |
+
*
|
20 |
+
* @since 1.0.22
|
21 |
+
* @return array update loginpress_setting
|
22 |
+
*/
|
23 |
+
function loginpress_upgrade_1_0_22() {
|
24 |
+
|
25 |
+
$loginpress_setting = get_option( 'loginpress_setting' );
|
26 |
+
$login_with_email = isset( $loginpress_setting['login_with_email'] ) ? $loginpress_setting['login_with_email'] : '';
|
27 |
+
|
28 |
+
if ( isset( $loginpress_setting['login_with_email'] ) ) {
|
29 |
+
|
30 |
+
if( 'on' == $login_with_email ) {
|
31 |
+
|
32 |
+
$loginpress_setting['login_order'] = 'email';
|
33 |
+
unset( $loginpress_setting['login_with_email'] );
|
34 |
+
update_option( 'loginpress_setting', $loginpress_setting );
|
35 |
+
} else if ( 'off' == $login_with_email ) {
|
36 |
+
|
37 |
+
$loginpress_setting['login_order'] = 'default';
|
38 |
+
unset( $loginpress_setting['login_with_email'] );
|
39 |
+
update_option( 'loginpress_setting', $loginpress_setting );
|
40 |
+
}
|
41 |
+
}
|
42 |
+
}
|
43 |
+
?>
|
loginpress.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: LoginPress - Customizing the WordPress Login
|
4 |
* Plugin URI: http://www.WPBrigade.com/wordpress/plugins/loginpress/
|
5 |
* Description: LoginPress is the best <code>wp-login</code> Login Page Customizer plugin by <a href="https://wpbrigade.com/">WPBrigade</a> which allows you to completely change the layout of login, register and forgot password forms.
|
6 |
-
* Version: 1.0.
|
7 |
* Author: WPBrigade
|
8 |
* Author URI: http://www.WPBrigade.com/
|
9 |
* Text Domain: loginpress
|
@@ -22,7 +22,7 @@ if ( ! class_exists( 'LoginPress' ) ) :
|
|
22 |
/**
|
23 |
* @var string
|
24 |
*/
|
25 |
-
public $version = '1.0.
|
26 |
|
27 |
/**
|
28 |
* @var The single instance of the class
|
@@ -76,6 +76,7 @@ if ( ! class_exists( 'LoginPress' ) ) :
|
|
76 |
|
77 |
public function includes() {
|
78 |
|
|
|
79 |
include_once( LOGINPRESS_DIR_PATH . 'custom.php' );
|
80 |
include_once( LOGINPRESS_DIR_PATH . 'classes/class-loginpress-setup.php' );
|
81 |
include_once( LOGINPRESS_DIR_PATH . 'classes/class-loginpress-ajax.php' );
|
@@ -88,10 +89,16 @@ if ( ! class_exists( 'LoginPress' ) ) :
|
|
88 |
include_once( LOGINPRESS_DIR_PATH . 'include/privacy-policy.php' );
|
89 |
}
|
90 |
|
91 |
-
$login_with_email = isset( $loginpress_setting['
|
92 |
-
if ( '
|
93 |
-
include_once( LOGINPRESS_DIR_PATH . 'classes/class-loginpress-
|
94 |
-
new
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
}
|
96 |
}
|
97 |
|
@@ -322,36 +329,26 @@ if ( ! class_exists( 'LoginPress' ) ) :
|
|
322 |
include LOGINPRESS_DIR_PATH . 'include/loginpress-optout-form.php';
|
323 |
}
|
324 |
|
|
|
|
|
|
|
|
|
|
|
|
|
325 |
static function plugin_activation() {
|
326 |
|
|
|
327 |
$loginpress_setting = get_option( 'loginpress_setting' );
|
328 |
-
if ( ! isset( $loginpress_setting['tracking_anonymous'] ) || 'off' == $loginpress_setting['tracking_anonymous'] ) {
|
329 |
-
return;
|
330 |
-
}
|
331 |
-
|
332 |
-
$email = get_option( 'admin_email' );
|
333 |
-
|
334 |
-
$fields = array(
|
335 |
-
'email' => $email,
|
336 |
-
'website' => get_site_url(),
|
337 |
-
'action' => 'Activate',
|
338 |
-
'reason' => '',
|
339 |
-
'reason_detail' => '',
|
340 |
-
'blog_language' => get_bloginfo( 'language' ),
|
341 |
-
'wordpress_version' => get_bloginfo( 'version' ),
|
342 |
-
'plugin_version' => LOGINPRESS_VERSION,
|
343 |
-
'plugin_name' => 'LoginPress Free',
|
344 |
-
);
|
345 |
|
346 |
-
|
347 |
-
|
348 |
-
'
|
349 |
-
|
350 |
-
'blocking' => false,
|
351 |
-
'headers' => array(),
|
352 |
-
'body' => $fields,
|
353 |
-
) );
|
354 |
|
|
|
|
|
|
|
|
|
355 |
}
|
356 |
|
357 |
static function plugin_uninstallation() {
|
@@ -611,6 +608,6 @@ if (!class_exists('TAV_Remote_Notification_Client')) {
|
|
611 |
}
|
612 |
$notification = new TAV_Remote_Notification_Client( 125, '16765c0902705d62', 'http://wpbrigade.com?post_type=notification' );
|
613 |
|
614 |
-
|
615 |
register_uninstall_hook( __FILE__, array( 'LoginPress', 'plugin_uninstallation' ) );
|
616 |
?>
|
3 |
* Plugin Name: LoginPress - Customizing the WordPress Login
|
4 |
* Plugin URI: http://www.WPBrigade.com/wordpress/plugins/loginpress/
|
5 |
* Description: LoginPress is the best <code>wp-login</code> Login Page Customizer plugin by <a href="https://wpbrigade.com/">WPBrigade</a> which allows you to completely change the layout of login, register and forgot password forms.
|
6 |
+
* Version: 1.0.22
|
7 |
* Author: WPBrigade
|
8 |
* Author URI: http://www.WPBrigade.com/
|
9 |
* Text Domain: loginpress
|
22 |
/**
|
23 |
* @var string
|
24 |
*/
|
25 |
+
public $version = '1.0.22';
|
26 |
|
27 |
/**
|
28 |
* @var The single instance of the class
|
76 |
|
77 |
public function includes() {
|
78 |
|
79 |
+
include_once( LOGINPRESS_DIR_PATH . 'include/compatibility.php' );
|
80 |
include_once( LOGINPRESS_DIR_PATH . 'custom.php' );
|
81 |
include_once( LOGINPRESS_DIR_PATH . 'classes/class-loginpress-setup.php' );
|
82 |
include_once( LOGINPRESS_DIR_PATH . 'classes/class-loginpress-ajax.php' );
|
89 |
include_once( LOGINPRESS_DIR_PATH . 'include/privacy-policy.php' );
|
90 |
}
|
91 |
|
92 |
+
$login_with_email = isset( $loginpress_setting['login_order'] ) ? $loginpress_setting['login_order'] : 'default';
|
93 |
+
if ( 'default' != $login_with_email ) {
|
94 |
+
include_once( LOGINPRESS_DIR_PATH . 'classes/class-loginpress-login-order.php' );
|
95 |
+
new LoginPress_Login_Order();
|
96 |
+
}
|
97 |
+
|
98 |
+
$enable_reg_pass_field = isset( $loginpress_setting['enable_reg_pass_field'] ) ? $loginpress_setting['enable_reg_pass_field'] : 'off';
|
99 |
+
if ( 'off' != $enable_reg_pass_field ) {
|
100 |
+
include_once( LOGINPRESS_DIR_PATH . 'classes/class-loginpress-custom-password.php' );
|
101 |
+
new LoginPresss_Custom_Password();
|
102 |
}
|
103 |
}
|
104 |
|
329 |
include LOGINPRESS_DIR_PATH . 'include/loginpress-optout-form.php';
|
330 |
}
|
331 |
|
332 |
+
/**
|
333 |
+
* Plugin activation
|
334 |
+
*
|
335 |
+
* @since 1.0.15
|
336 |
+
* @version 1.0.22
|
337 |
+
*/
|
338 |
static function plugin_activation() {
|
339 |
|
340 |
+
$loginpress_key = get_option( 'loginpress_customization' );
|
341 |
$loginpress_setting = get_option( 'loginpress_setting' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
342 |
|
343 |
+
// Create a key 'loginpress_customization' with empty array.
|
344 |
+
if ( ! $loginpress_key ) {
|
345 |
+
update_option( 'loginpress_customization', array() );
|
346 |
+
}
|
|
|
|
|
|
|
|
|
347 |
|
348 |
+
// Create a key 'loginpress_setting' with empty array.
|
349 |
+
if ( ! $loginpress_setting ) {
|
350 |
+
update_option( 'loginpress_setting', array() );
|
351 |
+
}
|
352 |
}
|
353 |
|
354 |
static function plugin_uninstallation() {
|
608 |
}
|
609 |
$notification = new TAV_Remote_Notification_Client( 125, '16765c0902705d62', 'http://wpbrigade.com?post_type=notification' );
|
610 |
|
611 |
+
register_activation_hook( __FILE__, array( 'LoginPress', 'plugin_activation' ) );
|
612 |
register_uninstall_hook( __FILE__, array( 'LoginPress', 'plugin_uninstallation' ) );
|
613 |
?>
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== Custom Login Page Customizer | LoginPress ===
|
2 |
Requires at least: 4.0
|
3 |
-
Tested up to: 4.
|
4 |
Contributors: WPBrigade, hiddenpearls, AbdulWahab610
|
5 |
Author URI: https://wpbrigade.com
|
6 |
Tags: wp-login, custom wp-login, login customizer, custom login, custom login logo, login customizer, custom login page, login error, login page style, loginpress
|
7 |
-
Stable tag: 1.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -190,6 +190,12 @@ Please visit <a target="_blank" rel="friend" href="http://www.WPBrigade.com/word
|
|
190 |
|
191 |
== Changelog ==
|
192 |
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
= 1.0.21 - 2017-08-25 =
|
194 |
* Bugfix: Translation bug fixed which changes multilingual backend to english.
|
195 |
|
@@ -296,5 +302,5 @@ Please visit <a target="_blank" rel="friend" href="http://www.WPBrigade.com/word
|
|
296 |
|
297 |
== Upgrade Notice ==
|
298 |
|
299 |
-
= 1.0.
|
300 |
* Important release, Multiple New Features, BugFixes & enhancements, Please upgrade immediately.
|
1 |
=== Custom Login Page Customizer | LoginPress ===
|
2 |
Requires at least: 4.0
|
3 |
+
Tested up to: 4.9
|
4 |
Contributors: WPBrigade, hiddenpearls, AbdulWahab610
|
5 |
Author URI: https://wpbrigade.com
|
6 |
Tags: wp-login, custom wp-login, login customizer, custom login, custom login logo, login customizer, custom login page, login error, login page style, loginpress
|
7 |
+
Stable tag: 1.0.22
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
190 |
|
191 |
== Changelog ==
|
192 |
|
193 |
+
= 1.0.22 - 2017-09-08 =
|
194 |
+
* New Feature: Custom Password Field on Registration Form.
|
195 |
+
* New Feature: Should be Login with Username and/or Email Address.
|
196 |
+
* Enhancement: LoginPress Customization array in configuration. "Help Page"
|
197 |
+
* Bugfix: array_key_exists(); on installation.
|
198 |
+
|
199 |
= 1.0.21 - 2017-08-25 =
|
200 |
* Bugfix: Translation bug fixed which changes multilingual backend to english.
|
201 |
|
302 |
|
303 |
== Upgrade Notice ==
|
304 |
|
305 |
+
= 1.0.22 =
|
306 |
* Important release, Multiple New Features, BugFixes & enhancements, Please upgrade immediately.
|