Version Description
Download this release
Release Info
Developer | storeapps |
Plugin | Temporary Login Without Password |
Version | 1.5.13 |
Comparing to | |
See all releases |
Code changes from version 1.5.11 to 1.5.13
admin/class-wp-temporary-login-without-password-admin.php
CHANGED
@@ -527,7 +527,9 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
527 |
|
528 |
$reviewurl = 'https://wordpress.org/support/plugin/temporary-login-without-password/reviews/';
|
529 |
|
530 |
-
$
|
|
|
|
|
531 |
|
532 |
echo '<div class="notice notice-warning">';
|
533 |
|
527 |
|
528 |
$reviewurl = 'https://wordpress.org/support/plugin/temporary-login-without-password/reviews/';
|
529 |
|
530 |
+
$current_page_url = "//".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
|
531 |
+
|
532 |
+
$nobugurl = add_query_arg( 'tlwp_nobug', 1, $current_page_url);
|
533 |
|
534 |
echo '<div class="notice notice-warning">';
|
535 |
|
public/class-wp-temporary-login-without-password-public.php
CHANGED
@@ -61,7 +61,7 @@ class Wp_Temporary_Login_Without_Password_Public {
|
|
61 |
/**
|
62 |
* Initialize tlwp
|
63 |
*
|
64 |
-
* Hooked to init
|
65 |
*
|
66 |
* @since 1.0.0
|
67 |
*
|
@@ -69,38 +69,56 @@ class Wp_Temporary_Login_Without_Password_Public {
|
|
69 |
*/
|
70 |
public function init_wtlwp() {
|
71 |
|
72 |
-
if
|
73 |
|
74 |
$wtlwp_token = sanitize_key( $_GET['wtlwp_token'] ); // Input var okay.
|
75 |
$users = Wp_Temporary_Login_Without_Password_Common::get_valid_user_based_on_wtlwp_token( $wtlwp_token );
|
76 |
|
|
|
|
|
|
|
|
|
77 |
|
78 |
-
if
|
79 |
-
|
80 |
-
|
81 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
-
$
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
|
89 |
-
|
90 |
-
|
91 |
|
92 |
-
|
93 |
|
94 |
// If empty redirect user to admin page.
|
95 |
if ( ! empty( $redirect_to_url ) ) {
|
96 |
$redirect_to = $redirect_to_url;
|
97 |
}
|
98 |
|
99 |
-
|
|
|
|
|
100 |
}
|
|
|
|
|
101 |
exit();
|
|
|
102 |
}
|
103 |
|
|
|
104 |
if ( is_user_logged_in() ) {
|
105 |
|
106 |
$user_id = get_current_user_id();
|
@@ -108,8 +126,6 @@ class Wp_Temporary_Login_Without_Password_Public {
|
|
108 |
if ( Wp_Temporary_Login_Without_Password_Common::is_login_expired( $user_id ) ) {
|
109 |
wp_logout();
|
110 |
wp_safe_redirect( home_url() );
|
111 |
-
|
112 |
-
|
113 |
exit();
|
114 |
} else {
|
115 |
|
@@ -124,6 +140,7 @@ class Wp_Temporary_Login_Without_Password_Public {
|
|
124 |
}
|
125 |
}
|
126 |
}
|
|
|
127 |
}
|
128 |
|
129 |
/**
|
61 |
/**
|
62 |
* Initialize tlwp
|
63 |
*
|
64 |
+
* Hooked to init action to initilize tlwp
|
65 |
*
|
66 |
* @since 1.0.0
|
67 |
*
|
69 |
*/
|
70 |
public function init_wtlwp() {
|
71 |
|
72 |
+
if(! empty($_GET['wtlwp_token'] )) {
|
73 |
|
74 |
$wtlwp_token = sanitize_key( $_GET['wtlwp_token'] ); // Input var okay.
|
75 |
$users = Wp_Temporary_Login_Without_Password_Common::get_valid_user_based_on_wtlwp_token( $wtlwp_token );
|
76 |
|
77 |
+
$temporary_user = '';
|
78 |
+
if( !empty($users)) {
|
79 |
+
$temporary_user = $users[0];
|
80 |
+
}
|
81 |
|
82 |
+
if(!empty($temporary_user)) {
|
83 |
+
|
84 |
+
$temporary_user_id = $temporary_user->ID;
|
85 |
+
$do_login = true;
|
86 |
+
if(is_user_logged_in()) {
|
87 |
+
$current_user_id = get_current_user_id();
|
88 |
+
if($temporary_user_id !== $current_user_id) {
|
89 |
+
wp_logout();
|
90 |
+
} else {
|
91 |
+
$do_login = false;
|
92 |
+
}
|
93 |
+
}
|
94 |
|
95 |
+
if($do_login) {
|
96 |
+
$temporary_user_login = $temporary_user->login;
|
97 |
+
update_user_meta( $temporary_user_id, '_wtlwp_last_login', Wp_Temporary_Login_Without_Password_Common::get_current_gmt_timestamp() ); // phpcs:ignore
|
98 |
+
wp_set_current_user( $temporary_user_id, $temporary_user_login );
|
99 |
+
wp_set_auth_cookie( $temporary_user_id );
|
100 |
|
101 |
+
do_action( 'wp_login', $temporary_user_login, $temporary_user );
|
102 |
+
}
|
103 |
|
104 |
+
$redirect_to_url = (isset( $_REQUEST['redirect_to'])) ? $_REQUEST['redirect_to'] : apply_filters( 'login_redirect', site_url(remove_query_arg('wtlwp_token')), false, $temporary_user ); // phpcs:ignore
|
105 |
|
106 |
// If empty redirect user to admin page.
|
107 |
if ( ! empty( $redirect_to_url ) ) {
|
108 |
$redirect_to = $redirect_to_url;
|
109 |
}
|
110 |
|
111 |
+
} else {
|
112 |
+
// Temporary user not found?? Redirect to home page.
|
113 |
+
$redirect_to = home_url();
|
114 |
}
|
115 |
+
|
116 |
+
wp_safe_redirect( $redirect_to ); // Redirect to given url after successfull login.
|
117 |
exit();
|
118 |
+
|
119 |
}
|
120 |
|
121 |
+
// Restrict unauthorized page access for temporary users
|
122 |
if ( is_user_logged_in() ) {
|
123 |
|
124 |
$user_id = get_current_user_id();
|
126 |
if ( Wp_Temporary_Login_Without_Password_Common::is_login_expired( $user_id ) ) {
|
127 |
wp_logout();
|
128 |
wp_safe_redirect( home_url() );
|
|
|
|
|
129 |
exit();
|
130 |
} else {
|
131 |
|
140 |
}
|
141 |
}
|
142 |
}
|
143 |
+
|
144 |
}
|
145 |
|
146 |
/**
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: storeapps, niravmehta, malayladu
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CPTHCDC382KVA
|
4 |
Tags: temporary access, developer access, admin login, temporary login, passwordless login, customer login, secure login, access, admin, log in, login, login security, protection, user login, user login, wordpress admin login, wordpress login, wp-admin, wp-login, expiration, login, Login Without Password, user, WordPress Admin, wp-admin, developer login
|
5 |
Requires at least: 3.0.1
|
6 |
-
Tested up to:
|
7 |
-
Stable tag: 1.5.
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -68,9 +68,17 @@ No. at this moment it's not possible to do this.
|
|
68 |
|
69 |
== Changelog ==
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
**1.5.11 [2018-10-08]**
|
72 |
|
73 |
-
* Update: Added filter for expiry_option. Now, one can add any custom expiry_option for the temporary login.
|
74 |
|
75 |
**1.5.10 [2018-09-12]**
|
76 |
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CPTHCDC382KVA
|
4 |
Tags: temporary access, developer access, admin login, temporary login, passwordless login, customer login, secure login, access, admin, log in, login, login security, protection, user login, user login, wordpress admin login, wordpress login, wp-admin, wp-login, expiration, login, Login Without Password, user, WordPress Admin, wp-admin, developer login
|
5 |
Requires at least: 3.0.1
|
6 |
+
Tested up to: 5.0.2
|
7 |
+
Stable tag: 1.5.13
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
68 |
|
69 |
== Changelog ==
|
70 |
|
71 |
+
**1.5.13 [2018-11-19]**
|
72 |
+
|
73 |
+
* Update: Now, temporary user can be redirected to any page without using redirect_to query params.
|
74 |
+
|
75 |
+
**1.5.12 [2018-10-24]**
|
76 |
+
|
77 |
+
* Fix: Temporary user redirected to admin page even if 'redirect_to' query param present once user logged in with temporary login link.
|
78 |
+
|
79 |
**1.5.11 [2018-10-08]**
|
80 |
|
81 |
+
* Update: Added filter for expiry_option. Now, one can add any custom expiry_option for the temporary login. [See example](https://wordpress.org/support/topic/additional-expiry-option/)
|
82 |
|
83 |
**1.5.10 [2018-09-12]**
|
84 |
|
temporary-login-without-password.php
CHANGED
@@ -3,11 +3,11 @@
|
|
3 |
* Plugin Name: Temporary Login Without Password
|
4 |
* Plugin URI: http://www.storeapps.org/create-secure-login-without-password-for-wordpress/
|
5 |
* Description: Create a temporary login link with any role using which one can access to your sytem without username and password for limited period of time.
|
6 |
-
* Version: 1.5.
|
7 |
* Author: StoreApps
|
8 |
* Author URI: https://storeapps.org
|
9 |
* Requires at least: 3.0.1
|
10 |
-
* Tested up to:
|
11 |
* License: GPLv3
|
12 |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
13 |
* Text Domain: temporary-login-without-password
|
@@ -26,7 +26,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|
26 |
* Define constants
|
27 |
*/
|
28 |
define( 'WTLWP_PLUGIN_DIR', dirname( __FILE__ ) );
|
29 |
-
define( 'WTLWP_PLUGIN_VERSION', '1.5.
|
30 |
define( 'WTLWP_PLUGIN_BASE_NAME', plugin_basename( __FILE__ ) );
|
31 |
|
32 |
/**
|
3 |
* Plugin Name: Temporary Login Without Password
|
4 |
* Plugin URI: http://www.storeapps.org/create-secure-login-without-password-for-wordpress/
|
5 |
* Description: Create a temporary login link with any role using which one can access to your sytem without username and password for limited period of time.
|
6 |
+
* Version: 1.5.13
|
7 |
* Author: StoreApps
|
8 |
* Author URI: https://storeapps.org
|
9 |
* Requires at least: 3.0.1
|
10 |
+
* Tested up to: 5.0.2
|
11 |
* License: GPLv3
|
12 |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
13 |
* Text Domain: temporary-login-without-password
|
26 |
* Define constants
|
27 |
*/
|
28 |
define( 'WTLWP_PLUGIN_DIR', dirname( __FILE__ ) );
|
29 |
+
define( 'WTLWP_PLUGIN_VERSION', '1.5.13' );
|
30 |
define( 'WTLWP_PLUGIN_BASE_NAME', plugin_basename( __FILE__ ) );
|
31 |
|
32 |
/**
|