Version Description
Download this release
Release Info
Developer | storeapps |
Plugin | Temporary Login Without Password |
Version | 1.5.8 |
Comparing to | |
See all releases |
Code changes from version 1.5.7 to 1.5.8
- admin/class-wp-temporary-login-without-password-admin.php +95 -118
- admin/css/wp-temporary-login-without-password-admin.css +41 -41
- admin/js/clipboard.js +787 -742
- admin/js/wp-temporary-login-without-password-admin.js +116 -88
- includes/class-wp-temporary-login-without-password-activator.php +16 -1
- includes/class-wp-temporary-login-without-password-common.php +62 -17
- includes/class-wp-temporary-login-without-password-deactivator.php +17 -2
- includes/class-wp-temporary-login-without-password-i18n.php +13 -1
- includes/class-wp-temporary-login-without-password-layout.php +31 -11
- includes/class-wp-temporary-login-without-password-loader.php +58 -25
- includes/class-wp-temporary-login-without-password.php +75 -2
- includes/index.php +6 -1
- index.php +2 -2
- languages/temporary-login-without-password.pot +41 -33
- public/class-wp-temporary-login-without-password-public.php +58 -15
- public/index.php +6 -1
- readme.txt +24 -20
- screenshots/screenshot-1.png +0 -0
- screenshots/screenshot-2.png +0 -0
- screenshots/screenshot-3.png +0 -0
- templates/admin-settings.php +72 -0
- templates/admin_settings.php +0 -67
- templates/{list_temporary_logins.php → list-temporary-logins.php} +9 -1
- templates/{new_login.php → new-login.php} +20 -13
- templates/{temporary_logins_settings.php → temporary-logins-settings.php} +14 -6
- templates/update-login.php +96 -0
- templates/update_login.php +0 -88
- temporary-login-without-password.php +6 -4
admin/class-wp-temporary-login-without-password-admin.php
CHANGED
@@ -8,10 +8,10 @@
|
|
8 |
* @since 1.0
|
9 |
* @package Temporary Login Without Password
|
10 |
*/
|
11 |
-
|
12 |
class Wp_Temporary_Login_Without_Password_Admin {
|
13 |
-
|
14 |
/**
|
|
|
|
|
15 |
* @var string $plugin_name
|
16 |
*
|
17 |
* @since 1.0
|
@@ -19,6 +19,8 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
19 |
private $plugin_name;
|
20 |
|
21 |
/**
|
|
|
|
|
22 |
* @var string $version
|
23 |
*
|
24 |
* @since 1.0
|
@@ -26,6 +28,7 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
26 |
private $version;
|
27 |
|
28 |
/**
|
|
|
29 |
*
|
30 |
* @param string $plugin_name
|
31 |
* @param string $version
|
@@ -77,23 +80,28 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
77 |
public function admin_menu() {
|
78 |
$current_user_id = get_current_user_id();
|
79 |
if ( ! Wp_Temporary_Login_Without_Password_Common::is_valid_temporary_login( $current_user_id ) ) {
|
80 |
-
add_users_page(
|
81 |
-
|
82 |
-
|
83 |
-
|
|
|
|
|
84 |
}
|
85 |
}
|
86 |
|
87 |
/**
|
88 |
* Manage admin settings
|
89 |
*
|
|
|
|
|
90 |
* @since 1.0
|
91 |
*/
|
92 |
public static function admin_settings() {
|
|
|
93 |
$active_tab = ! empty( $_GET['tab'] ) ? $_GET['tab'] : 'home';
|
94 |
-
$_template_file = WTLWP_PLUGIN_DIR . '/templates/
|
95 |
$wtlwp_generated_url = ! empty( $_REQUEST['wtlwp_generated_url'] ) ? $_REQUEST['wtlwp_generated_url'] : '';
|
96 |
-
$user_email = ! empty( $_REQUEST['user_email'] ) ? $_REQUEST['user_email'] : '';
|
97 |
$tlwp_settings = maybe_unserialize( get_option( 'tlwp_settings', array() ) );
|
98 |
$action = ! empty( $_GET['action'] ) ? $_GET['action'] : '';
|
99 |
$user_id = ! empty( $_GET['user_id'] ) ? $_GET['user_id'] : '';
|
@@ -104,7 +112,7 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
104 |
}
|
105 |
|
106 |
if ( ! empty( $wtlwp_generated_url ) ) {
|
107 |
-
$mailto_link = Wp_Temporary_Login_Without_Password_Common::generate_mailto_link($user_email, $wtlwp_generated_url);
|
108 |
}
|
109 |
|
110 |
$default_role = ( ! empty( $tlwp_settings ) && isset( $tlwp_settings['default_role'] ) ) ? $tlwp_settings['default_role'] : 'administrator';
|
@@ -116,11 +124,12 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
116 |
/**
|
117 |
* Create a Temporary user
|
118 |
*
|
|
|
|
|
119 |
* @since 1.0
|
120 |
*/
|
121 |
public function create_user() {
|
122 |
|
123 |
-
|
124 |
if ( empty( $_POST['wtlwp_data'] ) || empty( $_POST['wtlwp-nonce'] ) || ( ! empty( $_POST['wtlwp_action'] ) && 'update' === $_POST['wtlwp_action'] ) ) {
|
125 |
return;
|
126 |
}
|
@@ -128,52 +137,41 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
128 |
$data = $_POST['wtlwp_data'];
|
129 |
$email = $data['user_email'];
|
130 |
$error = true;
|
131 |
-
$result = array(
|
|
|
|
|
132 |
|
133 |
$redirect_link = '';
|
134 |
if ( false == Wp_Temporary_Login_Without_Password_Common::can_manage_wtlwp() ) {
|
135 |
-
$result =
|
136 |
-
'status' => 'error',
|
137 |
-
'message' => 'unathorised_access',
|
138 |
-
);
|
139 |
} elseif ( ! wp_verify_nonce( $_POST['wtlwp-nonce'], 'wtlwp_generate_login_url' ) ) {
|
140 |
-
$result =
|
141 |
-
'status' => 'error',
|
142 |
-
'message' => 'nonce_failed',
|
143 |
-
);
|
144 |
} elseif ( empty( $data['user_email'] ) ) {
|
145 |
-
$result =
|
146 |
-
'status' => 'error',
|
147 |
-
'message' => 'empty_email',
|
148 |
-
);
|
149 |
} elseif ( ! is_email( $email ) ) {
|
150 |
-
$result =
|
151 |
-
'status' => 'error',
|
152 |
-
'message' => 'not_valid_email',
|
153 |
-
);
|
154 |
} elseif ( ! empty( $data['user_email'] ) && email_exists( $data['user_email'] ) ) {
|
155 |
-
$result =
|
156 |
-
'status' => 'error',
|
157 |
-
'message' => 'email_is_in_use',
|
158 |
-
);
|
159 |
} else {
|
160 |
$error = false;
|
161 |
}
|
162 |
|
163 |
if ( ! $error ) {
|
164 |
$user = Wp_Temporary_Login_Without_Password_Common::create_new_user( $data );
|
165 |
-
if (
|
166 |
$result = array(
|
167 |
'status' => 'error',
|
168 |
'message' => 'user_creation_failed',
|
169 |
);
|
170 |
} else {
|
171 |
-
$result
|
172 |
'status' => 'success',
|
173 |
'message' => 'user_created',
|
174 |
);
|
|
|
|
|
175 |
$redirect_link = Wp_Temporary_Login_Without_Password_Common::get_redirect_link( $result );
|
176 |
-
$redirect_link = add_query_arg( 'wtlwp_generated_url', Wp_Temporary_Login_Without_Password_Common::get_login_url( $
|
177 |
$redirect_link = add_query_arg( 'user_email', $email, $redirect_link );
|
178 |
}
|
179 |
}
|
@@ -182,13 +180,15 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
182 |
$redirect_link = Wp_Temporary_Login_Without_Password_Common::get_redirect_link( $result );
|
183 |
}
|
184 |
|
185 |
-
|
186 |
exit();
|
187 |
}
|
188 |
|
189 |
/**
|
190 |
* Manage settings
|
191 |
*
|
|
|
|
|
192 |
* @since 1.4.6
|
193 |
*/
|
194 |
public function update_tlwp_settings() {
|
@@ -249,7 +249,7 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
249 |
'disable',
|
250 |
'enable',
|
251 |
'delete',
|
252 |
-
'update'
|
253 |
);
|
254 |
|
255 |
if ( ! in_array( $action, $valid_actions ) ) {
|
@@ -336,8 +336,7 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
336 |
'message' => 'default_error_message',
|
337 |
);
|
338 |
}
|
339 |
-
|
340 |
-
} else if ( 'update' === $action ) {
|
341 |
|
342 |
$data = ! empty( $_POST['wtlwp_data'] ) ? $_POST['wtlwp_data'] : array();
|
343 |
|
@@ -356,8 +355,6 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
356 |
'message' => 'default_error_message',
|
357 |
);
|
358 |
}
|
359 |
-
|
360 |
-
|
361 |
} else {
|
362 |
$result = array(
|
363 |
'status' => 'error',
|
@@ -378,48 +375,41 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
378 |
*/
|
379 |
public function display_admin_notices() {
|
380 |
|
381 |
-
if ( empty( $_REQUEST['page'] ) || ( empty( $_REQUEST['page'] ) && 'wp-temporary-login-without-password' !== $_REQUEST['page'] ) || ! isset( $_REQUEST['wtlwp_message'] ) || ( ! isset( $_REQUEST['wtlwp_error'] ) && ! isset( $_REQUEST['wtlwp_success'] ) ) ) {
|
382 |
return;
|
383 |
}
|
384 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
385 |
$class = $message = '';
|
386 |
-
$error = ! empty( $_REQUEST['wtlwp_error'] ) ? true : false;
|
387 |
-
$success = ! empty( $_REQUEST['wtlwp_success'] ) ? true : false;
|
388 |
if ( $error ) {
|
389 |
$message_type = ! empty( $_REQUEST['wtlwp_message'] ) ? $_REQUEST['wtlwp_message'] : 'default_error_message';
|
390 |
-
|
391 |
-
$
|
392 |
-
'user_creation_failed' => __( 'User creation failed', 'temporary-login-without-password' ),
|
393 |
-
'unathorised_access' => __( 'You do not have permission to create a temporary login', 'temporary-login-without-password' ),
|
394 |
-
'email_is_in_use' => __( 'Email is already in use', 'temporary-login-without-password' ),
|
395 |
-
'empty_email' => __( 'Please enter valid email address. Email field should not be empty', 'temporary-login-without-password' ),
|
396 |
-
'not_valid_email' => __( 'Please enter valid email address', 'temporary-login-without-password' ),
|
397 |
-
'is_not_temporary_login' => __( 'User you are trying to delete is not temporary', 'temporary-login-without-password' ),
|
398 |
-
'nonce_failed' => __( 'Nonce failed', 'temporary-login-without-password' ),
|
399 |
-
'invalid_action' => __( 'Invalid action', 'temporary-login-without-password' ),
|
400 |
-
'default_error_message' => __( 'Unknown error occured', 'temporary-login-without-password' )
|
401 |
-
);
|
402 |
-
|
403 |
-
$message = $messages[ $message_type ];
|
404 |
-
|
405 |
-
$class = 'error';
|
406 |
} elseif ( $success ) {
|
407 |
$message_type = ! empty( $_REQUEST['wtlwp_message'] ) ? $_REQUEST['wtlwp_message'] : 'default_success_message';
|
408 |
-
|
409 |
-
$
|
410 |
-
|
411 |
-
'user_updated' => __( 'Login updated successfully!', 'temporary-login-without-password' ),
|
412 |
-
'user_deleted' => __( 'Login deleted successfully!', 'temporary-login-without-password' ),
|
413 |
-
'login_disabled' => __( 'Login disabled successfully!', 'temporary-login-without-password' ),
|
414 |
-
'login_enabled' => __( 'Login enabled successfully!', 'temporary-login-without-password' ),
|
415 |
-
'settings_updated' => __( 'Settings have been updated successfully', 'temporary-login-without-password' ),
|
416 |
-
'default_success_message' => __( 'Success!', 'temporary-login-without-password' )
|
417 |
-
);
|
418 |
-
|
419 |
-
$message = $messages[ $message_type ];
|
420 |
-
|
421 |
-
$class = 'updated';
|
422 |
-
}// End if().
|
423 |
|
424 |
$class .= ' notice notice-succe is-dismissible';
|
425 |
|
@@ -436,8 +426,15 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
436 |
}
|
437 |
|
438 |
/**
|
439 |
-
*
|
440 |
* Disable welcome notification for temporary user.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
441 |
*/
|
442 |
public function disable_welcome_notification( $blog_id, $user_id, $password, $title, $meta ) {
|
443 |
|
@@ -466,9 +463,10 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
466 |
|
467 |
if ( isset( $current_screen->id ) && 'users_page_wp-temporary-login-without-password' === $current_screen->id ) {
|
468 |
|
469 |
-
$
|
|
|
470 |
|
471 |
-
// Change the footer text
|
472 |
if ( $can_ask_for_review ) {
|
473 |
$footer_text = sprintf( __( 'If you like <strong>Temporary Login Without Password</strong> plugin, please leave us a %s rating. A huge thanks in advance!', 'temporary-login-without-password' ), '<a href="https://wordpress.org/support/plugin/temporary-login-without-password/reviews" target="_blank" class="tlwp-rating-link" data-rated="' . esc_attr__( 'Thank You :) ', 'temporary-login-without-password' ) . '">★★★★★</a>' );
|
474 |
} else {
|
@@ -501,29 +499,6 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
501 |
wp_die();
|
502 |
}
|
503 |
|
504 |
-
/**
|
505 |
-
* Can we ask user for review?
|
506 |
-
*
|
507 |
-
* @since 1.4.5
|
508 |
-
*/
|
509 |
-
public static function can_ask_for_review() {
|
510 |
-
|
511 |
-
$current_user_id = get_current_user_id();
|
512 |
-
|
513 |
-
$tlwp_nobug = get_user_meta( $current_user_id, 'tlwp_no_bug', true );
|
514 |
-
$tlwp_rated = get_user_meta( $current_user_id, 'tlwp_admin_footer_text_rated', true );
|
515 |
-
$tlwp_rated_header = get_user_meta( $current_user_id, 'tlwp_admin_header_text_rated', true );
|
516 |
-
|
517 |
-
$temporary_logins = Wp_Temporary_Login_Without_Password_Common::get_temporary_logins();
|
518 |
-
$total_logins = count( $temporary_logins );
|
519 |
-
|
520 |
-
if ( $tlwp_nobug || $tlwp_rated || $tlwp_rated_header || ( $total_logins < 1 ) ) {
|
521 |
-
return false;
|
522 |
-
}
|
523 |
-
|
524 |
-
return true;
|
525 |
-
}
|
526 |
-
|
527 |
/**
|
528 |
* Prepare a HTML for the review
|
529 |
*
|
@@ -535,8 +510,8 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
535 |
|
536 |
$nobug = '';
|
537 |
|
538 |
-
if ( isset( $_GET['
|
539 |
-
$nobug = absint( esc_attr( wp_unslash( $_GET['
|
540 |
}
|
541 |
|
542 |
if ( 1 === $nobug ) {
|
@@ -544,17 +519,18 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
544 |
update_user_meta( $current_user_id, 'tlwp_no_bug_time', time() );
|
545 |
}
|
546 |
|
547 |
-
$
|
|
|
548 |
|
549 |
if ( $can_ask_for_review ) {
|
550 |
|
551 |
$reviewurl = 'https://wordpress.org/support/plugin/temporary-login-without-password/reviews/';
|
552 |
|
553 |
-
$nobugurl = add_query_arg( '
|
554 |
|
555 |
echo '<div class="notice notice-warning">';
|
556 |
|
557 |
-
echo sprintf( __( '<p>You have been using <b>Temporary Login Without Password</b> plugin, do you like it? If so, please leave us a review with your feedback! <a href="%s" class="tlwp-rating-link-header" target="_blank" data-rated="' . esc_attr__( 'Thank You :) ', 'temporary-login-without-password' ) . '">Leave A Review</a> <a href="%s">No, Thanks</a></p>' ), $reviewurl, $nobugurl );
|
558 |
|
559 |
echo '</div>';
|
560 |
}
|
@@ -564,10 +540,10 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
564 |
*
|
565 |
* Disable plugin deactivation link for the temporary user
|
566 |
*
|
567 |
-
* @param $actions
|
568 |
-
* @param $plugin_file
|
569 |
-
* @param $plugin_data
|
570 |
-
* @param $context
|
571 |
*
|
572 |
* @since 1.4.5
|
573 |
*
|
@@ -587,7 +563,7 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
587 |
/**
|
588 |
* Add settings link
|
589 |
*
|
590 |
-
* @param $links
|
591 |
*
|
592 |
* @since 1.5.7
|
593 |
*
|
@@ -618,16 +594,17 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
618 |
|
619 |
if ( $is_valid_temporary_user ) {
|
620 |
// Add the main site admin menu item.
|
621 |
-
$wp_admin_bar->add_menu(
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
|
|
|
|
628 |
}
|
629 |
|
630 |
-
|
631 |
return true;
|
632 |
|
633 |
}
|
8 |
* @since 1.0
|
9 |
* @package Temporary Login Without Password
|
10 |
*/
|
|
|
11 |
class Wp_Temporary_Login_Without_Password_Admin {
|
|
|
12 |
/**
|
13 |
+
* Plugin Name
|
14 |
+
*
|
15 |
* @var string $plugin_name
|
16 |
*
|
17 |
* @since 1.0
|
19 |
private $plugin_name;
|
20 |
|
21 |
/**
|
22 |
+
* Plugin Version
|
23 |
+
*
|
24 |
* @var string $version
|
25 |
*
|
26 |
* @since 1.0
|
28 |
private $version;
|
29 |
|
30 |
/**
|
31 |
+
* Initialize Admin Class
|
32 |
*
|
33 |
* @param string $plugin_name
|
34 |
* @param string $version
|
80 |
public function admin_menu() {
|
81 |
$current_user_id = get_current_user_id();
|
82 |
if ( ! Wp_Temporary_Login_Without_Password_Common::is_valid_temporary_login( $current_user_id ) ) {
|
83 |
+
add_users_page(
|
84 |
+
__( 'Temporary Logins', 'temporary-login-without-password' ), __( 'Temporary Logins', 'temporary-login-without-password' ), apply_filters( 'tempadmin_user_cap', 'manage_options' ), 'wp-temporary-login-without-password', array(
|
85 |
+
__class__,
|
86 |
+
'admin_settings',
|
87 |
+
)
|
88 |
+
);
|
89 |
}
|
90 |
}
|
91 |
|
92 |
/**
|
93 |
* Manage admin settings
|
94 |
*
|
95 |
+
* @return void
|
96 |
+
*
|
97 |
* @since 1.0
|
98 |
*/
|
99 |
public static function admin_settings() {
|
100 |
+
|
101 |
$active_tab = ! empty( $_GET['tab'] ) ? $_GET['tab'] : 'home';
|
102 |
+
$_template_file = WTLWP_PLUGIN_DIR . '/templates/admin-settings.php';
|
103 |
$wtlwp_generated_url = ! empty( $_REQUEST['wtlwp_generated_url'] ) ? $_REQUEST['wtlwp_generated_url'] : '';
|
104 |
+
$user_email = ! empty( $_REQUEST['user_email'] ) ? sanitize_email( $_REQUEST['user_email'] ) : '';
|
105 |
$tlwp_settings = maybe_unserialize( get_option( 'tlwp_settings', array() ) );
|
106 |
$action = ! empty( $_GET['action'] ) ? $_GET['action'] : '';
|
107 |
$user_id = ! empty( $_GET['user_id'] ) ? $_GET['user_id'] : '';
|
112 |
}
|
113 |
|
114 |
if ( ! empty( $wtlwp_generated_url ) ) {
|
115 |
+
$mailto_link = Wp_Temporary_Login_Without_Password_Common::generate_mailto_link( $user_email, $wtlwp_generated_url );
|
116 |
}
|
117 |
|
118 |
$default_role = ( ! empty( $tlwp_settings ) && isset( $tlwp_settings['default_role'] ) ) ? $tlwp_settings['default_role'] : 'administrator';
|
124 |
/**
|
125 |
* Create a Temporary user
|
126 |
*
|
127 |
+
* @return void
|
128 |
+
*
|
129 |
* @since 1.0
|
130 |
*/
|
131 |
public function create_user() {
|
132 |
|
|
|
133 |
if ( empty( $_POST['wtlwp_data'] ) || empty( $_POST['wtlwp-nonce'] ) || ( ! empty( $_POST['wtlwp_action'] ) && 'update' === $_POST['wtlwp_action'] ) ) {
|
134 |
return;
|
135 |
}
|
137 |
$data = $_POST['wtlwp_data'];
|
138 |
$email = $data['user_email'];
|
139 |
$error = true;
|
140 |
+
$result = array(
|
141 |
+
'status' => 'error',
|
142 |
+
);
|
143 |
|
144 |
$redirect_link = '';
|
145 |
if ( false == Wp_Temporary_Login_Without_Password_Common::can_manage_wtlwp() ) {
|
146 |
+
$result['message'] = 'unathorised_access';
|
|
|
|
|
|
|
147 |
} elseif ( ! wp_verify_nonce( $_POST['wtlwp-nonce'], 'wtlwp_generate_login_url' ) ) {
|
148 |
+
$result['message'] = 'nonce_failed';
|
|
|
|
|
|
|
149 |
} elseif ( empty( $data['user_email'] ) ) {
|
150 |
+
$result['message'] = 'empty_email';
|
|
|
|
|
|
|
151 |
} elseif ( ! is_email( $email ) ) {
|
152 |
+
$result['message'] = 'not_valid_email';
|
|
|
|
|
|
|
153 |
} elseif ( ! empty( $data['user_email'] ) && email_exists( $data['user_email'] ) ) {
|
154 |
+
$result['message'] = 'email_is_in_use';
|
|
|
|
|
|
|
155 |
} else {
|
156 |
$error = false;
|
157 |
}
|
158 |
|
159 |
if ( ! $error ) {
|
160 |
$user = Wp_Temporary_Login_Without_Password_Common::create_new_user( $data );
|
161 |
+
if ( isset( $user['error'] ) && $user['error'] === true ) {
|
162 |
$result = array(
|
163 |
'status' => 'error',
|
164 |
'message' => 'user_creation_failed',
|
165 |
);
|
166 |
} else {
|
167 |
+
$result = array(
|
168 |
'status' => 'success',
|
169 |
'message' => 'user_created',
|
170 |
);
|
171 |
+
|
172 |
+
$user_id = isset( $user['user_id'] ) ? $user['user_id'] : 0;
|
173 |
$redirect_link = Wp_Temporary_Login_Without_Password_Common::get_redirect_link( $result );
|
174 |
+
$redirect_link = add_query_arg( 'wtlwp_generated_url', Wp_Temporary_Login_Without_Password_Common::get_login_url( $user_id ), $redirect_link );
|
175 |
$redirect_link = add_query_arg( 'user_email', $email, $redirect_link );
|
176 |
}
|
177 |
}
|
180 |
$redirect_link = Wp_Temporary_Login_Without_Password_Common::get_redirect_link( $result );
|
181 |
}
|
182 |
|
183 |
+
wp_safe_redirect( $redirect_link, 302 );
|
184 |
exit();
|
185 |
}
|
186 |
|
187 |
/**
|
188 |
* Manage settings
|
189 |
*
|
190 |
+
* @return Void
|
191 |
+
*
|
192 |
* @since 1.4.6
|
193 |
*/
|
194 |
public function update_tlwp_settings() {
|
249 |
'disable',
|
250 |
'enable',
|
251 |
'delete',
|
252 |
+
'update',
|
253 |
);
|
254 |
|
255 |
if ( ! in_array( $action, $valid_actions ) ) {
|
336 |
'message' => 'default_error_message',
|
337 |
);
|
338 |
}
|
339 |
+
} elseif ( 'update' === $action ) {
|
|
|
340 |
|
341 |
$data = ! empty( $_POST['wtlwp_data'] ) ? $_POST['wtlwp_data'] : array();
|
342 |
|
355 |
'message' => 'default_error_message',
|
356 |
);
|
357 |
}
|
|
|
|
|
358 |
} else {
|
359 |
$result = array(
|
360 |
'status' => 'error',
|
375 |
*/
|
376 |
public function display_admin_notices() {
|
377 |
|
378 |
+
if ( empty( $_REQUEST['page'] ) || ( empty( $_REQUEST['page'] ) && 'wp-temporary-login-without-password' !== $_REQUEST['page'] ) || ! isset( $_REQUEST['wtlwp_message'] ) || ( ! isset( $_REQUEST['wtlwp_error'] ) && ! isset( $_REQUEST['wtlwp_success'] ) ) ) { // Input var okay.
|
379 |
return;
|
380 |
}
|
381 |
|
382 |
+
$messages = array(
|
383 |
+
'user_creation_failed' => __( 'User creation failed', 'temporary-login-without-password' ),
|
384 |
+
'unathorised_access' => __( 'You do not have permission to create a temporary login', 'temporary-login-without-password' ),
|
385 |
+
'email_is_in_use' => __( 'Email is already in use', 'temporary-login-without-password' ),
|
386 |
+
'empty_email' => __( 'Please enter valid email address. Email field should not be empty', 'temporary-login-without-password' ),
|
387 |
+
'not_valid_email' => __( 'Please enter valid email address', 'temporary-login-without-password' ),
|
388 |
+
'is_not_temporary_login' => __( 'User you are trying to delete is not temporary', 'temporary-login-without-password' ),
|
389 |
+
'nonce_failed' => __( 'Nonce failed', 'temporary-login-without-password' ),
|
390 |
+
'invalid_action' => __( 'Invalid action', 'temporary-login-without-password' ),
|
391 |
+
'default_error_message' => __( 'Unknown error occured', 'temporary-login-without-password' ),
|
392 |
+
'user_created' => __( 'Login created successfully!', 'temporary-login-without-password' ),
|
393 |
+
'user_updated' => __( 'Login updated successfully!', 'temporary-login-without-password' ),
|
394 |
+
'user_deleted' => __( 'Login deleted successfully!', 'temporary-login-without-password' ),
|
395 |
+
'login_disabled' => __( 'Login disabled successfully!', 'temporary-login-without-password' ),
|
396 |
+
'login_enabled' => __( 'Login enabled successfully!', 'temporary-login-without-password' ),
|
397 |
+
'settings_updated' => __( 'Settings have been updated successfully', 'temporary-login-without-password' ),
|
398 |
+
'default_success_message' => __( 'Success!', 'temporary-login-without-password' ),
|
399 |
+
);
|
400 |
+
|
401 |
$class = $message = '';
|
402 |
+
$error = ! empty( $_REQUEST['wtlwp_error'] ) ? true : false; // Input var okay.
|
403 |
+
$success = ! empty( $_REQUEST['wtlwp_success'] ) ? true : false; // Input var okay.
|
404 |
if ( $error ) {
|
405 |
$message_type = ! empty( $_REQUEST['wtlwp_message'] ) ? $_REQUEST['wtlwp_message'] : 'default_error_message';
|
406 |
+
$message = $messages[ $message_type ];
|
407 |
+
$class = 'error';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
408 |
} elseif ( $success ) {
|
409 |
$message_type = ! empty( $_REQUEST['wtlwp_message'] ) ? $_REQUEST['wtlwp_message'] : 'default_success_message';
|
410 |
+
$message = $messages[ $message_type ];
|
411 |
+
$class = 'updated';
|
412 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
413 |
|
414 |
$class .= ' notice notice-succe is-dismissible';
|
415 |
|
426 |
}
|
427 |
|
428 |
/**
|
|
|
429 |
* Disable welcome notification for temporary user.
|
430 |
+
*
|
431 |
+
* @param int $blog_id
|
432 |
+
* @param int $user_id
|
433 |
+
* @param string $password
|
434 |
+
* @param string $title
|
435 |
+
* @param string $meta
|
436 |
+
*
|
437 |
+
* @return bool
|
438 |
*/
|
439 |
public function disable_welcome_notification( $blog_id, $user_id, $password, $title, $meta ) {
|
440 |
|
463 |
|
464 |
if ( isset( $current_screen->id ) && 'users_page_wp-temporary-login-without-password' === $current_screen->id ) {
|
465 |
|
466 |
+
$current_user_id = get_current_user_id();
|
467 |
+
$can_ask_for_review = Wp_Temporary_Login_Without_Password_Common::can_ask_for_review( $current_user_id );
|
468 |
|
469 |
+
// Change the footer text.
|
470 |
if ( $can_ask_for_review ) {
|
471 |
$footer_text = sprintf( __( 'If you like <strong>Temporary Login Without Password</strong> plugin, please leave us a %s rating. A huge thanks in advance!', 'temporary-login-without-password' ), '<a href="https://wordpress.org/support/plugin/temporary-login-without-password/reviews" target="_blank" class="tlwp-rating-link" data-rated="' . esc_attr__( 'Thank You :) ', 'temporary-login-without-password' ) . '">★★★★★</a>' );
|
472 |
} else {
|
499 |
wp_die();
|
500 |
}
|
501 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
502 |
/**
|
503 |
* Prepare a HTML for the review
|
504 |
*
|
510 |
|
511 |
$nobug = '';
|
512 |
|
513 |
+
if ( isset( $_GET['tlwp_nobug'] ) ) { // Input var okay.
|
514 |
+
$nobug = absint( esc_attr( wp_unslash( $_GET['tlwp_nobug'] ) ) );
|
515 |
}
|
516 |
|
517 |
if ( 1 === $nobug ) {
|
519 |
update_user_meta( $current_user_id, 'tlwp_no_bug_time', time() );
|
520 |
}
|
521 |
|
522 |
+
$current_user_id = get_current_user_id();
|
523 |
+
$can_ask_for_review = Wp_Temporary_Login_Without_Password_Common::can_ask_for_review( $current_user_id );
|
524 |
|
525 |
if ( $can_ask_for_review ) {
|
526 |
|
527 |
$reviewurl = 'https://wordpress.org/support/plugin/temporary-login-without-password/reviews/';
|
528 |
|
529 |
+
$nobugurl = add_query_arg( 'tlwp_nobug', 1, menu_page_url( 'wp-temporary-login-without-password', false ) );
|
530 |
|
531 |
echo '<div class="notice notice-warning">';
|
532 |
|
533 |
+
echo sprintf( __( '<p>You have been using <b>Temporary Login Without Password</b> plugin, do you like it? If so, please leave us a review with your feedback! <a href="%s" class="tlwp-rating-link-header" target="_blank" data-rated="' . esc_attr__( 'Thank You :) ', 'temporary-login-without-password' ) . '">Leave A Review</a> <a href="%s">No, Thanks</a></p>' ), esc_url( $reviewurl ), esc_url( $nobugurl ) );
|
534 |
|
535 |
echo '</div>';
|
536 |
}
|
540 |
*
|
541 |
* Disable plugin deactivation link for the temporary user
|
542 |
*
|
543 |
+
* @param array $actions
|
544 |
+
* @param string $plugin_file
|
545 |
+
* @param array $plugin_data
|
546 |
+
* @param string $context
|
547 |
*
|
548 |
* @since 1.4.5
|
549 |
*
|
563 |
/**
|
564 |
* Add settings link
|
565 |
*
|
566 |
+
* @param array $links
|
567 |
*
|
568 |
* @since 1.5.7
|
569 |
*
|
594 |
|
595 |
if ( $is_valid_temporary_user ) {
|
596 |
// Add the main site admin menu item.
|
597 |
+
$wp_admin_bar->add_menu(
|
598 |
+
array(
|
599 |
+
'id' => 'temporay-access-notice',
|
600 |
+
'href' => admin_url(),
|
601 |
+
'parent' => 'top-secondary',
|
602 |
+
'title' => __( 'Temporary Access', 'temporary-login-without-password' ),
|
603 |
+
'meta' => array( 'class' => 'temporay-access-mode-active' ),
|
604 |
+
)
|
605 |
+
);
|
606 |
}
|
607 |
|
|
|
608 |
return true;
|
609 |
|
610 |
}
|
admin/css/wp-temporary-login-without-password-admin.css
CHANGED
@@ -1,108 +1,108 @@
|
|
1 |
.wtlwp-form {
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
}
|
6 |
|
7 |
.new-wtlwp-form {
|
8 |
-
|
9 |
}
|
10 |
|
11 |
.wtlwp-form-input {
|
12 |
-
|
13 |
}
|
14 |
|
15 |
.widefat .wtlwp-status {
|
16 |
-
|
17 |
}
|
18 |
|
19 |
.wtlwp-status-active {
|
20 |
-
|
21 |
}
|
22 |
|
23 |
.wtlwp-status-expired {
|
24 |
-
|
25 |
}
|
26 |
|
27 |
.wtlwp-status:after {
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
}
|
39 |
|
40 |
.wtlwp-status-active:after {
|
41 |
-
|
42 |
-
|
43 |
}
|
44 |
|
45 |
.wtlwp-status-expired:after {
|
46 |
-
|
47 |
-
|
48 |
}
|
49 |
|
50 |
.cancel-new-login-form, .cancel-update-login-form {
|
51 |
-
|
52 |
}
|
53 |
|
54 |
.wtlwp-wide-input {
|
55 |
-
|
56 |
}
|
57 |
|
58 |
.generated-wtlwp-login-link {
|
59 |
-
|
60 |
-
|
61 |
}
|
62 |
|
63 |
.wtlwp-form-row {
|
64 |
-
|
65 |
}
|
66 |
|
67 |
.wtlwp-form-submit-button {
|
68 |
-
|
69 |
}
|
70 |
|
71 |
.wtlwp-user-login {
|
72 |
-
|
73 |
}
|
74 |
|
75 |
.wtlwp-copy-to-clipboard, .wtlwp-click-to-copy-btn {
|
76 |
-
|
77 |
}
|
78 |
|
79 |
.wtlwp-copy-to-clipboard:hover {
|
80 |
-
|
81 |
}
|
82 |
|
83 |
.copied-text-message {
|
84 |
-
|
85 |
}
|
86 |
|
87 |
.wtlp-role-radio, .wtlp-role-checkbox {
|
88 |
-
|
89 |
-
|
90 |
}
|
91 |
|
92 |
.tlwp-role-name {
|
93 |
-
|
94 |
}
|
95 |
|
96 |
.visible-roles-dropdown {
|
97 |
-
|
98 |
-
|
99 |
}
|
100 |
|
101 |
.default-role-dropdown {
|
102 |
-
|
103 |
}
|
104 |
|
105 |
#wpadminbar .temporay-access-mode-active > .ab-item {
|
106 |
-
|
107 |
-
|
108 |
-
}
|
1 |
.wtlwp-form {
|
2 |
+
background-color: white;
|
3 |
+
border: 1px solid;
|
4 |
+
padding: 10px;
|
5 |
}
|
6 |
|
7 |
.new-wtlwp-form {
|
8 |
+
display: none;
|
9 |
}
|
10 |
|
11 |
.wtlwp-form-input {
|
12 |
+
width: 300px !important;
|
13 |
}
|
14 |
|
15 |
.widefat .wtlwp-status {
|
16 |
+
width: 40px;
|
17 |
}
|
18 |
|
19 |
.wtlwp-status-active {
|
20 |
+
color: #008000 !important;
|
21 |
}
|
22 |
|
23 |
.wtlwp-status-expired {
|
24 |
+
color: #FF0000 !important;
|
25 |
}
|
26 |
|
27 |
.wtlwp-status:after {
|
28 |
+
border-radius: 32px;
|
29 |
+
color: #fff;
|
30 |
+
display: block;
|
31 |
+
font-size: 11px;
|
32 |
+
font-weight: bold;
|
33 |
+
height: 16px;
|
34 |
+
line-height: 17px;
|
35 |
+
margin-left: 8px;
|
36 |
+
text-align: center;
|
37 |
+
width: 16px;
|
38 |
}
|
39 |
|
40 |
.wtlwp-status-active:after {
|
41 |
+
background: #008000 none repeat scroll 0 0;
|
42 |
+
content: "";
|
43 |
}
|
44 |
|
45 |
.wtlwp-status-expired:after {
|
46 |
+
background: #FF0000 none repeat scroll 0 0;
|
47 |
+
content: "";
|
48 |
}
|
49 |
|
50 |
.cancel-new-login-form, .cancel-update-login-form {
|
51 |
+
cursor: pointer;
|
52 |
}
|
53 |
|
54 |
.wtlwp-wide-input {
|
55 |
+
width: 60%;
|
56 |
}
|
57 |
|
58 |
.generated-wtlwp-login-link {
|
59 |
+
border: 1px solid;
|
60 |
+
padding: 10px 10px 10px 10px;
|
61 |
}
|
62 |
|
63 |
.wtlwp-form-row {
|
64 |
+
padding-left: 20px !important;
|
65 |
}
|
66 |
|
67 |
.wtlwp-form-submit-button {
|
68 |
+
width: 115px;
|
69 |
}
|
70 |
|
71 |
.wtlwp-user-login {
|
72 |
+
font-size: 12px;
|
73 |
}
|
74 |
|
75 |
.wtlwp-copy-to-clipboard, .wtlwp-click-to-copy-btn {
|
76 |
+
cursor: pointer;
|
77 |
}
|
78 |
|
79 |
.wtlwp-copy-to-clipboard:hover {
|
80 |
+
color: #0073aa;
|
81 |
}
|
82 |
|
83 |
.copied-text-message {
|
84 |
+
padding: 0 20px 20px 20px;
|
85 |
}
|
86 |
|
87 |
.wtlp-role-radio, .wtlp-role-checkbox {
|
88 |
+
text-align: center;
|
89 |
+
padding-top: 10px;
|
90 |
}
|
91 |
|
92 |
.tlwp-role-name {
|
93 |
+
padding-top: 10px;
|
94 |
}
|
95 |
|
96 |
.visible-roles-dropdown {
|
97 |
+
min-height: 100px !important;
|
98 |
+
width: 200px;
|
99 |
}
|
100 |
|
101 |
.default-role-dropdown {
|
102 |
+
width: 200px;
|
103 |
}
|
104 |
|
105 |
#wpadminbar .temporay-access-mode-active > .ab-item {
|
106 |
+
color: #fff;
|
107 |
+
background-color: #ffba00;
|
108 |
+
}
|
admin/js/clipboard.js
CHANGED
@@ -4,746 +4,791 @@
|
|
4 |
*
|
5 |
* Licensed MIT © Zeno Rocha
|
6 |
*/
|
7 |
-
(function(f){if (typeof exports === "object"
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
}
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
}
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
572 |
}
|
573 |
-
|
574 |
-
get: function get() {
|
575 |
-
return this._target;
|
576 |
-
}
|
577 |
-
}]);
|
578 |
-
|
579 |
-
return ClipboardAction;
|
580 |
-
}();
|
581 |
-
|
582 |
-
module.exports = ClipboardAction;
|
583 |
-
});
|
584 |
-
|
585 |
-
},{"select":6}],9:[function(require,module,exports){
|
586 |
-
(function (global, factory) {
|
587 |
-
if (typeof define === "function" && define.amd) {
|
588 |
-
define( ['module', './clipboard-action', 'tiny-emitter', 'good-listener'], factory );
|
589 |
-
} else if (typeof exports !== "undefined") {
|
590 |
-
factory( module, require( './clipboard-action' ), require( 'tiny-emitter' ), require( 'good-listener' ) );
|
591 |
-
} else {
|
592 |
-
var mod = {
|
593 |
-
exports: {}
|
594 |
-
};
|
595 |
-
factory( mod, global.clipboardAction, global.tinyEmitter, global.goodListener );
|
596 |
-
global.clipboard = mod.exports;
|
597 |
-
}
|
598 |
-
})(this, function (module, _clipboardAction, _tinyEmitter, _goodListener) {
|
599 |
-
'use strict';
|
600 |
-
|
601 |
-
var _clipboardAction2 = _interopRequireDefault( _clipboardAction );
|
602 |
-
|
603 |
-
var _tinyEmitter2 = _interopRequireDefault( _tinyEmitter );
|
604 |
-
|
605 |
-
var _goodListener2 = _interopRequireDefault( _goodListener );
|
606 |
-
|
607 |
-
function _interopRequireDefault(obj) {
|
608 |
-
return obj && obj.__esModule ? obj : {
|
609 |
-
default: obj
|
610 |
-
};
|
611 |
-
}
|
612 |
-
|
613 |
-
function _classCallCheck(instance, Constructor) {
|
614 |
-
if ( ! (instance instanceof Constructor)) {
|
615 |
-
throw new TypeError( "Cannot call a class as a function" );
|
616 |
-
}
|
617 |
-
}
|
618 |
-
|
619 |
-
function _possibleConstructorReturn(self, call) {
|
620 |
-
if ( ! self) {
|
621 |
-
throw new ReferenceError( "this hasn't been initialised - super() hasn't been called" );
|
622 |
-
}
|
623 |
-
|
624 |
-
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
625 |
-
}
|
626 |
-
|
627 |
-
function _inherits(subClass, superClass) {
|
628 |
-
if (typeof superClass !== "function" && superClass !== null) {
|
629 |
-
throw new TypeError( "Super expression must either be null or a function, not " + typeof superClass );
|
630 |
-
}
|
631 |
-
|
632 |
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
633 |
-
constructor: {
|
634 |
-
value: subClass,
|
635 |
-
enumerable: false,
|
636 |
-
writable: true,
|
637 |
-
configurable: true
|
638 |
-
}
|
639 |
-
});
|
640 |
-
if (superClass) { Object.setPrototypeOf ? Object.setPrototypeOf( subClass, superClass ) : subClass.__proto__ = superClass;
|
641 |
-
}
|
642 |
-
}
|
643 |
-
|
644 |
-
var Clipboard = function (_Emitter) {
|
645 |
-
_inherits( Clipboard, _Emitter );
|
646 |
-
|
647 |
-
/**
|
648 |
-
* @param {String|HTMLElement|HTMLCollection|NodeList} trigger
|
649 |
-
* @param {Object} options
|
650 |
-
*/
|
651 |
-
|
652 |
-
function Clipboard(trigger, options) {
|
653 |
-
_classCallCheck( this, Clipboard );
|
654 |
-
|
655 |
-
var _this = _possibleConstructorReturn( this, _Emitter.call( this ) );
|
656 |
-
|
657 |
-
_this.resolveOptions( options );
|
658 |
-
_this.listenClick( trigger );
|
659 |
-
return _this;
|
660 |
-
}
|
661 |
-
|
662 |
-
/**
|
663 |
-
* Defines if attributes would be resolved using internal setter functions
|
664 |
-
* or custom functions that were passed in the constructor.
|
665 |
-
*
|
666 |
-
* @param {Object} options
|
667 |
-
*/
|
668 |
-
|
669 |
-
Clipboard.prototype.resolveOptions = function resolveOptions() {
|
670 |
-
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
|
671 |
-
|
672 |
-
this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
|
673 |
-
this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
|
674 |
-
this.text = typeof options.text === 'function' ? options.text : this.defaultText;
|
675 |
-
};
|
676 |
-
|
677 |
-
Clipboard.prototype.listenClick = function listenClick(trigger) {
|
678 |
-
var _this2 = this;
|
679 |
-
|
680 |
-
this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
|
681 |
-
return _this2.onClick( e );
|
682 |
-
});
|
683 |
-
};
|
684 |
-
|
685 |
-
Clipboard.prototype.onClick = function onClick(e) {
|
686 |
-
var trigger = e.delegateTarget || e.currentTarget;
|
687 |
-
|
688 |
-
if (this.clipboardAction) {
|
689 |
-
this.clipboardAction = null;
|
690 |
-
}
|
691 |
-
|
692 |
-
this.clipboardAction = new _clipboardAction2.default({
|
693 |
-
action: this.action( trigger ),
|
694 |
-
target: this.target( trigger ),
|
695 |
-
text: this.text( trigger ),
|
696 |
-
trigger: trigger,
|
697 |
-
emitter: this
|
698 |
-
});
|
699 |
-
};
|
700 |
-
|
701 |
-
Clipboard.prototype.defaultAction = function defaultAction(trigger) {
|
702 |
-
return getAttributeValue( 'action', trigger );
|
703 |
-
};
|
704 |
-
|
705 |
-
Clipboard.prototype.defaultTarget = function defaultTarget(trigger) {
|
706 |
-
var selector = getAttributeValue( 'target', trigger );
|
707 |
-
|
708 |
-
if (selector) {
|
709 |
-
return document.querySelector( selector );
|
710 |
-
}
|
711 |
-
};
|
712 |
-
|
713 |
-
Clipboard.prototype.defaultText = function defaultText(trigger) {
|
714 |
-
return getAttributeValue( 'text', trigger );
|
715 |
-
};
|
716 |
-
|
717 |
-
Clipboard.prototype.destroy = function destroy() {
|
718 |
-
this.listener.destroy();
|
719 |
-
|
720 |
-
if (this.clipboardAction) {
|
721 |
-
this.clipboardAction.destroy();
|
722 |
-
this.clipboardAction = null;
|
723 |
-
}
|
724 |
-
};
|
725 |
-
|
726 |
-
return Clipboard;
|
727 |
-
}(_tinyEmitter2.default);
|
728 |
-
|
729 |
-
/**
|
730 |
-
* Helper function to retrieve attribute value.
|
731 |
-
*
|
732 |
-
* @param {String} suffix
|
733 |
-
* @param {Element} element
|
734 |
-
*/
|
735 |
-
function getAttributeValue(suffix, element) {
|
736 |
-
var attribute = 'data-clipboard-' + suffix;
|
737 |
-
|
738 |
-
if ( ! element.hasAttribute( attribute )) {
|
739 |
-
return;
|
740 |
-
}
|
741 |
-
|
742 |
-
return element.getAttribute( attribute );
|
743 |
-
}
|
744 |
-
|
745 |
-
module.exports = Clipboard;
|
746 |
-
});
|
747 |
-
|
748 |
-
},{"./clipboard-action":8,"good-listener":4,"tiny-emitter":7}]},{},[9])(9)
|
749 |
-
});
|
4 |
*
|
5 |
* Licensed MIT © Zeno Rocha
|
6 |
*/
|
7 |
+
(function(f){if (typeof exports === "object" && typeof module !== "undefined") {
|
8 |
+
module.exports = f()} else if (typeof define === "function" && define.amd) {
|
9 |
+
define( [],f )} else {
|
10 |
+
var g;if (typeof window !== "undefined") {
|
11 |
+
g = window} else if (typeof global !== "undefined") {
|
12 |
+
g = global} else if (typeof self !== "undefined") {
|
13 |
+
g = self} else {
|
14 |
+
g = this}g.Clipboard = f()}})(
|
15 |
+
function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if ( ! n[o]) {
|
16 |
+
if ( ! t[o]) {
|
17 |
+
var a = typeof require == "function" && require;if ( ! u && a) {
|
18 |
+
return a( o, ! 0 );
|
19 |
+
}if (i) {
|
20 |
+
return i( o, ! 0 );
|
21 |
+
}var f = new Error( "Cannot find module '" + o + "'" );throw f.code = "MODULE_NOT_FOUND",f}var l = n[o] = {exports:{}};t[o][0].call( l.exports,function(e){var n = t[o][1][e];return s( n ? n : e )},l,l.exports,e,t,n,r )}return n[o].exports}var i = typeof require == "function" && require;for (var o = 0;o < r.length;o++) {
|
22 |
+
s( r[o] );
|
23 |
+
}return s})(
|
24 |
+
{1:[function(require,module,exports){
|
25 |
+
var matches = require( 'matches-selector' )
|
26 |
+
|
27 |
+
module.exports = function (element, selector, checkYoSelf) {
|
28 |
+
var parent = checkYoSelf ? element : element.parentNode
|
29 |
+
|
30 |
+
while (parent && parent !== document) {
|
31 |
+
if (matches( parent, selector )) {
|
32 |
+
return parent;
|
33 |
+
}
|
34 |
+
parent = parent.parentNode
|
35 |
+
}
|
36 |
+
}
|
37 |
+
|
38 |
+
},{"matches-selector":5}],2:[function(require,module,exports){
|
39 |
+
var closest = require( 'closest' );
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Delegates event to a selector.
|
43 |
+
*
|
44 |
+
* @param {Element} element
|
45 |
+
* @param {String} selector
|
46 |
+
* @param {String} type
|
47 |
+
* @param {Function} callback
|
48 |
+
* @param {Boolean} useCapture
|
49 |
+
* @return {Object}
|
50 |
+
*/
|
51 |
+
function delegate(element, selector, type, callback, useCapture) {
|
52 |
+
var listenerFn = listener.apply( this, arguments );
|
53 |
+
|
54 |
+
element.addEventListener( type, listenerFn, useCapture );
|
55 |
+
|
56 |
+
return {
|
57 |
+
destroy: function() {
|
58 |
+
element.removeEventListener( type, listenerFn, useCapture );
|
59 |
+
}
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Finds closest match and invokes callback.
|
65 |
+
*
|
66 |
+
* @param {Element} element
|
67 |
+
* @param {String} selector
|
68 |
+
* @param {String} type
|
69 |
+
* @param {Function} callback
|
70 |
+
* @return {Function}
|
71 |
+
*/
|
72 |
+
function listener(element, selector, type, callback) {
|
73 |
+
return function(e) {
|
74 |
+
e.delegateTarget = closest( e.target, selector, true );
|
75 |
+
|
76 |
+
if (e.delegateTarget) {
|
77 |
+
callback.call( element, e );
|
78 |
+
}
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
module.exports = delegate;
|
83 |
+
|
84 |
+
},{"closest":1}],3:[function(require,module,exports){
|
85 |
+
/**
|
86 |
+
* Check if argument is a HTML element.
|
87 |
+
*
|
88 |
+
* @param {Object} value
|
89 |
+
* @return {Boolean}
|
90 |
+
*/
|
91 |
+
exports.node = function(value) {
|
92 |
+
return value !== undefined
|
93 |
+
&& value instanceof HTMLElement
|
94 |
+
&& value.nodeType === 1;
|
95 |
+
};
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Check if argument is a list of HTML elements.
|
99 |
+
*
|
100 |
+
* @param {Object} value
|
101 |
+
* @return {Boolean}
|
102 |
+
*/
|
103 |
+
exports.nodeList = function(value) {
|
104 |
+
var type = Object.prototype.toString.call( value );
|
105 |
+
|
106 |
+
return value !== undefined
|
107 |
+
&& (type === '[object NodeList]' || type === '[object HTMLCollection]')
|
108 |
+
&& ('length' in value)
|
109 |
+
&& (value.length === 0 || exports.node( value[0] ));
|
110 |
+
};
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Check if argument is a string.
|
114 |
+
*
|
115 |
+
* @param {Object} value
|
116 |
+
* @return {Boolean}
|
117 |
+
*/
|
118 |
+
exports.string = function(value) {
|
119 |
+
return typeof value === 'string'
|
120 |
+
|| value instanceof String;
|
121 |
+
};
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Check if argument is a function.
|
125 |
+
*
|
126 |
+
* @param {Object} value
|
127 |
+
* @return {Boolean}
|
128 |
+
*/
|
129 |
+
exports.fn = function(value) {
|
130 |
+
var type = Object.prototype.toString.call( value );
|
131 |
+
|
132 |
+
return type === '[object Function]';
|
133 |
+
};
|
134 |
+
|
135 |
+
},{}],4:[function(require,module,exports){
|
136 |
+
var is = require( './is' );
|
137 |
+
var delegate = require( 'delegate' );
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Validates all params and calls the right
|
141 |
+
* listener function based on its target type.
|
142 |
+
*
|
143 |
+
* @param {String|HTMLElement|HTMLCollection|NodeList} target
|
144 |
+
* @param {String} type
|
145 |
+
* @param {Function} callback
|
146 |
+
* @return {Object}
|
147 |
+
*/
|
148 |
+
function listen(target, type, callback) {
|
149 |
+
if ( ! target && ! type && ! callback) {
|
150 |
+
throw new Error( 'Missing required arguments' );
|
151 |
+
}
|
152 |
+
|
153 |
+
if ( ! is.string( type )) {
|
154 |
+
throw new TypeError( 'Second argument must be a String' );
|
155 |
+
}
|
156 |
+
|
157 |
+
if ( ! is.fn( callback )) {
|
158 |
+
throw new TypeError( 'Third argument must be a Function' );
|
159 |
+
}
|
160 |
+
|
161 |
+
if (is.node( target )) {
|
162 |
+
return listenNode( target, type, callback );
|
163 |
+
} else if (is.nodeList( target )) {
|
164 |
+
return listenNodeList( target, type, callback );
|
165 |
+
} else if (is.string( target )) {
|
166 |
+
return listenSelector( target, type, callback );
|
167 |
+
} else {
|
168 |
+
throw new TypeError( 'First argument must be a String, HTMLElement, HTMLCollection, or NodeList' );
|
169 |
+
}
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Adds an event listener to a HTML element
|
174 |
+
* and returns a remove listener function.
|
175 |
+
*
|
176 |
+
* @param {HTMLElement} node
|
177 |
+
* @param {String} type
|
178 |
+
* @param {Function} callback
|
179 |
+
* @return {Object}
|
180 |
+
*/
|
181 |
+
function listenNode(node, type, callback) {
|
182 |
+
node.addEventListener( type, callback );
|
183 |
+
|
184 |
+
return {
|
185 |
+
destroy: function() {
|
186 |
+
node.removeEventListener( type, callback );
|
187 |
+
}
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Add an event listener to a list of HTML elements
|
193 |
+
* and returns a remove listener function.
|
194 |
+
*
|
195 |
+
* @param {NodeList|HTMLCollection} nodeList
|
196 |
+
* @param {String} type
|
197 |
+
* @param {Function} callback
|
198 |
+
* @return {Object}
|
199 |
+
*/
|
200 |
+
function listenNodeList(nodeList, type, callback) {
|
201 |
+
Array.prototype.forEach.call(
|
202 |
+
nodeList, function(node) {
|
203 |
+
node.addEventListener( type, callback );
|
204 |
+
}
|
205 |
+
);
|
206 |
+
|
207 |
+
return {
|
208 |
+
destroy: function() {
|
209 |
+
Array.prototype.forEach.call(
|
210 |
+
nodeList, function(node) {
|
211 |
+
node.removeEventListener( type, callback );
|
212 |
+
}
|
213 |
+
);
|
214 |
+
}
|
215 |
+
}
|
216 |
+
}
|
217 |
+
|
218 |
+
/**
|
219 |
+
* Add an event listener to a selector
|
220 |
+
* and returns a remove listener function.
|
221 |
+
*
|
222 |
+
* @param {String} selector
|
223 |
+
* @param {String} type
|
224 |
+
* @param {Function} callback
|
225 |
+
* @return {Object}
|
226 |
+
*/
|
227 |
+
function listenSelector(selector, type, callback) {
|
228 |
+
return delegate( document.body, selector, type, callback );
|
229 |
+
}
|
230 |
+
|
231 |
+
module.exports = listen;
|
232 |
+
|
233 |
+
},{"./is":3,"delegate":2}],5:[function(require,module,exports){
|
234 |
+
|
235 |
+
/**
|
236 |
+
* Element prototype.
|
237 |
+
*/
|
238 |
+
|
239 |
+
var proto = Element.prototype;
|
240 |
+
|
241 |
+
/**
|
242 |
+
* Vendor function.
|
243 |
+
*/
|
244 |
+
|
245 |
+
var vendor = proto.matchesSelector
|
246 |
+
|| proto.webkitMatchesSelector
|
247 |
+
|| proto.mozMatchesSelector
|
248 |
+
|| proto.msMatchesSelector
|
249 |
+
|| proto.oMatchesSelector;
|
250 |
+
|
251 |
+
/**
|
252 |
+
* Expose `match()`.
|
253 |
+
*/
|
254 |
+
|
255 |
+
module.exports = match;
|
256 |
+
|
257 |
+
/**
|
258 |
+
* Match `el` to `selector`.
|
259 |
+
*
|
260 |
+
* @param {Element} el
|
261 |
+
* @param {String} selector
|
262 |
+
* @return {Boolean}
|
263 |
+
* @api public
|
264 |
+
*/
|
265 |
+
|
266 |
+
function match(el, selector) {
|
267 |
+
if (vendor) {
|
268 |
+
return vendor.call( el, selector );
|
269 |
+
}
|
270 |
+
var nodes = el.parentNode.querySelectorAll( selector );
|
271 |
+
for (var i = 0; i < nodes.length; ++i) {
|
272 |
+
if (nodes[i] == el) {
|
273 |
+
return true;
|
274 |
+
}
|
275 |
+
}
|
276 |
+
return false;
|
277 |
+
}
|
278 |
+
},{}],6:[function(require,module,exports){
|
279 |
+
function select(element) {
|
280 |
+
var selectedText;
|
281 |
+
|
282 |
+
if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
|
283 |
+
element.focus();
|
284 |
+
element.setSelectionRange( 0, element.value.length );
|
285 |
+
|
286 |
+
selectedText = element.value;
|
287 |
+
} else {
|
288 |
+
if (element.hasAttribute( 'contenteditable' )) {
|
289 |
+
element.focus();
|
290 |
+
}
|
291 |
+
|
292 |
+
var selection = window.getSelection();
|
293 |
+
var range = document.createRange();
|
294 |
+
|
295 |
+
range.selectNodeContents( element );
|
296 |
+
selection.removeAllRanges();
|
297 |
+
selection.addRange( range );
|
298 |
+
|
299 |
+
selectedText = selection.toString();
|
300 |
+
}
|
301 |
+
|
302 |
+
return selectedText;
|
303 |
+
}
|
304 |
+
|
305 |
+
module.exports = select;
|
306 |
+
|
307 |
+
},{}],7:[function(require,module,exports){
|
308 |
+
function E () {
|
309 |
+
// Keep this empty so it's easier to inherit from
|
310 |
+
// (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
|
311 |
+
}
|
312 |
+
|
313 |
+
E.prototype = {
|
314 |
+
on: function (name, callback, ctx) {
|
315 |
+
var e = this.e || (this.e = {});
|
316 |
+
|
317 |
+
(e[name] || (e[name] = [])).push(
|
318 |
+
{
|
319 |
+
fn: callback,
|
320 |
+
ctx: ctx
|
321 |
+
}
|
322 |
+
);
|
323 |
+
|
324 |
+
return this;
|
325 |
+
},
|
326 |
+
|
327 |
+
once: function (name, callback, ctx) {
|
328 |
+
var self = this;
|
329 |
+
function listener () {
|
330 |
+
self.off( name, listener );
|
331 |
+
callback.apply( ctx, arguments );
|
332 |
+
};
|
333 |
+
|
334 |
+
listener._ = callback
|
335 |
+
return this.on( name, listener, ctx );
|
336 |
+
},
|
337 |
+
|
338 |
+
emit: function (name) {
|
339 |
+
var data = [].slice.call( arguments, 1 );
|
340 |
+
var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
|
341 |
+
var i = 0;
|
342 |
+
var len = evtArr.length;
|
343 |
+
|
344 |
+
for (i; i < len; i++) {
|
345 |
+
evtArr[i].fn.apply( evtArr[i].ctx, data );
|
346 |
+
}
|
347 |
+
|
348 |
+
return this;
|
349 |
+
},
|
350 |
+
|
351 |
+
off: function (name, callback) {
|
352 |
+
var e = this.e || (this.e = {});
|
353 |
+
var evts = e[name];
|
354 |
+
var liveEvents = [];
|
355 |
+
|
356 |
+
if (evts && callback) {
|
357 |
+
for (var i = 0, len = evts.length; i < len; i++) {
|
358 |
+
if (evts[i].fn !== callback && evts[i].fn._ !== callback) {
|
359 |
+
liveEvents.push( evts[i] );
|
360 |
+
}
|
361 |
+
}
|
362 |
+
}
|
363 |
+
|
364 |
+
// Remove event from queue to prevent memory leak
|
365 |
+
// Suggested by https://github.com/lazd
|
366 |
+
// Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
|
367 |
+
(liveEvents.length)
|
368 |
+
? e[name] = liveEvents
|
369 |
+
: delete e[name];
|
370 |
+
|
371 |
+
return this;
|
372 |
+
}
|
373 |
+
};
|
374 |
+
|
375 |
+
module.exports = E;
|
376 |
+
|
377 |
+
},{}],8:[function(require,module,exports){
|
378 |
+
(function (global, factory) {
|
379 |
+
if (typeof define === "function" && define.amd) {
|
380 |
+
define( ['module', 'select'], factory );
|
381 |
+
} else if (typeof exports !== "undefined") {
|
382 |
+
factory( module, require( 'select' ) );
|
383 |
+
} else {
|
384 |
+
var mod = {
|
385 |
+
exports: {}
|
386 |
+
};
|
387 |
+
factory( mod, global.select );
|
388 |
+
global.clipboardAction = mod.exports;
|
389 |
+
}
|
390 |
+
})(
|
391 |
+
this, function (module, _select) {
|
392 |
+
'use strict';
|
393 |
+
|
394 |
+
var _select2 = _interopRequireDefault( _select );
|
395 |
+
|
396 |
+
function _interopRequireDefault(obj) {
|
397 |
+
return obj && obj.__esModule ? obj : {
|
398 |
+
default: obj
|
399 |
+
};
|
400 |
+
}
|
401 |
+
|
402 |
+
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
403 |
+
return typeof obj;
|
404 |
+
} : function (obj) {
|
405 |
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
406 |
+
};
|
407 |
+
|
408 |
+
function _classCallCheck(instance, Constructor) {
|
409 |
+
if ( ! (instance instanceof Constructor)) {
|
410 |
+
throw new TypeError( "Cannot call a class as a function" );
|
411 |
+
}
|
412 |
+
}
|
413 |
+
|
414 |
+
var _createClass = function () {
|
415 |
+
function defineProperties(target, props) {
|
416 |
+
for (var i = 0; i < props.length; i++) {
|
417 |
+
var descriptor = props[i];
|
418 |
+
descriptor.enumerable = descriptor.enumerable || false;
|
419 |
+
descriptor.configurable = true;
|
420 |
+
if ("value" in descriptor) {
|
421 |
+
descriptor.writable = true;
|
422 |
+
}
|
423 |
+
Object.defineProperty( target, descriptor.key, descriptor );
|
424 |
+
}
|
425 |
+
}
|
426 |
+
|
427 |
+
return function (Constructor, protoProps, staticProps) {
|
428 |
+
if (protoProps) {
|
429 |
+
defineProperties( Constructor.prototype, protoProps );
|
430 |
+
}
|
431 |
+
if (staticProps) {
|
432 |
+
defineProperties( Constructor, staticProps );
|
433 |
+
}
|
434 |
+
return Constructor;
|
435 |
+
};
|
436 |
+
}();
|
437 |
+
|
438 |
+
var ClipboardAction = function () {
|
439 |
+
/**
|
440 |
+
* @param {Object} options
|
441 |
+
*/
|
442 |
+
|
443 |
+
function ClipboardAction(options) {
|
444 |
+
_classCallCheck( this, ClipboardAction );
|
445 |
+
|
446 |
+
this.resolveOptions( options );
|
447 |
+
this.initSelection();
|
448 |
+
}
|
449 |
+
|
450 |
+
/**
|
451 |
+
* Defines base properties passed from constructor.
|
452 |
+
*
|
453 |
+
* @param {Object} options
|
454 |
+
*/
|
455 |
+
|
456 |
+
ClipboardAction.prototype.resolveOptions = function resolveOptions() {
|
457 |
+
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
|
458 |
+
|
459 |
+
this.action = options.action;
|
460 |
+
this.emitter = options.emitter;
|
461 |
+
this.target = options.target;
|
462 |
+
this.text = options.text;
|
463 |
+
this.trigger = options.trigger;
|
464 |
+
|
465 |
+
this.selectedText = '';
|
466 |
+
};
|
467 |
+
|
468 |
+
ClipboardAction.prototype.initSelection = function initSelection() {
|
469 |
+
if (this.text) {
|
470 |
+
this.selectFake();
|
471 |
+
} else if (this.target) {
|
472 |
+
this.selectTarget();
|
473 |
+
}
|
474 |
+
};
|
475 |
+
|
476 |
+
ClipboardAction.prototype.selectFake = function selectFake() {
|
477 |
+
var _this = this;
|
478 |
+
|
479 |
+
var isRTL = document.documentElement.getAttribute( 'dir' ) == 'rtl';
|
480 |
+
|
481 |
+
this.removeFake();
|
482 |
+
|
483 |
+
this.fakeHandlerCallback = function () {
|
484 |
+
return _this.removeFake();
|
485 |
+
};
|
486 |
+
this.fakeHandler = document.body.addEventListener( 'click', this.fakeHandlerCallback ) || true;
|
487 |
+
|
488 |
+
this.fakeElem = document.createElement( 'textarea' );
|
489 |
+
// Prevent zooming on iOS
|
490 |
+
this.fakeElem.style.fontSize = '12pt';
|
491 |
+
// Reset box model
|
492 |
+
this.fakeElem.style.border = '0';
|
493 |
+
this.fakeElem.style.padding = '0';
|
494 |
+
this.fakeElem.style.margin = '0';
|
495 |
+
// Move element out of screen horizontally
|
496 |
+
this.fakeElem.style.position = 'absolute';
|
497 |
+
this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
|
498 |
+
// Move element to the same position vertically
|
499 |
+
this.fakeElem.style.top = (window.pageYOffset || document.documentElement.scrollTop) + 'px';
|
500 |
+
this.fakeElem.setAttribute( 'readonly', '' );
|
501 |
+
this.fakeElem.value = this.text;
|
502 |
+
|
503 |
+
document.body.appendChild( this.fakeElem );
|
504 |
+
|
505 |
+
this.selectedText = (0, _select2.default)( this.fakeElem );
|
506 |
+
this.copyText();
|
507 |
+
};
|
508 |
+
|
509 |
+
ClipboardAction.prototype.removeFake = function removeFake() {
|
510 |
+
if (this.fakeHandler) {
|
511 |
+
document.body.removeEventListener( 'click', this.fakeHandlerCallback );
|
512 |
+
this.fakeHandler = null;
|
513 |
+
this.fakeHandlerCallback = null;
|
514 |
+
}
|
515 |
+
|
516 |
+
if (this.fakeElem) {
|
517 |
+
document.body.removeChild( this.fakeElem );
|
518 |
+
this.fakeElem = null;
|
519 |
+
}
|
520 |
+
};
|
521 |
+
|
522 |
+
ClipboardAction.prototype.selectTarget = function selectTarget() {
|
523 |
+
this.selectedText = (0, _select2.default)( this.target );
|
524 |
+
this.copyText();
|
525 |
+
};
|
526 |
+
|
527 |
+
ClipboardAction.prototype.copyText = function copyText() {
|
528 |
+
var succeeded = undefined;
|
529 |
+
|
530 |
+
try {
|
531 |
+
succeeded = document.execCommand( this.action );
|
532 |
+
} catch (err) {
|
533 |
+
succeeded = false;
|
534 |
+
}
|
535 |
+
|
536 |
+
this.handleResult( succeeded );
|
537 |
+
};
|
538 |
+
|
539 |
+
ClipboardAction.prototype.handleResult = function handleResult(succeeded) {
|
540 |
+
if (succeeded) {
|
541 |
+
this.emitter.emit(
|
542 |
+
'success', {
|
543 |
+
action: this.action,
|
544 |
+
text: this.selectedText,
|
545 |
+
trigger: this.trigger,
|
546 |
+
clearSelection: this.clearSelection.bind( this )
|
547 |
+
}
|
548 |
+
);
|
549 |
+
} else {
|
550 |
+
this.emitter.emit(
|
551 |
+
'error', {
|
552 |
+
action: this.action,
|
553 |
+
trigger: this.trigger,
|
554 |
+
clearSelection: this.clearSelection.bind( this )
|
555 |
+
}
|
556 |
+
);
|
557 |
+
}
|
558 |
+
};
|
559 |
+
|
560 |
+
ClipboardAction.prototype.clearSelection = function clearSelection() {
|
561 |
+
if (this.target) {
|
562 |
+
this.target.blur();
|
563 |
+
}
|
564 |
+
|
565 |
+
window.getSelection().removeAllRanges();
|
566 |
+
};
|
567 |
+
|
568 |
+
ClipboardAction.prototype.destroy = function destroy() {
|
569 |
+
this.removeFake();
|
570 |
+
};
|
571 |
+
|
572 |
+
_createClass(
|
573 |
+
ClipboardAction, [{
|
574 |
+
key: 'action',
|
575 |
+
set: function set() {
|
576 |
+
var action = arguments.length <= 0 || arguments[0] === undefined ? 'copy' : arguments[0];
|
577 |
+
|
578 |
+
this._action = action;
|
579 |
+
|
580 |
+
if (this._action !== 'copy' && this._action !== 'cut') {
|
581 |
+
throw new Error( 'Invalid "action" value, use either "copy" or "cut"' );
|
582 |
+
}
|
583 |
+
},
|
584 |
+
get: function get() {
|
585 |
+
return this._action;
|
586 |
+
}
|
587 |
+
}, {
|
588 |
+
key: 'target',
|
589 |
+
set: function set(target) {
|
590 |
+
if (target !== undefined) {
|
591 |
+
if (target && (typeof target === 'undefined' ? 'undefined' : _typeof( target )) === 'object' && target.nodeType === 1) {
|
592 |
+
if (this.action === 'copy' && target.hasAttribute( 'disabled' )) {
|
593 |
+
throw new Error( 'Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute' );
|
594 |
+
}
|
595 |
+
|
596 |
+
if (this.action === 'cut' && (target.hasAttribute( 'readonly' ) || target.hasAttribute( 'disabled' ))) {
|
597 |
+
throw new Error( 'Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes' );
|
598 |
+
}
|
599 |
+
|
600 |
+
this._target = target;
|
601 |
+
} else {
|
602 |
+
throw new Error( 'Invalid "target" value, use a valid Element' );
|
603 |
+
}
|
604 |
+
}
|
605 |
+
},
|
606 |
+
get: function get() {
|
607 |
+
return this._target;
|
608 |
+
}
|
609 |
+
}]
|
610 |
+
);
|
611 |
+
|
612 |
+
return ClipboardAction;
|
613 |
+
}();
|
614 |
+
|
615 |
+
module.exports = ClipboardAction;
|
616 |
+
}
|
617 |
+
);
|
618 |
+
|
619 |
+
},{"select":6}],9:[function(require,module,exports){
|
620 |
+
(function (global, factory) {
|
621 |
+
if (typeof define === "function" && define.amd) {
|
622 |
+
define( ['module', './clipboard-action', 'tiny-emitter', 'good-listener'], factory );
|
623 |
+
} else if (typeof exports !== "undefined") {
|
624 |
+
factory( module, require( './clipboard-action' ), require( 'tiny-emitter' ), require( 'good-listener' ) );
|
625 |
+
} else {
|
626 |
+
var mod = {
|
627 |
+
exports: {}
|
628 |
+
};
|
629 |
+
factory( mod, global.clipboardAction, global.tinyEmitter, global.goodListener );
|
630 |
+
global.clipboard = mod.exports;
|
631 |
+
}
|
632 |
+
})(
|
633 |
+
this, function (module, _clipboardAction, _tinyEmitter, _goodListener) {
|
634 |
+
'use strict';
|
635 |
+
|
636 |
+
var _clipboardAction2 = _interopRequireDefault( _clipboardAction );
|
637 |
+
|
638 |
+
var _tinyEmitter2 = _interopRequireDefault( _tinyEmitter );
|
639 |
+
|
640 |
+
var _goodListener2 = _interopRequireDefault( _goodListener );
|
641 |
+
|
642 |
+
function _interopRequireDefault(obj) {
|
643 |
+
return obj && obj.__esModule ? obj : {
|
644 |
+
default: obj
|
645 |
+
};
|
646 |
+
}
|
647 |
+
|
648 |
+
function _classCallCheck(instance, Constructor) {
|
649 |
+
if ( ! (instance instanceof Constructor)) {
|
650 |
+
throw new TypeError( "Cannot call a class as a function" );
|
651 |
+
}
|
652 |
+
}
|
653 |
+
|
654 |
+
function _possibleConstructorReturn(self, call) {
|
655 |
+
if ( ! self) {
|
656 |
+
throw new ReferenceError( "this hasn't been initialised - super() hasn't been called" );
|
657 |
+
}
|
658 |
+
|
659 |
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
660 |
+
}
|
661 |
+
|
662 |
+
function _inherits(subClass, superClass) {
|
663 |
+
if (typeof superClass !== "function" && superClass !== null) {
|
664 |
+
throw new TypeError( "Super expression must either be null or a function, not " + typeof superClass );
|
665 |
+
}
|
666 |
+
|
667 |
+
subClass.prototype = Object.create(
|
668 |
+
superClass && superClass.prototype, {
|
669 |
+
constructor: {
|
670 |
+
value: subClass,
|
671 |
+
enumerable: false,
|
672 |
+
writable: true,
|
673 |
+
configurable: true
|
674 |
+
}
|
675 |
+
}
|
676 |
+
);
|
677 |
+
if (superClass) {
|
678 |
+
Object.setPrototypeOf ? Object.setPrototypeOf( subClass, superClass ) : subClass.__proto__ = superClass;
|
679 |
+
}
|
680 |
+
}
|
681 |
+
|
682 |
+
var Clipboard = function (_Emitter) {
|
683 |
+
_inherits( Clipboard, _Emitter );
|
684 |
+
|
685 |
+
/**
|
686 |
+
* @param {String|HTMLElement|HTMLCollection|NodeList} trigger
|
687 |
+
* @param {Object} options
|
688 |
+
*/
|
689 |
+
|
690 |
+
function Clipboard(trigger, options) {
|
691 |
+
_classCallCheck( this, Clipboard );
|
692 |
+
|
693 |
+
var _this = _possibleConstructorReturn( this, _Emitter.call( this ) );
|
694 |
+
|
695 |
+
_this.resolveOptions( options );
|
696 |
+
_this.listenClick( trigger );
|
697 |
+
return _this;
|
698 |
+
}
|
699 |
+
|
700 |
+
/**
|
701 |
+
* Defines if attributes would be resolved using internal setter functions
|
702 |
+
* or custom functions that were passed in the constructor.
|
703 |
+
*
|
704 |
+
* @param {Object} options
|
705 |
+
*/
|
706 |
+
|
707 |
+
Clipboard.prototype.resolveOptions = function resolveOptions() {
|
708 |
+
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
|
709 |
+
|
710 |
+
this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
|
711 |
+
this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
|
712 |
+
this.text = typeof options.text === 'function' ? options.text : this.defaultText;
|
713 |
+
};
|
714 |
+
|
715 |
+
Clipboard.prototype.listenClick = function listenClick(trigger) {
|
716 |
+
var _this2 = this;
|
717 |
+
|
718 |
+
this.listener = (0, _goodListener2.default)(
|
719 |
+
trigger, 'click', function (e) {
|
720 |
+
return _this2.onClick( e );
|
721 |
+
}
|
722 |
+
);
|
723 |
+
};
|
724 |
+
|
725 |
+
Clipboard.prototype.onClick = function onClick(e) {
|
726 |
+
var trigger = e.delegateTarget || e.currentTarget;
|
727 |
+
|
728 |
+
if (this.clipboardAction) {
|
729 |
+
this.clipboardAction = null;
|
730 |
+
}
|
731 |
+
|
732 |
+
this.clipboardAction = new _clipboardAction2.default(
|
733 |
+
{
|
734 |
+
action: this.action( trigger ),
|
735 |
+
target: this.target( trigger ),
|
736 |
+
text: this.text( trigger ),
|
737 |
+
trigger: trigger,
|
738 |
+
emitter: this
|
739 |
+
}
|
740 |
+
);
|
741 |
+
};
|
742 |
+
|
743 |
+
Clipboard.prototype.defaultAction = function defaultAction(trigger) {
|
744 |
+
return getAttributeValue( 'action', trigger );
|
745 |
+
};
|
746 |
+
|
747 |
+
Clipboard.prototype.defaultTarget = function defaultTarget(trigger) {
|
748 |
+
var selector = getAttributeValue( 'target', trigger );
|
749 |
+
|
750 |
+
if (selector) {
|
751 |
+
return document.querySelector( selector );
|
752 |
+
}
|
753 |
+
};
|
754 |
+
|
755 |
+
Clipboard.prototype.defaultText = function defaultText(trigger) {
|
756 |
+
return getAttributeValue( 'text', trigger );
|
757 |
+
};
|
758 |
+
|
759 |
+
Clipboard.prototype.destroy = function destroy() {
|
760 |
+
this.listener.destroy();
|
761 |
+
|
762 |
+
if (this.clipboardAction) {
|
763 |
+
this.clipboardAction.destroy();
|
764 |
+
this.clipboardAction = null;
|
765 |
+
}
|
766 |
+
};
|
767 |
+
|
768 |
+
return Clipboard;
|
769 |
+
}(_tinyEmitter2.default);
|
770 |
+
|
771 |
+
/**
|
772 |
+
* Helper function to retrieve attribute value.
|
773 |
+
*
|
774 |
+
* @param {String} suffix
|
775 |
+
* @param {Element} element
|
776 |
+
*/
|
777 |
+
function getAttributeValue(suffix, element) {
|
778 |
+
var attribute = 'data-clipboard-' + suffix;
|
779 |
+
|
780 |
+
if ( ! element.hasAttribute( attribute )) {
|
781 |
+
return;
|
782 |
+
}
|
783 |
+
|
784 |
+
return element.getAttribute( attribute );
|
785 |
+
}
|
786 |
+
|
787 |
+
module.exports = Clipboard;
|
788 |
+
}
|
789 |
+
);
|
790 |
+
|
791 |
+
},{"./clipboard-action":8,"good-listener":4,"tiny-emitter":7}]},{},[9]
|
792 |
+
)( 9 )
|
793 |
}
|
794 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
admin/js/wp-temporary-login-without-password-admin.js
CHANGED
@@ -1,89 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
(function ($) {
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Admin Settings Js.
|
3 |
+
*
|
4 |
+
* @package Temporary Login Without Password
|
5 |
+
*/
|
6 |
+
|
7 |
(function ($) {
|
8 |
+
'use strict';
|
9 |
+
|
10 |
+
jQuery( document ).ready(
|
11 |
+
function () {
|
12 |
+
|
13 |
+
jQuery( '#add-new-wtlwp-form-button' ).click(
|
14 |
+
function () {
|
15 |
+
jQuery( '#new-wtlwp-form' ).show();
|
16 |
+
jQuery( '#update-wtlwp-form' ).hide();
|
17 |
+
}
|
18 |
+
);
|
19 |
+
|
20 |
+
jQuery( '#cancel-new-login-form' ).click(
|
21 |
+
function () {
|
22 |
+
jQuery( '#new-wtlwp-form' ).hide();
|
23 |
+
jQuery( '#update-wtlwp-form' ).show();
|
24 |
+
}
|
25 |
+
);
|
26 |
+
|
27 |
+
jQuery( '#cancel-update-login-form' ).click(
|
28 |
+
function () {
|
29 |
+
jQuery( '#update-wtlwp-form' ).hide();
|
30 |
+
}
|
31 |
+
);
|
32 |
+
|
33 |
+
if (jQuery( '.wtlwp-click-to-copy-btn' ).get( 0 )) {
|
34 |
+
|
35 |
+
var clipboard = new Clipboard( '.wtlwp-click-to-copy-btn' );
|
36 |
+
|
37 |
+
clipboard.on(
|
38 |
+
'success', function (e) {
|
39 |
+
var elem = e.trigger;
|
40 |
+
var className = elem.getAttribute( 'class' );
|
41 |
+
jQuery( '#copied-text-message-' + className ).text( 'Copied' ).fadeIn();
|
42 |
+
jQuery( '#copied-text-message-' + className ).fadeOut( 'slow' );
|
43 |
+
}
|
44 |
+
);
|
45 |
+
}
|
46 |
+
|
47 |
+
if (jQuery( '.wtlwp-copy-to-clipboard' ).get( 0 )) {
|
48 |
+
var clipboard_link = new Clipboard( '.wtlwp-copy-to-clipboard' );
|
49 |
+
|
50 |
+
clipboard_link.on(
|
51 |
+
'success', function (e) {
|
52 |
+
var elem = e.trigger;
|
53 |
+
var id = elem.getAttribute( 'id' );
|
54 |
+
jQuery( '#copied-' + id ).text( 'Copied' ).fadeIn();
|
55 |
+
jQuery( '#copied-' + id ).fadeOut( 'slow' );
|
56 |
+
}
|
57 |
+
);
|
58 |
+
}
|
59 |
+
|
60 |
+
jQuery( '#new-user-expiry-time' ).change(
|
61 |
+
function () {
|
62 |
+
var value = jQuery( this ).val();
|
63 |
+
showDatePicker( value, 'new' );
|
64 |
+
}
|
65 |
+
);
|
66 |
+
|
67 |
+
jQuery( '#update-user-expiry-time' ).change(
|
68 |
+
function () {
|
69 |
+
var value = jQuery( this ).val();
|
70 |
+
showDatePicker( value, 'update' );
|
71 |
+
}
|
72 |
+
);
|
73 |
+
|
74 |
+
jQuery( 'a.tlwp-rating-link' ).click(
|
75 |
+
function () {
|
76 |
+
jQuery.post( data.admin_ajax_url, {action: 'tlwp_rated'} );
|
77 |
+
jQuery( this ).parent().text( jQuery( this ).data( 'rated' ) );
|
78 |
+
}
|
79 |
+
);
|
80 |
+
|
81 |
+
jQuery( 'a.tlwp-rating-link-header' ).click(
|
82 |
+
function () {
|
83 |
+
jQuery.post( data.admin_ajax_url, {action: 'tlwp_reivew_header'} );
|
84 |
+
jQuery( this ).parent().text( jQuery( this ).data( 'rated' ) );
|
85 |
+
}
|
86 |
+
);
|
87 |
+
|
88 |
+
function showDatePicker(value, datePickerClass) {
|
89 |
+
|
90 |
+
var customDatePickerClass = '';
|
91 |
+
var customDatePickerID = '';
|
92 |
+
if ( 'new' === datePickerClass ) {
|
93 |
+
customDatePickerClass = '.new-custom-date-picker';
|
94 |
+
customDatePickerID = '#new-custom-date-picker';
|
95 |
+
} else {
|
96 |
+
customDatePickerClass = '.update-custom-date-picker';
|
97 |
+
customDatePickerID = '#update-custom-date-picker';
|
98 |
+
}
|
99 |
+
|
100 |
+
if (value === 'custom_date') {
|
101 |
+
var tomorrowDate = new Date( new Date().getTime() + 24 * 60 * 60 * 1000 );
|
102 |
+
jQuery( customDatePickerClass ).datepicker(
|
103 |
+
{
|
104 |
+
dateFormat: 'yy-mm-dd',
|
105 |
+
minDate: tomorrowDate
|
106 |
+
}
|
107 |
+
);
|
108 |
+
jQuery( customDatePickerID ).show();
|
109 |
+
} else {
|
110 |
+
jQuery( customDatePickerID ).hide();
|
111 |
+
}
|
112 |
+
}
|
113 |
+
|
114 |
+
}
|
115 |
+
);
|
116 |
+
|
117 |
+
})( jQuery );
|
includes/class-wp-temporary-login-without-password-activator.php
CHANGED
@@ -1,7 +1,22 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
class Wp_Temporary_Login_Without_Password_Activator {
|
4 |
|
|
|
|
|
|
|
|
|
|
|
5 |
public static function activate() {
|
6 |
/**
|
7 |
* Process
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Activator Class
|
4 |
+
*
|
5 |
+
* @package Temporary Login Without Password
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Class Wp_Temporary_Login_Without_Password_Activator
|
10 |
+
*
|
11 |
+
* @package Temporary Login Without Password
|
12 |
+
*/
|
13 |
class Wp_Temporary_Login_Without_Password_Activator {
|
14 |
|
15 |
+
/**
|
16 |
+
* Activate Plugin.
|
17 |
+
*
|
18 |
+
* @since 1.0.0
|
19 |
+
*/
|
20 |
public static function activate() {
|
21 |
/**
|
22 |
* Process
|
includes/class-wp-temporary-login-without-password-common.php
CHANGED
@@ -49,6 +49,10 @@ class Wp_Temporary_Login_Without_Password_Common {
|
|
49 |
return 0;
|
50 |
}
|
51 |
|
|
|
|
|
|
|
|
|
52 |
$expiry_option = ! empty( $data['expiry'] ) ? $data['expiry'] : 'day';
|
53 |
$date = ! empty( $data['custom_date'] ) ? $data['custom_date'] : '';
|
54 |
|
@@ -72,25 +76,28 @@ class Wp_Temporary_Login_Without_Password_Common {
|
|
72 |
if ( is_wp_error( $user_id ) ) {
|
73 |
$code = $user_id->get_error_code();
|
74 |
|
75 |
-
|
76 |
-
|
77 |
-
'errcode' => $code,
|
78 |
-
'message' => $user_id->get_error_message( $code ),
|
79 |
-
);
|
80 |
-
}
|
81 |
|
82 |
-
|
83 |
-
grant_super_admin( $user_id );
|
84 |
-
}
|
85 |
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
update_user_meta( $user_id, '_wtlwp_token', Wp_Temporary_Login_Without_Password_Common::generate_wtlwp_token( $user_id ) );
|
90 |
|
91 |
-
|
|
|
|
|
|
|
92 |
|
93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
|
95 |
}
|
96 |
|
@@ -828,11 +835,49 @@ class Wp_Temporary_Login_Without_Password_Common {
|
|
828 |
*/
|
829 |
public static function generate_mailto_link( $email, $temporary_login_link ) {
|
830 |
|
831 |
-
$
|
832 |
-
$
|
|
|
|
|
|
|
833 |
|
834 |
$mailto_link = __( sprintf( "mailto:%s?subject=%s&body=%s", $email, $mailto_subject, $mailto_body ), 'temporary-login-without-password' );
|
835 |
|
836 |
return $mailto_link;
|
837 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
838 |
}
|
49 |
return 0;
|
50 |
}
|
51 |
|
52 |
+
$result = array(
|
53 |
+
'error' => true
|
54 |
+
);
|
55 |
+
|
56 |
$expiry_option = ! empty( $data['expiry'] ) ? $data['expiry'] : 'day';
|
57 |
$date = ! empty( $data['custom_date'] ) ? $data['custom_date'] : '';
|
58 |
|
76 |
if ( is_wp_error( $user_id ) ) {
|
77 |
$code = $user_id->get_error_code();
|
78 |
|
79 |
+
$result['errcode'] = $code;
|
80 |
+
$result['message'] = $user_id->get_error_message( $code );
|
|
|
|
|
|
|
|
|
81 |
|
82 |
+
} else {
|
|
|
|
|
83 |
|
84 |
+
if ( is_multisite() && ! empty( $data['super_admin'] ) && 'on' === $data['super_admin'] ) {
|
85 |
+
grant_super_admin( $user_id );
|
86 |
+
}
|
|
|
87 |
|
88 |
+
update_user_meta( $user_id, '_wtlwp_user', true );
|
89 |
+
update_user_meta( $user_id, '_wtlwp_created', Wp_Temporary_Login_Without_Password_Common::get_current_gmt_timestamp() );
|
90 |
+
update_user_meta( $user_id, '_wtlwp_expire', Wp_Temporary_Login_Without_Password_Common::get_user_expire_time( $expiry_option, $date ) );
|
91 |
+
update_user_meta( $user_id, '_wtlwp_token', Wp_Temporary_Login_Without_Password_Common::generate_wtlwp_token( $user_id ) );
|
92 |
|
93 |
+
update_user_meta( $user_id, 'show_welcome_panel', 0 );
|
94 |
+
|
95 |
+
$result['error'] = false;
|
96 |
+
$result['user_id'] = $user_id;
|
97 |
+
|
98 |
+
}
|
99 |
+
|
100 |
+
return $result;
|
101 |
|
102 |
}
|
103 |
|
835 |
*/
|
836 |
public static function generate_mailto_link( $email, $temporary_login_link ) {
|
837 |
|
838 |
+
$double_line_break = '%0D%0A%0D%0A'; // as per RFC2368
|
839 |
+
$mailto_greeting = __( 'Hello,', 'temporary-login-without-password' );
|
840 |
+
$mailto_instruction = __( 'Click the following link to log into the system:', 'temporary-login-without-password' );
|
841 |
+
$mailto_subject = __( 'Temporary Login Link', 'temporary-login-without-password' );
|
842 |
+
$mailto_body = $mailto_greeting . $double_line_break . $mailto_instruction . $double_line_break . $temporary_login_link . $double_line_break;
|
843 |
|
844 |
$mailto_link = __( sprintf( "mailto:%s?subject=%s&body=%s", $email, $mailto_subject, $mailto_body ), 'temporary-login-without-password' );
|
845 |
|
846 |
return $mailto_link;
|
847 |
}
|
848 |
+
|
849 |
+
/**
|
850 |
+
* Can we ask user for review?
|
851 |
+
*
|
852 |
+
* @param int $current_user_id
|
853 |
+
*
|
854 |
+
* @since 1.4.5
|
855 |
+
*
|
856 |
+
* @return bool
|
857 |
+
*/
|
858 |
+
public static function can_ask_for_review( $current_user_id ) {
|
859 |
+
|
860 |
+
$tlwp_nobug = get_user_meta( $current_user_id, 'tlwp_no_bug', true );
|
861 |
+
$no_bug_days_before = 1;
|
862 |
+
$tlwp_nobug_no_time = get_user_meta( $current_user_id, 'tlwp_no_bug_time', true );
|
863 |
+
|
864 |
+
if ( ! empty( $tlwp_nobug_no_time ) && 0 !== $tlwp_nobug_no_time ) {
|
865 |
+
$no_bug_time_diff = time() - $tlwp_nobug_no_time;
|
866 |
+
$no_bug_days_before = floor( $no_bug_time_diff / 86400 ); // 86400 seconds == 1 day
|
867 |
+
}
|
868 |
+
|
869 |
+
$tlwp_rated = get_user_meta( $current_user_id, 'tlwp_admin_footer_text_rated', true );
|
870 |
+
$tlwp_rated_header = get_user_meta( $current_user_id, 'tlwp_admin_header_text_rated', true );
|
871 |
+
$temporary_logins = self::get_temporary_logins();
|
872 |
+
$total_logins = count( $temporary_logins );
|
873 |
+
|
874 |
+
// Is user fall in love with our plugin in 60 days after they said no for the review?
|
875 |
+
// But, make sure we are asking user only after 60 days.
|
876 |
+
// We are good people. Respect the user decision.
|
877 |
+
if ( ( $tlwp_nobug && $no_bug_days_before < 60 ) || $tlwp_rated || $tlwp_rated_header || ( $total_logins < 1 ) ) {
|
878 |
+
return false;
|
879 |
+
}
|
880 |
+
|
881 |
+
return true;
|
882 |
+
}
|
883 |
}
|
includes/class-wp-temporary-login-without-password-deactivator.php
CHANGED
@@ -1,7 +1,22 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
2 |
|
|
|
|
|
|
|
|
|
|
|
3 |
class Wp_Temporary_Login_Without_Password_Deactivator {
|
4 |
|
|
|
|
|
|
|
|
|
|
|
5 |
public static function deactivate() {
|
6 |
|
7 |
/**
|
@@ -19,9 +34,9 @@ class Wp_Temporary_Login_Without_Password_Deactivator {
|
|
19 |
if ( $user instanceof WP_User ) {
|
20 |
$temporary_logins_data[ $user->ID ] = $user->roles[0];
|
21 |
wp_update_user( array(
|
22 |
-
'ID'
|
23 |
'role' => '',
|
24 |
-
) ); // Downgrade role to none. So, user won't be able to login
|
25 |
}
|
26 |
}
|
27 |
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Deactivator Class
|
4 |
+
*
|
5 |
+
* @package Temporary Login Without Password
|
6 |
+
*/
|
7 |
|
8 |
+
/**
|
9 |
+
* Class Wp_Temporary_Login_Without_Password_Deactivator
|
10 |
+
*
|
11 |
+
* @package Temporary Login Without Password
|
12 |
+
*/
|
13 |
class Wp_Temporary_Login_Without_Password_Deactivator {
|
14 |
|
15 |
+
/**
|
16 |
+
* Deactivate Plugin.
|
17 |
+
*
|
18 |
+
* @since 1.0.0
|
19 |
+
*/
|
20 |
public static function deactivate() {
|
21 |
|
22 |
/**
|
34 |
if ( $user instanceof WP_User ) {
|
35 |
$temporary_logins_data[ $user->ID ] = $user->roles[0];
|
36 |
wp_update_user( array(
|
37 |
+
'ID' => $user->ID,
|
38 |
'role' => '',
|
39 |
+
) ); // Downgrade role to none. So, user won't be able to login.
|
40 |
}
|
41 |
}
|
42 |
}
|
includes/class-wp-temporary-login-without-password-i18n.php
CHANGED
@@ -1,10 +1,22 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
/**
|
4 |
* Define the internationalization functionality
|
|
|
|
|
5 |
*/
|
6 |
-
class
|
7 |
|
|
|
|
|
|
|
|
|
|
|
8 |
public function load_plugin_textdomain() {
|
9 |
|
10 |
load_plugin_textdomain(
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Localiztion
|
4 |
+
*
|
5 |
+
* @package Temporary Login Without Password
|
6 |
+
*/
|
7 |
|
8 |
/**
|
9 |
* Define the internationalization functionality
|
10 |
+
*
|
11 |
+
* Class Wp_Temporary_Login_Without_Password_I18n
|
12 |
*/
|
13 |
+
class Wp_Temporary_Login_Without_Password_I18n {
|
14 |
|
15 |
+
/**
|
16 |
+
* Load plugin text domain
|
17 |
+
*
|
18 |
+
* @since 1.0.0
|
19 |
+
*/
|
20 |
public function load_plugin_textdomain() {
|
21 |
|
22 |
load_plugin_textdomain(
|
includes/class-wp-temporary-login-without-password-layout.php
CHANGED
@@ -1,9 +1,19 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
class Wp_Temporary_Login_Without_Password_Layout {
|
4 |
|
5 |
/**
|
6 |
-
* Create footer headings
|
7 |
*
|
8 |
* @since 1.0
|
9 |
*
|
@@ -23,7 +33,7 @@ class Wp_Temporary_Login_Without_Password_Layout {
|
|
23 |
}
|
24 |
|
25 |
/**
|
26 |
-
* Prepare empty user row
|
27 |
*
|
28 |
* @since 1.0
|
29 |
*
|
@@ -43,7 +53,9 @@ class Wp_Temporary_Login_Without_Password_Layout {
|
|
43 |
}
|
44 |
|
45 |
/**
|
46 |
-
*
|
|
|
|
|
47 |
*
|
48 |
* @since 1.0
|
49 |
*
|
@@ -55,8 +67,8 @@ class Wp_Temporary_Login_Without_Password_Layout {
|
|
55 |
$user = get_user_by( 'id', $user );
|
56 |
}
|
57 |
|
58 |
-
$expire = get_user_meta( $user->ID, '_wtlwp_expire', true );
|
59 |
-
$last_login_time = get_user_meta( $user->ID, '_wtlwp_last_login', true );
|
60 |
|
61 |
$last_login_str = __( 'Not yet logged in', 'temporary-login-without-password' );
|
62 |
if ( ! empty( $last_login_time ) ) {
|
@@ -117,8 +129,10 @@ class Wp_Temporary_Login_Without_Password_Layout {
|
|
117 |
}
|
118 |
|
119 |
/**
|
120 |
-
*
|
121 |
-
*
|
|
|
|
|
122 |
*
|
123 |
* @since 1.0
|
124 |
*
|
@@ -131,7 +145,13 @@ class Wp_Temporary_Login_Without_Password_Layout {
|
|
131 |
$email = $user->user_email;
|
132 |
|
133 |
$delete_login_url = Wp_Temporary_Login_Without_Password_Common::get_manage_login_url( $user_id, 'delete' );
|
134 |
-
$update_login_url = add_query_arg(
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
$disable_login_url = Wp_Temporary_Login_Without_Password_Common::get_manage_login_url( $user_id, 'disable' );
|
136 |
$enable_login_url = Wp_Temporary_Login_Without_Password_Common::get_manage_login_url( $user_id, 'enable' );
|
137 |
$temporary_login_link = Wp_Temporary_Login_Without_Password_Common::get_login_url( $user_id );
|
@@ -148,14 +168,14 @@ class Wp_Temporary_Login_Without_Password_Layout {
|
|
148 |
$action_row .= "<span class='delete'><a title='" . __( 'Delete', 'temporary-login-without-password' ) . "' href='{$delete_login_url}'><span class='dashicons dashicons-no'></span></a></span>";
|
149 |
$action_row .= "<span class='edit'><a title='" . __( 'Edit', 'temporary-login-without-password' ) . "' href='{$update_login_url}'><span class='dashicons dashicons-edit'></span></a></span>";
|
150 |
|
151 |
-
// Shows these link only if temporary login active
|
152 |
if ( $is_active ) {
|
153 |
$action_row .= "<span class='email'><a title='" . __( 'Email login link', 'temporary-login-without-password' ) . "' href='{$mail_to_link}'><span class='dashicons dashicons-email'></span></a></span>";
|
154 |
$action_row .= "<span class='copy'><span id='text-{$user_id}' class='dashicons dashicons-admin-links wtlwp-copy-to-clipboard' title='" . __( 'Copy login link', 'temporary-login-without-password' ) . "' data-clipboard-text='{$temporary_login_link}'></span></span>";
|
155 |
$action_row .= "<span id='copied-text-{$user_id}' class='copied-text-message'></span>";
|
156 |
}
|
157 |
|
158 |
-
$action_row .=
|
159 |
|
160 |
return $action_row;
|
161 |
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Plugin Layout Class
|
4 |
+
*
|
5 |
+
* @package Temporary Login Without Password
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Manage Plugin Layout.
|
10 |
+
*
|
11 |
+
* Class Wp_Temporary_Login_Without_Password_Layout
|
12 |
+
*/
|
13 |
class Wp_Temporary_Login_Without_Password_Layout {
|
14 |
|
15 |
/**
|
16 |
+
* Create footer headings.
|
17 |
*
|
18 |
* @since 1.0
|
19 |
*
|
33 |
}
|
34 |
|
35 |
/**
|
36 |
+
* Prepare empty user row.
|
37 |
*
|
38 |
* @since 1.0
|
39 |
*
|
53 |
}
|
54 |
|
55 |
/**
|
56 |
+
* Prepare single user row
|
57 |
+
*
|
58 |
+
* @param WP_User|int $user WP_User object.
|
59 |
*
|
60 |
* @since 1.0
|
61 |
*
|
67 |
$user = get_user_by( 'id', $user );
|
68 |
}
|
69 |
|
70 |
+
$expire = get_user_meta( $user->ID, '_wtlwp_expire', true ); // phpcs:ignore
|
71 |
+
$last_login_time = get_user_meta( $user->ID, '_wtlwp_last_login', true ); // phpcs:ignore
|
72 |
|
73 |
$last_login_str = __( 'Not yet logged in', 'temporary-login-without-password' );
|
74 |
if ( ! empty( $last_login_time ) ) {
|
129 |
}
|
130 |
|
131 |
/**
|
132 |
+
* Prepare user actions row.
|
133 |
+
*
|
134 |
+
* @param WP_User $user WP_User object.
|
135 |
+
* @param string $wtlwp_status Current wtlwp_status.
|
136 |
*
|
137 |
* @since 1.0
|
138 |
*
|
145 |
$email = $user->user_email;
|
146 |
|
147 |
$delete_login_url = Wp_Temporary_Login_Without_Password_Common::get_manage_login_url( $user_id, 'delete' );
|
148 |
+
$update_login_url = add_query_arg(
|
149 |
+
array(
|
150 |
+
'page' => 'wp-temporary-login-without-password',
|
151 |
+
'user_id' => $user_id,
|
152 |
+
'action' => 'update',
|
153 |
+
), admin_url( 'users.php' )
|
154 |
+
);
|
155 |
$disable_login_url = Wp_Temporary_Login_Without_Password_Common::get_manage_login_url( $user_id, 'disable' );
|
156 |
$enable_login_url = Wp_Temporary_Login_Without_Password_Common::get_manage_login_url( $user_id, 'enable' );
|
157 |
$temporary_login_link = Wp_Temporary_Login_Without_Password_Common::get_login_url( $user_id );
|
168 |
$action_row .= "<span class='delete'><a title='" . __( 'Delete', 'temporary-login-without-password' ) . "' href='{$delete_login_url}'><span class='dashicons dashicons-no'></span></a></span>";
|
169 |
$action_row .= "<span class='edit'><a title='" . __( 'Edit', 'temporary-login-without-password' ) . "' href='{$update_login_url}'><span class='dashicons dashicons-edit'></span></a></span>";
|
170 |
|
171 |
+
// Shows these link only if temporary login active.
|
172 |
if ( $is_active ) {
|
173 |
$action_row .= "<span class='email'><a title='" . __( 'Email login link', 'temporary-login-without-password' ) . "' href='{$mail_to_link}'><span class='dashicons dashicons-email'></span></a></span>";
|
174 |
$action_row .= "<span class='copy'><span id='text-{$user_id}' class='dashicons dashicons-admin-links wtlwp-copy-to-clipboard' title='" . __( 'Copy login link', 'temporary-login-without-password' ) . "' data-clipboard-text='{$temporary_login_link}'></span></span>";
|
175 |
$action_row .= "<span id='copied-text-{$user_id}' class='copied-text-message'></span>";
|
176 |
}
|
177 |
|
178 |
+
$action_row .= '</div>';
|
179 |
|
180 |
return $action_row;
|
181 |
}
|
includes/class-wp-temporary-login-without-password-loader.php
CHANGED
@@ -1,11 +1,33 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/**
|
4 |
* Register all actions and filters for the plugin
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
*/
|
6 |
class Wp_Temporary_Login_Without_Password_Loader {
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
protected $actions;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
protected $filters;
|
10 |
|
11 |
/**
|
@@ -19,11 +41,13 @@ class Wp_Temporary_Login_Without_Password_Loader {
|
|
19 |
}
|
20 |
|
21 |
/**
|
22 |
-
*
|
23 |
-
*
|
24 |
-
* @param $
|
25 |
-
* @param
|
26 |
-
* @param
|
|
|
|
|
27 |
*
|
28 |
* @since 1.0
|
29 |
*/
|
@@ -32,11 +56,13 @@ class Wp_Temporary_Login_Without_Password_Loader {
|
|
32 |
}
|
33 |
|
34 |
/**
|
35 |
-
*
|
36 |
-
*
|
37 |
-
* @param $
|
38 |
-
* @param
|
39 |
-
* @param
|
|
|
|
|
40 |
*
|
41 |
* @since 1.0
|
42 |
*/
|
@@ -45,12 +71,14 @@ class Wp_Temporary_Login_Without_Password_Loader {
|
|
45 |
}
|
46 |
|
47 |
/**
|
48 |
-
*
|
49 |
-
*
|
50 |
-
* @param $
|
51 |
-
* @param $
|
52 |
-
* @param $
|
53 |
-
* @param $
|
|
|
|
|
54 |
*
|
55 |
* @since 1.0
|
56 |
*
|
@@ -70,23 +98,28 @@ class Wp_Temporary_Login_Without_Password_Loader {
|
|
70 |
}
|
71 |
|
72 |
/**
|
|
|
73 |
*
|
74 |
* @since 1.0
|
75 |
*/
|
76 |
public function run() {
|
77 |
|
78 |
foreach ( $this->filters as $hook ) {
|
79 |
-
add_filter(
|
80 |
-
$hook['
|
81 |
-
|
82 |
-
|
|
|
|
|
83 |
}
|
84 |
|
85 |
foreach ( $this->actions as $hook ) {
|
86 |
-
add_action(
|
87 |
-
$hook['
|
88 |
-
|
89 |
-
|
|
|
|
|
90 |
}
|
91 |
}
|
92 |
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Register all actions and filters for the plugin
|
4 |
+
*
|
5 |
+
* @package Temporary Login Without Password
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Class Wp_Temporary_Login_Without_Password_Loader
|
10 |
+
*
|
11 |
+
* @package Temporary Login Without Password
|
12 |
*/
|
13 |
class Wp_Temporary_Login_Without_Password_Loader {
|
14 |
|
15 |
+
/**
|
16 |
+
* All Actions to be added
|
17 |
+
*
|
18 |
+
* @var array $actions add actions.
|
19 |
+
*
|
20 |
+
* @since 1.0.0
|
21 |
+
*/
|
22 |
protected $actions;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* All filteres to be added
|
26 |
+
*
|
27 |
+
* @var array $filters Define filteres.
|
28 |
+
*
|
29 |
+
* @since 1.0.0
|
30 |
+
*/
|
31 |
protected $filters;
|
32 |
|
33 |
/**
|
41 |
}
|
42 |
|
43 |
/**
|
44 |
+
* Add action into $this->actions array
|
45 |
+
*
|
46 |
+
* @param string $hook Hook to be added.
|
47 |
+
* @param string $component component.
|
48 |
+
* @param string $callback class name.
|
49 |
+
* @param int $priority priority.
|
50 |
+
* @param int $accepted_args No of arguments.
|
51 |
*
|
52 |
* @since 1.0
|
53 |
*/
|
56 |
}
|
57 |
|
58 |
/**
|
59 |
+
* Add filters into $this->filteres array
|
60 |
+
*
|
61 |
+
* @param sting $hook Hook to be added.
|
62 |
+
* @param string $component component.
|
63 |
+
* @param string $callback class name.
|
64 |
+
* @param int $priority priority.
|
65 |
+
* @param int $accepted_args No of arguments.
|
66 |
*
|
67 |
* @since 1.0
|
68 |
*/
|
71 |
}
|
72 |
|
73 |
/**
|
74 |
+
* Collect Hooks
|
75 |
+
*
|
76 |
+
* @param array $hooks Hooks Array.
|
77 |
+
* @param string $hook hook.
|
78 |
+
* @param string $component component.
|
79 |
+
* @param string $callback class name.
|
80 |
+
* @param int $priority Priority.
|
81 |
+
* @param int $accepted_args No of arguments.
|
82 |
*
|
83 |
* @since 1.0
|
84 |
*
|
98 |
}
|
99 |
|
100 |
/**
|
101 |
+
* Add Filters.
|
102 |
*
|
103 |
* @since 1.0
|
104 |
*/
|
105 |
public function run() {
|
106 |
|
107 |
foreach ( $this->filters as $hook ) {
|
108 |
+
add_filter(
|
109 |
+
$hook['hook'], array(
|
110 |
+
$hook['component'],
|
111 |
+
$hook['callback'],
|
112 |
+
), $hook['priority'], $hook['accepted_args']
|
113 |
+
);
|
114 |
}
|
115 |
|
116 |
foreach ( $this->actions as $hook ) {
|
117 |
+
add_action(
|
118 |
+
$hook['hook'], array(
|
119 |
+
$hook['component'],
|
120 |
+
$hook['callback'],
|
121 |
+
), $hook['priority'], $hook['accepted_args']
|
122 |
+
);
|
123 |
}
|
124 |
}
|
125 |
|
includes/class-wp-temporary-login-without-password.php
CHANGED
@@ -1,11 +1,41 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
class Wp_Temporary_Login_Without_Password {
|
4 |
|
|
|
|
|
|
|
|
|
|
|
5 |
protected $loader;
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
protected $plugin_name;
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
protected $version;
|
8 |
|
|
|
|
|
|
|
9 |
public function __construct() {
|
10 |
|
11 |
$this->plugin_name = 'temporary-login-without-password';
|
@@ -17,6 +47,11 @@ class Wp_Temporary_Login_Without_Password {
|
|
17 |
$this->define_public_hooks();
|
18 |
}
|
19 |
|
|
|
|
|
|
|
|
|
|
|
20 |
private function load_dependencies() {
|
21 |
|
22 |
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wp-temporary-login-without-password-loader.php';
|
@@ -30,13 +65,23 @@ class Wp_Temporary_Login_Without_Password {
|
|
30 |
$this->loader = new Wp_Temporary_Login_Without_Password_Loader();
|
31 |
}
|
32 |
|
|
|
|
|
|
|
|
|
|
|
33 |
private function set_locale() {
|
34 |
|
35 |
-
$plugin_i18n = new
|
36 |
|
37 |
$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
|
38 |
}
|
39 |
|
|
|
|
|
|
|
|
|
|
|
40 |
private function define_admin_hooks() {
|
41 |
|
42 |
$plugin_admin = new Wp_Temporary_Login_Without_Password_Admin( $this->get_plugin_name(), $this->get_version() );
|
@@ -61,6 +106,11 @@ class Wp_Temporary_Login_Without_Password {
|
|
61 |
$this->loader->add_filter( 'plugin_action_links_' . WTLWP_PLUGIN_BASE_NAME, $plugin_admin, 'plugin_add_settings_link', 10, 4 );
|
62 |
}
|
63 |
|
|
|
|
|
|
|
|
|
|
|
64 |
private function define_public_hooks() {
|
65 |
|
66 |
$plugin_public = new Wp_Temporary_Login_Without_Password_Public( $this->get_plugin_name(), $this->get_version() );
|
@@ -70,18 +120,41 @@ class Wp_Temporary_Login_Without_Password {
|
|
70 |
$this->loader->add_filter( 'allow_password_reset', $plugin_public, 'disable_password_reset', 10, 2 );
|
71 |
}
|
72 |
|
|
|
|
|
|
|
|
|
|
|
73 |
public function run() {
|
74 |
$this->loader->run();
|
75 |
}
|
76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
public function get_plugin_name() {
|
78 |
return $this->plugin_name;
|
79 |
}
|
80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
public function get_loader() {
|
82 |
return $this->loader;
|
83 |
}
|
84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
public function get_version() {
|
86 |
return $this->version;
|
87 |
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Main class file
|
4 |
+
*
|
5 |
+
* @package Temporary Login Without Password
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Class Wp_Temporary_Login_Without_Password
|
10 |
+
*
|
11 |
+
* @package Temporary Login Without Password
|
12 |
+
*/
|
13 |
class Wp_Temporary_Login_Without_Password {
|
14 |
|
15 |
+
/**
|
16 |
+
* Loader.
|
17 |
+
*
|
18 |
+
* @var string $loader Loader.
|
19 |
+
*/
|
20 |
protected $loader;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Plugin Name.
|
24 |
+
*
|
25 |
+
* @var string $plugin_name Plugin Name.
|
26 |
+
*/
|
27 |
protected $plugin_name;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Plugin Version
|
31 |
+
*
|
32 |
+
* @var string $version Plugin Version.
|
33 |
+
*/
|
34 |
protected $version;
|
35 |
|
36 |
+
/**
|
37 |
+
* Wp_Temporary_Login_Without_Password constructor.
|
38 |
+
*/
|
39 |
public function __construct() {
|
40 |
|
41 |
$this->plugin_name = 'temporary-login-without-password';
|
47 |
$this->define_public_hooks();
|
48 |
}
|
49 |
|
50 |
+
/**
|
51 |
+
* Load dependencies.
|
52 |
+
*
|
53 |
+
* @since 1.0.0
|
54 |
+
*/
|
55 |
private function load_dependencies() {
|
56 |
|
57 |
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wp-temporary-login-without-password-loader.php';
|
65 |
$this->loader = new Wp_Temporary_Login_Without_Password_Loader();
|
66 |
}
|
67 |
|
68 |
+
/**
|
69 |
+
* Set Localization.
|
70 |
+
*
|
71 |
+
* @since 1.0.0
|
72 |
+
*/
|
73 |
private function set_locale() {
|
74 |
|
75 |
+
$plugin_i18n = new Wp_Temporary_Login_Without_Password_I18n();
|
76 |
|
77 |
$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
|
78 |
}
|
79 |
|
80 |
+
/**
|
81 |
+
* Define Admin Hooks.
|
82 |
+
*
|
83 |
+
* @since 1.0.0
|
84 |
+
*/
|
85 |
private function define_admin_hooks() {
|
86 |
|
87 |
$plugin_admin = new Wp_Temporary_Login_Without_Password_Admin( $this->get_plugin_name(), $this->get_version() );
|
106 |
$this->loader->add_filter( 'plugin_action_links_' . WTLWP_PLUGIN_BASE_NAME, $plugin_admin, 'plugin_add_settings_link', 10, 4 );
|
107 |
}
|
108 |
|
109 |
+
/**
|
110 |
+
* Defind Admin hooks.
|
111 |
+
*
|
112 |
+
* @since 1.0.0
|
113 |
+
*/
|
114 |
private function define_public_hooks() {
|
115 |
|
116 |
$plugin_public = new Wp_Temporary_Login_Without_Password_Public( $this->get_plugin_name(), $this->get_version() );
|
120 |
$this->loader->add_filter( 'allow_password_reset', $plugin_public, 'disable_password_reset', 10, 2 );
|
121 |
}
|
122 |
|
123 |
+
/**
|
124 |
+
* Start Loading.
|
125 |
+
*
|
126 |
+
* @since 1.0.0
|
127 |
+
*/
|
128 |
public function run() {
|
129 |
$this->loader->run();
|
130 |
}
|
131 |
|
132 |
+
/**
|
133 |
+
* Get Plugin Name.
|
134 |
+
*
|
135 |
+
* @since 1.0.0
|
136 |
+
* @return string
|
137 |
+
*/
|
138 |
public function get_plugin_name() {
|
139 |
return $this->plugin_name;
|
140 |
}
|
141 |
|
142 |
+
/**
|
143 |
+
* Get Loader Class.
|
144 |
+
*
|
145 |
+
* @since 1.0.0
|
146 |
+
* @return string
|
147 |
+
*/
|
148 |
public function get_loader() {
|
149 |
return $this->loader;
|
150 |
}
|
151 |
|
152 |
+
/**
|
153 |
+
* Get Plugin Version
|
154 |
+
*
|
155 |
+
* @since 1.0.0
|
156 |
+
* @return string
|
157 |
+
*/
|
158 |
public function get_version() {
|
159 |
return $this->version;
|
160 |
}
|
includes/index.php
CHANGED
@@ -1 +1,6 @@
|
|
1 |
-
<?php
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Silence is golden
|
4 |
+
*
|
5 |
+
* @package Temporary Login Without Password
|
6 |
+
*/
|
index.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Silence is golden
|
4 |
*
|
5 |
-
* @
|
6 |
*/
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Silence is golden
|
4 |
*
|
5 |
+
* @package Temporary Login Without Password
|
6 |
*/
|
languages/temporary-login-without-password.pot
CHANGED
@@ -3,7 +3,7 @@ msgid ""
|
|
3 |
msgstr ""
|
4 |
"Project-Id-Version: PACKAGE VERSION\n"
|
5 |
"Report-Msgid-Bugs-To: \n"
|
6 |
-
"POT-Creation-Date: 2018-04-
|
7 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
8 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
9 |
"Language-Team: \n"
|
@@ -14,133 +14,141 @@ msgstr ""
|
|
14 |
"Content-Transfer-Encoding: 8bit\n"
|
15 |
"X-Generator: Loco https://localise.biz/"
|
16 |
|
17 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
18 |
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/admin_settings.php:13
|
19 |
msgid "Temporary Logins"
|
20 |
msgstr ""
|
21 |
|
22 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
23 |
msgid "User creation failed"
|
24 |
msgstr ""
|
25 |
|
26 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
27 |
msgid "You do not have permission to create a temporary login"
|
28 |
msgstr ""
|
29 |
|
30 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
31 |
msgid "Email is already in use"
|
32 |
msgstr ""
|
33 |
|
34 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
35 |
msgid "Please enter valid email address. Email field should not be empty"
|
36 |
msgstr ""
|
37 |
|
38 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
39 |
msgid "Please enter valid email address"
|
40 |
msgstr ""
|
41 |
|
42 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
43 |
msgid "User you are trying to delete is not temporary"
|
44 |
msgstr ""
|
45 |
|
46 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
47 |
msgid "Nonce failed"
|
48 |
msgstr ""
|
49 |
|
50 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
51 |
msgid "Invalid action"
|
52 |
msgstr ""
|
53 |
|
54 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
55 |
msgid "Unknown error occured"
|
56 |
msgstr ""
|
57 |
|
58 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
59 |
msgid "Login created successfully!"
|
60 |
msgstr ""
|
61 |
|
62 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
63 |
msgid "Login updated successfully!"
|
64 |
msgstr ""
|
65 |
|
66 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
67 |
msgid "Login deleted successfully!"
|
68 |
msgstr ""
|
69 |
|
70 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
71 |
msgid "Login disabled successfully!"
|
72 |
msgstr ""
|
73 |
|
74 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
75 |
msgid "Login enabled successfully!"
|
76 |
msgstr ""
|
77 |
|
78 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
79 |
msgid "Settings have been updated successfully"
|
80 |
msgstr ""
|
81 |
|
82 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
83 |
msgid "Success!"
|
84 |
msgstr ""
|
85 |
|
86 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
87 |
#, php-format
|
88 |
msgid ""
|
89 |
"If you like <strong>Temporary Login Without Password</strong> plugin, please "
|
90 |
"leave us a %s rating. A huge thanks in advance!"
|
91 |
msgstr ""
|
92 |
|
93 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
94 |
msgid "Thank You :) "
|
95 |
msgstr ""
|
96 |
|
97 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
98 |
#, php-format
|
99 |
msgid "Thank you for using %s."
|
100 |
msgstr ""
|
101 |
|
102 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
103 |
msgid "Temporary Access"
|
104 |
msgstr ""
|
105 |
|
106 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:
|
107 |
msgid "One Hour"
|
108 |
msgstr ""
|
109 |
|
110 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:
|
111 |
msgid "Three Hours"
|
112 |
msgstr ""
|
113 |
|
114 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:
|
115 |
msgid "One Day"
|
116 |
msgstr ""
|
117 |
|
118 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:
|
119 |
msgid "Three Days"
|
120 |
msgstr ""
|
121 |
|
122 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:
|
123 |
msgid "One Week"
|
124 |
msgstr ""
|
125 |
|
126 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:
|
127 |
msgid "One Month"
|
128 |
msgstr ""
|
129 |
|
130 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:
|
131 |
msgid "Custom Date"
|
132 |
msgstr ""
|
133 |
|
134 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:
|
135 |
msgid "No Option Found"
|
136 |
msgstr ""
|
137 |
|
138 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:
|
139 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:
|
140 |
msgid "Expired"
|
141 |
msgstr ""
|
142 |
|
143 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
msgid "Temporary Login Link"
|
145 |
msgstr ""
|
146 |
|
3 |
msgstr ""
|
4 |
"Project-Id-Version: PACKAGE VERSION\n"
|
5 |
"Report-Msgid-Bugs-To: \n"
|
6 |
+
"POT-Creation-Date: 2018-04-23 06:52+0000\n"
|
7 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
8 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
9 |
"Language-Team: \n"
|
14 |
"Content-Transfer-Encoding: 8bit\n"
|
15 |
"X-Generator: Loco https://localise.biz/"
|
16 |
|
17 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:85
|
18 |
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/admin_settings.php:13
|
19 |
msgid "Temporary Logins"
|
20 |
msgstr ""
|
21 |
|
22 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:383
|
23 |
msgid "User creation failed"
|
24 |
msgstr ""
|
25 |
|
26 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:384
|
27 |
msgid "You do not have permission to create a temporary login"
|
28 |
msgstr ""
|
29 |
|
30 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:385
|
31 |
msgid "Email is already in use"
|
32 |
msgstr ""
|
33 |
|
34 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:386
|
35 |
msgid "Please enter valid email address. Email field should not be empty"
|
36 |
msgstr ""
|
37 |
|
38 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:387
|
39 |
msgid "Please enter valid email address"
|
40 |
msgstr ""
|
41 |
|
42 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:388
|
43 |
msgid "User you are trying to delete is not temporary"
|
44 |
msgstr ""
|
45 |
|
46 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:389
|
47 |
msgid "Nonce failed"
|
48 |
msgstr ""
|
49 |
|
50 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:390
|
51 |
msgid "Invalid action"
|
52 |
msgstr ""
|
53 |
|
54 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:391
|
55 |
msgid "Unknown error occured"
|
56 |
msgstr ""
|
57 |
|
58 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:392
|
59 |
msgid "Login created successfully!"
|
60 |
msgstr ""
|
61 |
|
62 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:393
|
63 |
msgid "Login updated successfully!"
|
64 |
msgstr ""
|
65 |
|
66 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:394
|
67 |
msgid "Login deleted successfully!"
|
68 |
msgstr ""
|
69 |
|
70 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:395
|
71 |
msgid "Login disabled successfully!"
|
72 |
msgstr ""
|
73 |
|
74 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:396
|
75 |
msgid "Login enabled successfully!"
|
76 |
msgstr ""
|
77 |
|
78 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:397
|
79 |
msgid "Settings have been updated successfully"
|
80 |
msgstr ""
|
81 |
|
82 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:398
|
83 |
msgid "Success!"
|
84 |
msgstr ""
|
85 |
|
86 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:463
|
87 |
#, php-format
|
88 |
msgid ""
|
89 |
"If you like <strong>Temporary Login Without Password</strong> plugin, please "
|
90 |
"leave us a %s rating. A huge thanks in advance!"
|
91 |
msgstr ""
|
92 |
|
93 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:463
|
94 |
msgid "Thank You :) "
|
95 |
msgstr ""
|
96 |
|
97 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:465
|
98 |
#, php-format
|
99 |
msgid "Thank you for using %s."
|
100 |
msgstr ""
|
101 |
|
102 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:626
|
103 |
msgid "Temporary Access"
|
104 |
msgstr ""
|
105 |
|
106 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:165
|
107 |
msgid "One Hour"
|
108 |
msgstr ""
|
109 |
|
110 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:166
|
111 |
msgid "Three Hours"
|
112 |
msgstr ""
|
113 |
|
114 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:167
|
115 |
msgid "One Day"
|
116 |
msgstr ""
|
117 |
|
118 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:168
|
119 |
msgid "Three Days"
|
120 |
msgstr ""
|
121 |
|
122 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:169
|
123 |
msgid "One Week"
|
124 |
msgstr ""
|
125 |
|
126 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:170
|
127 |
msgid "One Month"
|
128 |
msgstr ""
|
129 |
|
130 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:171
|
131 |
msgid "Custom Date"
|
132 |
msgstr ""
|
133 |
|
134 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:180
|
135 |
msgid "No Option Found"
|
136 |
msgstr ""
|
137 |
|
138 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:641
|
139 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:678
|
140 |
msgid "Expired"
|
141 |
msgstr ""
|
142 |
|
143 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:839
|
144 |
+
msgid "Hello,"
|
145 |
+
msgstr ""
|
146 |
+
|
147 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:840
|
148 |
+
msgid "Click the following link to log into the system:"
|
149 |
+
msgstr ""
|
150 |
+
|
151 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:841
|
152 |
msgid "Temporary Login Link"
|
153 |
msgstr ""
|
154 |
|
public/class-wp-temporary-login-without-password-public.php
CHANGED
@@ -1,15 +1,49 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
class Wp_Temporary_Login_Without_Password_Public {
|
4 |
|
|
|
|
|
|
|
|
|
|
|
5 |
private $plugin_name;
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
private $version;
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
public function __construct( $plugin_name, $version ) {
|
9 |
$this->plugin_name = $plugin_name;
|
10 |
$this->version = $version;
|
11 |
}
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
public static function get_error_messages( $error_code ) {
|
14 |
|
15 |
$error_messages = array(
|
@@ -24,11 +58,20 @@ class Wp_Temporary_Login_Without_Password_Public {
|
|
24 |
return $error_messages;
|
25 |
}
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
public function init_wtlwp() {
|
28 |
|
29 |
-
if ( ! is_user_logged_in() && ! empty( $_GET['wtlwp_token'] ) ) {
|
30 |
|
31 |
-
$wtlwp_token = sanitize_key($_GET['wtlwp_token']);
|
32 |
$users = Wp_Temporary_Login_Without_Password_Common::get_valid_user_based_on_wtlwp_token( $wtlwp_token );
|
33 |
|
34 |
if ( empty( $users ) ) {
|
@@ -38,12 +81,12 @@ class Wp_Temporary_Login_Without_Password_Public {
|
|
38 |
|
39 |
$user_id = $user->ID;
|
40 |
$user_login = $user->login;
|
41 |
-
update_user_meta( $user_id, '_wtlwp_last_login', Wp_Temporary_Login_Without_Password_Common::get_current_gmt_timestamp() );
|
42 |
wp_set_current_user( $user_id, $user_login );
|
43 |
wp_set_auth_cookie( $user_id );
|
44 |
|
45 |
$redirect_to = admin_url();
|
46 |
-
$redirect_to_url = apply_filters( 'login_redirect', $redirect_to, isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '', $user );
|
47 |
|
48 |
do_action( 'wp_login', $user_login, $user );
|
49 |
|
@@ -52,7 +95,7 @@ class Wp_Temporary_Login_Without_Password_Public {
|
|
52 |
$redirect_to = $redirect_to_url;
|
53 |
}
|
54 |
|
55 |
-
wp_safe_redirect( $redirect_to ); // Redirect to given url after successfull login
|
56 |
}
|
57 |
exit();
|
58 |
}
|
@@ -67,10 +110,10 @@ class Wp_Temporary_Login_Without_Password_Public {
|
|
67 |
} else {
|
68 |
global $pagenow;
|
69 |
$bloked_pages = Wp_Temporary_Login_Without_Password_Common::get_blocked_pages();
|
70 |
-
$page = ! empty( $_GET['page'] ) ? $_GET['page'] : '';
|
71 |
|
72 |
-
if ( ! empty( $page ) && in_array( $page, $bloked_pages
|
73 |
-
wp_die(
|
74 |
}
|
75 |
}
|
76 |
}
|
@@ -80,12 +123,12 @@ class Wp_Temporary_Login_Without_Password_Public {
|
|
80 |
/**
|
81 |
* Hooked to wp_authenticate_user filter to disable login for temporary user using username/email and password
|
82 |
*
|
83 |
-
* @param WP_User $user
|
84 |
-
* @param string
|
85 |
*
|
86 |
* @return \WP_Error
|
87 |
*/
|
88 |
-
function disable_temporary_user_login( $user, $password ) {
|
89 |
|
90 |
if ( $user instanceof WP_User ) {
|
91 |
$check_expiry = false;
|
@@ -103,12 +146,12 @@ class Wp_Temporary_Login_Without_Password_Public {
|
|
103 |
/**
|
104 |
* Hooked to allow_password_reset filter to disable reset password for temporary user
|
105 |
*
|
106 |
-
* @param boolean $allow
|
107 |
-
* @param int
|
108 |
*
|
109 |
* @return boolean
|
110 |
*/
|
111 |
-
function disable_password_reset( $allow, $user_id ) {
|
112 |
|
113 |
if ( is_int( $user_id ) ) {
|
114 |
$check_expiry = false;
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Public face of Temporary Login Without Password
|
4 |
+
*
|
5 |
+
* @package Temporary Login Without Password
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Class Wp_Temporary_Login_Without_Password_Public
|
10 |
+
*
|
11 |
+
* @package Temporary Login Without Password
|
12 |
+
*/
|
13 |
class Wp_Temporary_Login_Without_Password_Public {
|
14 |
|
15 |
+
/**
|
16 |
+
* Plugin Name
|
17 |
+
*
|
18 |
+
* @var string $plugin_name
|
19 |
+
*/
|
20 |
private $plugin_name;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Plugin Version
|
24 |
+
*
|
25 |
+
* @var string $version
|
26 |
+
*/
|
27 |
private $version;
|
28 |
|
29 |
+
/**
|
30 |
+
* Wp_Temporary_Login_Without_Password_Public constructor.
|
31 |
+
*
|
32 |
+
* @param string $plugin_name Plugin Name.
|
33 |
+
* @param srting $version Plugin Version.
|
34 |
+
*/
|
35 |
public function __construct( $plugin_name, $version ) {
|
36 |
$this->plugin_name = $plugin_name;
|
37 |
$this->version = $version;
|
38 |
}
|
39 |
|
40 |
+
/**
|
41 |
+
* Get Error Message
|
42 |
+
*
|
43 |
+
* @param string $error_code Error Code.
|
44 |
+
*
|
45 |
+
* @return array|mixed|string
|
46 |
+
*/
|
47 |
public static function get_error_messages( $error_code ) {
|
48 |
|
49 |
$error_messages = array(
|
58 |
return $error_messages;
|
59 |
}
|
60 |
|
61 |
+
/**
|
62 |
+
* Initialize tlwp
|
63 |
+
*
|
64 |
+
* Hooked to init filter to initilize tlwp
|
65 |
+
*
|
66 |
+
* @since 1.0.0
|
67 |
+
*
|
68 |
+
* @return void
|
69 |
+
*/
|
70 |
public function init_wtlwp() {
|
71 |
|
72 |
+
if ( ! is_user_logged_in() && ! empty( $_GET['wtlwp_token'] ) ) { // phpcs:ignore
|
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 |
if ( empty( $users ) ) {
|
81 |
|
82 |
$user_id = $user->ID;
|
83 |
$user_login = $user->login;
|
84 |
+
update_user_meta( $user_id, '_wtlwp_last_login', Wp_Temporary_Login_Without_Password_Common::get_current_gmt_timestamp() ); // phpcs:ignore
|
85 |
wp_set_current_user( $user_id, $user_login );
|
86 |
wp_set_auth_cookie( $user_id );
|
87 |
|
88 |
$redirect_to = admin_url();
|
89 |
+
$redirect_to_url = apply_filters( 'login_redirect', $redirect_to, isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '', $user ); // phpcs:ignore
|
90 |
|
91 |
do_action( 'wp_login', $user_login, $user );
|
92 |
|
95 |
$redirect_to = $redirect_to_url;
|
96 |
}
|
97 |
|
98 |
+
wp_safe_redirect( $redirect_to ); // Redirect to given url after successfull login.
|
99 |
}
|
100 |
exit();
|
101 |
}
|
110 |
} else {
|
111 |
global $pagenow;
|
112 |
$bloked_pages = Wp_Temporary_Login_Without_Password_Common::get_blocked_pages();
|
113 |
+
$page = ! empty( $_GET['page'] ) ? $_GET['page'] : ''; //phpcs:ignore
|
114 |
|
115 |
+
if ( ! empty( $page ) && in_array( $page, $bloked_pages) || ( ! empty( $pagenow ) && ( in_array( $pagenow, $bloked_pages ) ) ) || ( ! empty( $pagenow ) && ( 'users.php' === $pagenow && isset( $_GET['action'] ) && ( 'deleteuser' === $_GET['action'] || 'delete' === $_GET['action'] ) ) ) ) { //phpcs:ignore
|
116 |
+
wp_die( esc_attr__( "You don't have permission to access this page", 'temporary-login-without-password' ) );
|
117 |
}
|
118 |
}
|
119 |
}
|
123 |
/**
|
124 |
* Hooked to wp_authenticate_user filter to disable login for temporary user using username/email and password
|
125 |
*
|
126 |
+
* @param WP_User $user WP_User object.
|
127 |
+
* @param string $password password of a user.
|
128 |
*
|
129 |
* @return \WP_Error
|
130 |
*/
|
131 |
+
public function disable_temporary_user_login( $user, $password ) {
|
132 |
|
133 |
if ( $user instanceof WP_User ) {
|
134 |
$check_expiry = false;
|
146 |
/**
|
147 |
* Hooked to allow_password_reset filter to disable reset password for temporary user
|
148 |
*
|
149 |
+
* @param boolean $allow allow to reset password.
|
150 |
+
* @param int $user_id user_id of a user.
|
151 |
*
|
152 |
* @return boolean
|
153 |
*/
|
154 |
+
public function disable_password_reset( $allow, $user_id ) {
|
155 |
|
156 |
if ( is_int( $user_id ) ) {
|
157 |
$check_expiry = false;
|
public/index.php
CHANGED
@@ -1 +1,6 @@
|
|
1 |
-
<?php
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Silence is golden
|
4 |
+
*
|
5 |
+
* @package Temporary Login Without Password
|
6 |
+
*/
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: admin login, developer account, customer access, 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: 4.9.5
|
7 |
-
Stable tag: 1.5.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -44,87 +44,91 @@ If you like Temporary Login Without Password, please leave a five star review on
|
|
44 |
|
45 |
== Changelog ==
|
46 |
|
47 |
-
**1.5.
|
|
|
|
|
|
|
|
|
48 |
|
49 |
* Update: Added settings link on Plugins page
|
50 |
* Update: URL parameters sanitized as keys (Thanks to [@danielgm](https://wordpress.org/support/users/danielgm/))
|
51 |
* Update: Paste temporary login link directly into email
|
52 |
* Fix: Lock and delete icon not clickable (Thanks to [@danielgm](https://wordpress.org/support/users/danielgm/))
|
53 |
|
54 |
-
**1.5.6 [03-14
|
55 |
|
56 |
* Fix: Datepicker doesn't show up when edit temporary login and select "custom date" value from expiry time dropdown
|
57 |
|
58 |
-
**1.5.5 [03-05
|
59 |
|
60 |
* Update: Set default expiry time as a "Week" for new temporary login instead of an "Hour".
|
61 |
* Fix: PHP Warning: in_array() expects parameter 2 to be array, string given in temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php
|
62 |
* Fix: Existing temporary user's role is not available into roles dropdown while edit.
|
63 |
|
64 |
-
**1.5.4 [02-20
|
65 |
|
66 |
* Fix: Invalid argument supplied for foreach() PHP Warning in class-wp-temporary-login-without-password-deactivator.php
|
67 |
|
68 |
-
**1.5.3 [02-06
|
69 |
|
70 |
* Update: Now, admin can change the role and expiry of temporary login
|
71 |
|
72 |
-
**1.5.2 [01-29
|
73 |
|
74 |
* Update: Now, admin can select roles from which they want to create a Tempoary Login.
|
75 |
* Fix: Temporary User with 'administrator' role shows as a 'Super Admin' for WordPress single site installation.
|
76 |
|
77 |
-
**1.5.1 [01-19
|
78 |
|
79 |
* Fix: Parse error: syntax error, unexpected ‘[‘ (PHP < 5.4)
|
80 |
|
81 |
-
**1.5 [01-08
|
82 |
|
83 |
* Update: Now, Temporary Login can be created for WordPress Multisite. Super Admin can create a temporary super admin for multisite
|
84 |
* Update: Restrict Temporary user to delete other users.
|
85 |
|
86 |
-
**1.4.6 [11-18
|
87 |
|
88 |
* Update: Now, admin can set the default role for temporary user from settings panel
|
89 |
|
90 |
-
**1.4.5 [11-13
|
91 |
|
92 |
* Update: Restrict temporary user to deactivate/delete Temporary Login Without Password plugin
|
93 |
|
94 |
-
**1.4.4 [10-23
|
95 |
|
96 |
* Fix: Trying to load scripts from unauthorized sources error.
|
97 |
|
98 |
-
**1.4.3 [08-04
|
99 |
|
100 |
* Fix: Localization issue
|
101 |
|
102 |
-
**1.4.2 [06-28
|
103 |
|
104 |
* Fix: Uncaught Error: Call to undefined function wc_enqueue_js().
|
105 |
|
106 |
-
**1.4.1 [06-23
|
107 |
|
108 |
* Update: Now, create a temporary login with custom expiry date.
|
109 |
|
110 |
-
**1.4 [09-07
|
111 |
|
112 |
* Added: Support for "Theme My Login" plugin. Now, temporary user will be redirected to page which is defined in Theme My Login plugin.
|
113 |
|
114 |
-
**1.3 [09-01
|
115 |
|
116 |
* Fix: Temporary user is able to login with email address. Now onwards, temporary user is not able to login using username/email and password
|
117 |
* Fix: Temporary user was able to reset password. Now onwards, they won't be able to reset password.
|
118 |
* Update: Now, role of temporary user is downgrade to "none" on deactivation of plugin and change to default on re activation of plugin
|
119 |
|
120 |
-
**1.2 [09-01
|
121 |
|
122 |
* Fix: Temporary user is able to login with username and password.
|
123 |
|
124 |
-
**1.1 [08-05
|
125 |
|
126 |
* Fix: Temporary user redirected to login page instead of admin dashboard after successful login.
|
127 |
|
128 |
-
**1.0 [08-04
|
129 |
|
130 |
* Initial Release
|
4 |
Tags: admin login, developer account, customer access, 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: 4.9.5
|
7 |
+
Stable tag: 1.5.8
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
44 |
|
45 |
== Changelog ==
|
46 |
|
47 |
+
**1.5.8 [2018-04-25]**
|
48 |
+
|
49 |
+
* Fix: Format temporary login link email for Apple Mail. (Thanks to [@danielgm](https://wordpress.org/support/users/danielgm/))
|
50 |
+
|
51 |
+
**1.5.7 [2018-04-11]**
|
52 |
|
53 |
* Update: Added settings link on Plugins page
|
54 |
* Update: URL parameters sanitized as keys (Thanks to [@danielgm](https://wordpress.org/support/users/danielgm/))
|
55 |
* Update: Paste temporary login link directly into email
|
56 |
* Fix: Lock and delete icon not clickable (Thanks to [@danielgm](https://wordpress.org/support/users/danielgm/))
|
57 |
|
58 |
+
**1.5.6 [2018-03-14]**
|
59 |
|
60 |
* Fix: Datepicker doesn't show up when edit temporary login and select "custom date" value from expiry time dropdown
|
61 |
|
62 |
+
**1.5.5 [2018-03-05]**
|
63 |
|
64 |
* Update: Set default expiry time as a "Week" for new temporary login instead of an "Hour".
|
65 |
* Fix: PHP Warning: in_array() expects parameter 2 to be array, string given in temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php
|
66 |
* Fix: Existing temporary user's role is not available into roles dropdown while edit.
|
67 |
|
68 |
+
**1.5.4 [2018-02-20]**
|
69 |
|
70 |
* Fix: Invalid argument supplied for foreach() PHP Warning in class-wp-temporary-login-without-password-deactivator.php
|
71 |
|
72 |
+
**1.5.3 [2018-02-06]**
|
73 |
|
74 |
* Update: Now, admin can change the role and expiry of temporary login
|
75 |
|
76 |
+
**1.5.2 [2018-01-29]**
|
77 |
|
78 |
* Update: Now, admin can select roles from which they want to create a Tempoary Login.
|
79 |
* Fix: Temporary User with 'administrator' role shows as a 'Super Admin' for WordPress single site installation.
|
80 |
|
81 |
+
**1.5.1 [2018-01-19]**
|
82 |
|
83 |
* Fix: Parse error: syntax error, unexpected ‘[‘ (PHP < 5.4)
|
84 |
|
85 |
+
**1.5 [2018-01-08]**
|
86 |
|
87 |
* Update: Now, Temporary Login can be created for WordPress Multisite. Super Admin can create a temporary super admin for multisite
|
88 |
* Update: Restrict Temporary user to delete other users.
|
89 |
|
90 |
+
**1.4.6 [2017-11-18]**
|
91 |
|
92 |
* Update: Now, admin can set the default role for temporary user from settings panel
|
93 |
|
94 |
+
**1.4.5 [2017-11-13]**
|
95 |
|
96 |
* Update: Restrict temporary user to deactivate/delete Temporary Login Without Password plugin
|
97 |
|
98 |
+
**1.4.4 [2017-10-23]**
|
99 |
|
100 |
* Fix: Trying to load scripts from unauthorized sources error.
|
101 |
|
102 |
+
**1.4.3 [2017-08-04]**
|
103 |
|
104 |
* Fix: Localization issue
|
105 |
|
106 |
+
**1.4.2 [2017-06-28]**
|
107 |
|
108 |
* Fix: Uncaught Error: Call to undefined function wc_enqueue_js().
|
109 |
|
110 |
+
**1.4.1 [2017-06-23]**
|
111 |
|
112 |
* Update: Now, create a temporary login with custom expiry date.
|
113 |
|
114 |
+
**1.4 [2016-09-07]**
|
115 |
|
116 |
* Added: Support for "Theme My Login" plugin. Now, temporary user will be redirected to page which is defined in Theme My Login plugin.
|
117 |
|
118 |
+
**1.3 [2016-09-01]**
|
119 |
|
120 |
* Fix: Temporary user is able to login with email address. Now onwards, temporary user is not able to login using username/email and password
|
121 |
* Fix: Temporary user was able to reset password. Now onwards, they won't be able to reset password.
|
122 |
* Update: Now, role of temporary user is downgrade to "none" on deactivation of plugin and change to default on re activation of plugin
|
123 |
|
124 |
+
**1.2 [2016-09-01]**
|
125 |
|
126 |
* Fix: Temporary user is able to login with username and password.
|
127 |
|
128 |
+
**1.1 [2016-08-05]**
|
129 |
|
130 |
* Fix: Temporary user redirected to login page instead of admin dashboard after successful login.
|
131 |
|
132 |
+
**1.0 [2016-08-04]**
|
133 |
|
134 |
* Initial Release
|
screenshots/screenshot-1.png
DELETED
Binary file
|
screenshots/screenshot-2.png
DELETED
Binary file
|
screenshots/screenshot-3.png
DELETED
Binary file
|
templates/admin-settings.php
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Admin Settings Template
|
4 |
+
*
|
5 |
+
* @package Temporary Login Without Password
|
6 |
+
*/
|
7 |
+
|
8 |
+
?>
|
9 |
+
<h2 class="nav-tab-wrapper">
|
10 |
+
<a href="<?php echo esc_url( admin_url( 'users.php?page=wp-temporary-login-without-password&tab=home' ) ); ?>" class="nav-tab <?php echo 'home' === $active_tab ? 'nav-tab-active' : ''; ?>"><?php echo esc_html__( 'Temporary Logins', 'temporary-login-without-password' ); ?></a>
|
11 |
+
<a href="<?php echo esc_url( admin_url( 'users.php?page=wp-temporary-login-without-password&tab=settings' ) ); ?>" class="nav-tab <?php echo 'settings' === $active_tab ? 'nav-tab-active' : ''; ?>"><?php echo esc_html__( 'Settings', 'temporary-login-without-password' ); ?></a>
|
12 |
+
</h2>
|
13 |
+
|
14 |
+
<?php if ( 'home' === $active_tab ) { ?>
|
15 |
+
<div class="wrap wtlwp-settings-wrap" id="temporary-logins">
|
16 |
+
<h2>
|
17 |
+
<?php echo esc_html__( 'Temporary Logins', 'temporary-login-without-password' ); ?>
|
18 |
+
<span class="page-title-action" id="add-new-wtlwp-form-button"><?php esc_html_e( 'Create New', 'temporary-login-without-password' ); ?></span>
|
19 |
+
</h2>
|
20 |
+
<div class="wtlwp-settings">
|
21 |
+
<!-- Add New Form Start -->
|
22 |
+
|
23 |
+
<div class="wrap new-wtlwp-form" id="new-wtlwp-form">
|
24 |
+
<?php include WTLWP_PLUGIN_DIR . '/templates/new-login.php'; ?>
|
25 |
+
</div>
|
26 |
+
|
27 |
+
<?php if ( $do_update ) { ?>
|
28 |
+
|
29 |
+
<div class="wrap update-wtlwp-form" id="update-wtlwp-form">
|
30 |
+
<?php include WTLWP_PLUGIN_DIR . '/templates/update-login.php'; ?>
|
31 |
+
</div>
|
32 |
+
|
33 |
+
<?php } ?>
|
34 |
+
|
35 |
+
<?php $wtlwp_generated_url = esc_url( $wtlwp_generated_url );
|
36 |
+
if ( ! empty( $wtlwp_generated_url ) ) { ?>
|
37 |
+
|
38 |
+
<div class="wrap generated-wtlwp-login-link" id="generated-wtlwp-login-link">
|
39 |
+
<p>
|
40 |
+
<?php esc_attr_e( "Here's a temporary login link", 'temporary-login-without-password' ); ?>
|
41 |
+
</p>
|
42 |
+
<input id="wtlwp-click-to-copy-btn" type="text" class="wtlwp-wide-input" value="<?php echo esc_url( $wtlwp_generated_url ); ?>">
|
43 |
+
<button class="wtlwp-click-to-copy-btn" data-clipboard-action="copy" data-clipboard-target="#wtlwp-click-to-copy-btn"><?php echo esc_html__( 'Click To Copy', 'temporary-login-without-password' ); ?></button>
|
44 |
+
<span id="copied-text-message-wtlwp-click-to-copy-btn"></span>
|
45 |
+
<p>
|
46 |
+
<?php
|
47 |
+
esc_attr_e( 'User can directly login to WordPress admin panel without username and password by opening this link.', 'temporary-login-without-password' );
|
48 |
+
if ( ! empty( $user_email ) ) {
|
49 |
+
/* translators: %s: mailto link */
|
50 |
+
echo __( sprintf( '<a href="%s">Email</a> temporary login link to user', $mailto_link ), 'temporary-login-without-password' ); //phpcs:ignore
|
51 |
+
}
|
52 |
+
?>
|
53 |
+
</p>
|
54 |
+
|
55 |
+
</div>
|
56 |
+
<?php } ?>
|
57 |
+
<!-- Add New Form End -->
|
58 |
+
|
59 |
+
<!-- List All Generated Logins Start -->
|
60 |
+
<div class="wrap list-wtlwp-logins" id="list-wtlwp-logins">
|
61 |
+
<?php load_template( WTLWP_PLUGIN_DIR . '/templates/list-temporary-logins.php' ); ?>
|
62 |
+
</div>
|
63 |
+
<!-- List All Generated Logins End -->
|
64 |
+
</div>
|
65 |
+
</div>
|
66 |
+
<?php } elseif ( 'settings' === $active_tab ) { ?>
|
67 |
+
|
68 |
+
<div class="wrap list-wtlwp-logins" id="wtlwp-logins-settings">
|
69 |
+
<?php include WTLWP_PLUGIN_DIR . '/templates/temporary-logins-settings.php'; ?>
|
70 |
+
</div>
|
71 |
+
|
72 |
+
<?php } ?>
|
templates/admin_settings.php
DELETED
@@ -1,67 +0,0 @@
|
|
1 |
-
<?php ?>
|
2 |
-
<h2 class="nav-tab-wrapper">
|
3 |
-
<a href="<?php echo admin_url( 'users.php?page=wp-temporary-login-without-password&tab=home' ); ?>"
|
4 |
-
class="nav-tab <?php echo $active_tab == 'home' ? 'nav-tab-active' : ''; ?>">Temporary Logins</a>
|
5 |
-
<a href="<?php echo admin_url( 'users.php?page=wp-temporary-login-without-password&tab=settings' ); ?>"
|
6 |
-
class="nav-tab <?php echo $active_tab == 'settings' ? 'nav-tab-active' : ''; ?>">Settings</a>
|
7 |
-
</h2>
|
8 |
-
|
9 |
-
|
10 |
-
<?php if ( 'home' === $active_tab ) { ?>
|
11 |
-
<div class="wrap wtlwp-settings-wrap" id="temporary-logins">
|
12 |
-
<h2>
|
13 |
-
<?php echo __( 'Temporary Logins', 'temporary-login-without-password' ); ?>
|
14 |
-
<span class="page-title-action" id="add-new-wtlwp-form-button"><?php _e( 'Create New', 'temporary-login-without-password' ); ?></span>
|
15 |
-
</h2>
|
16 |
-
<div class="wtlwp-settings">
|
17 |
-
<!-- Add New Form Start -->
|
18 |
-
|
19 |
-
<div class="wrap new-wtlwp-form" id="new-wtlwp-form">
|
20 |
-
<?php include WTLWP_PLUGIN_DIR . '/templates/new_login.php'; ?>
|
21 |
-
</div>
|
22 |
-
|
23 |
-
<?php if ( $do_update ) { ?>
|
24 |
-
|
25 |
-
<div class="wrap update-wtlwp-form" id="update-wtlwp-form">
|
26 |
-
<?php include WTLWP_PLUGIN_DIR . '/templates/update_login.php'; ?>
|
27 |
-
</div>
|
28 |
-
|
29 |
-
<?php } ?>
|
30 |
-
|
31 |
-
<?php if ( ! empty( $wtlwp_generated_url ) ) { ?>
|
32 |
-
|
33 |
-
<div class="wrap generated-wtlwp-login-link" id="generated-wtlwp-login-link">
|
34 |
-
<p>
|
35 |
-
<?php _e( "Here's a temporary login link", 'temporary-login-without-password' ); ?>
|
36 |
-
</p>
|
37 |
-
<input id="wtlwp-click-to-copy-btn" type="text" class="wtlwp-wide-input" value="<?php echo $wtlwp_generated_url; ?>">
|
38 |
-
<button class="wtlwp-click-to-copy-btn" data-clipboard-action="copy" data-clipboard-target="#wtlwp-click-to-copy-btn"><?php echo __( 'Click To Copy', 'temporary-login-without-password' ); ?></button>
|
39 |
-
<span id="copied-text-message-wtlwp-click-to-copy-btn"></span>
|
40 |
-
<p>
|
41 |
-
<?php
|
42 |
-
_e( 'User can directly login to wordpress admin panel without username and password by opening this link.', 'temporary-login-without-password' );
|
43 |
-
if ( ! empty( $user_email ) ) {
|
44 |
-
echo __( sprintf( " <a href='{$mailto_link}'>Email</a> temporary login link to user."), 'temporary-login-without-password' );
|
45 |
-
}
|
46 |
-
?>
|
47 |
-
</p>
|
48 |
-
|
49 |
-
</div>
|
50 |
-
<?php } ?>
|
51 |
-
<!-- Add New Form End -->
|
52 |
-
|
53 |
-
<!-- List All Generated Logins Start -->
|
54 |
-
<div class="wrap list-wtlwp-logins" id="list-wtlwp-logins">
|
55 |
-
<?php load_template( WTLWP_PLUGIN_DIR . '/templates/list_temporary_logins.php' ); ?>
|
56 |
-
</div>
|
57 |
-
<!-- List All Generated Logins End -->
|
58 |
-
</div>
|
59 |
-
</div>
|
60 |
-
<?php } elseif ( 'settings' === $active_tab ) { ?>
|
61 |
-
|
62 |
-
<div class="wrap list-wtlwp-logins" id="wtlwp-logins-settings">
|
63 |
-
<?php include WTLWP_PLUGIN_DIR . '/templates/temporary_logins_settings.php' ?>
|
64 |
-
</div>
|
65 |
-
|
66 |
-
<?php }// End if().
|
67 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
templates/{list_temporary_logins.php → list-temporary-logins.php}
RENAMED
@@ -1,5 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<table class="wp-list-table widefat fixed striped users">
|
2 |
-
|
3 |
<?php echo Wp_Temporary_Login_Without_Password_Layout::prepare_header_footer_row(); ?>
|
4 |
</thead>
|
5 |
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* List Temporary Logins
|
4 |
+
*
|
5 |
+
* @package Temporary Login Without Password
|
6 |
+
*/
|
7 |
+
|
8 |
+
?>
|
9 |
<table class="wp-list-table widefat fixed striped users">
|
10 |
+
<thead>
|
11 |
<?php echo Wp_Temporary_Login_Without_Password_Layout::prepare_header_footer_row(); ?>
|
12 |
</thead>
|
13 |
|
templates/{new_login.php → new-login.php}
RENAMED
@@ -1,9 +1,17 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
<form method="post">
|
3 |
<table class="form-table wtlwp-form">
|
4 |
<tr class="form-field form-required">
|
5 |
<th scope="row" class="wtlwp-form-row">
|
6 |
-
<label for="user_email"><?php echo
|
7 |
</th>
|
8 |
<td>
|
9 |
<input name="wtlwp_data[user_email]" type="text" id="user_email" value="" aria-required="true" maxlength="60" class="wtlwp-form-input"/>
|
@@ -12,7 +20,7 @@
|
|
12 |
|
13 |
<tr class="form-field form-required">
|
14 |
<th scope="row" class="wtlwp-form-row">
|
15 |
-
<label for="user_first_name"><?php echo
|
16 |
</th>
|
17 |
<td>
|
18 |
<input name="wtlwp_data[user_first_name]" type="text" id="user_first_name" value="" aria-required="true" maxlength="60" class="wtlwp-form-input"/>
|
@@ -21,7 +29,7 @@
|
|
21 |
|
22 |
<tr class="form-field form-required">
|
23 |
<th scope="row" class="wtlwp-form-row">
|
24 |
-
<label for="user_last_name"><?php echo
|
25 |
</th>
|
26 |
<td>
|
27 |
<input name="wtlwp_data[user_last_name]" type="text" id="user_last_name" value="" aria-required="true" maxlength="60" class="wtlwp-form-input"/>
|
@@ -31,17 +39,16 @@
|
|
31 |
<?php if ( is_network_admin() ) { ?>
|
32 |
<tr class="form-field form-required">
|
33 |
<th scope="row" class="wtlwp-form-row">
|
34 |
-
<label for="user_super_admin"><?php echo
|
35 |
</th>
|
36 |
<td>
|
37 |
-
<input type="checkbox" id="user_super_admin"
|
38 |
-
name="wtlwp_data[super_admin]"><?php echo __( 'Grant this user super admin privileges for the Network.', 'temporary-login-without-password' ); ?>
|
39 |
</td>
|
40 |
</tr>
|
41 |
<?php } else { ?>
|
42 |
<tr class="form-field">
|
43 |
<th scope="row" class="wtlwp-form-row">
|
44 |
-
<label for="adduser-role"><?php echo
|
45 |
</th>
|
46 |
<td>
|
47 |
<select name="wtlwp_data[role]" id="user-role">
|
@@ -53,13 +60,13 @@
|
|
53 |
|
54 |
<tr class="form-field">
|
55 |
<th scope="row" class="wtlwp-form-row">
|
56 |
-
<label for="adduser-role"><?php echo
|
57 |
</th>
|
58 |
<td>
|
59 |
<span id="expiry-date-selection">
|
60 |
<select name="wtlwp_data[expiry]" id="new-user-expiry-time">
|
61 |
-
|
62 |
-
|
63 |
</span>
|
64 |
|
65 |
<span style="display:none;" id="new-custom-date-picker">
|
@@ -73,8 +80,8 @@
|
|
73 |
<th scope="row" class="wtlwp-form-row"><label for="adduser-role"></label></th>
|
74 |
<td>
|
75 |
<p class="submit">
|
76 |
-
<input type="submit" class="button button-primary wtlwp-form-submit-button" value="<?php
|
77 |
-
<span class="cancel-new-login-form" id="cancel-new-login-form"><?php
|
78 |
</p>
|
79 |
</td>
|
80 |
</tr>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Create New Temporary Login template
|
4 |
+
*
|
5 |
+
* @package Temporary Login Without Password
|
6 |
+
*/
|
7 |
+
|
8 |
+
?>
|
9 |
+
<h2> <?php echo esc_html__( 'Create a new Temporary Login', 'temporary-login-without-password' ); ?></h2>
|
10 |
<form method="post">
|
11 |
<table class="form-table wtlwp-form">
|
12 |
<tr class="form-field form-required">
|
13 |
<th scope="row" class="wtlwp-form-row">
|
14 |
+
<label for="user_email"><?php echo esc_html__( 'Email*', 'temporary-login-without-password' ); ?> </label>
|
15 |
</th>
|
16 |
<td>
|
17 |
<input name="wtlwp_data[user_email]" type="text" id="user_email" value="" aria-required="true" maxlength="60" class="wtlwp-form-input"/>
|
20 |
|
21 |
<tr class="form-field form-required">
|
22 |
<th scope="row" class="wtlwp-form-row">
|
23 |
+
<label for="user_first_name"><?php echo esc_html__( 'First Name', 'temporary-login-without-password' ); ?> </label>
|
24 |
</th>
|
25 |
<td>
|
26 |
<input name="wtlwp_data[user_first_name]" type="text" id="user_first_name" value="" aria-required="true" maxlength="60" class="wtlwp-form-input"/>
|
29 |
|
30 |
<tr class="form-field form-required">
|
31 |
<th scope="row" class="wtlwp-form-row">
|
32 |
+
<label for="user_last_name"><?php echo esc_html__( 'Last Name', 'temporary-login-without-password' ); ?> </label>
|
33 |
</th>
|
34 |
<td>
|
35 |
<input name="wtlwp_data[user_last_name]" type="text" id="user_last_name" value="" aria-required="true" maxlength="60" class="wtlwp-form-input"/>
|
39 |
<?php if ( is_network_admin() ) { ?>
|
40 |
<tr class="form-field form-required">
|
41 |
<th scope="row" class="wtlwp-form-row">
|
42 |
+
<label for="user_super_admin"><?php echo esc_html__( 'Super Admin', 'temporary-login-without-password' ); ?> </label>
|
43 |
</th>
|
44 |
<td>
|
45 |
+
<input type="checkbox" id="user_super_admin" name="wtlwp_data[super_admin]"><?php echo esc_html__( 'Grant this user super admin privileges for the Network.', 'temporary-login-without-password' ); ?>
|
|
|
46 |
</td>
|
47 |
</tr>
|
48 |
<?php } else { ?>
|
49 |
<tr class="form-field">
|
50 |
<th scope="row" class="wtlwp-form-row">
|
51 |
+
<label for="adduser-role"><?php echo esc_html__( 'Role', 'temporary-login-without-password' ); ?></label>
|
52 |
</th>
|
53 |
<td>
|
54 |
<select name="wtlwp_data[role]" id="user-role">
|
60 |
|
61 |
<tr class="form-field">
|
62 |
<th scope="row" class="wtlwp-form-row">
|
63 |
+
<label for="adduser-role"><?php echo esc_html__( 'Expiry', 'temporary-login-without-password' ); ?></label>
|
64 |
</th>
|
65 |
<td>
|
66 |
<span id="expiry-date-selection">
|
67 |
<select name="wtlwp_data[expiry]" id="new-user-expiry-time">
|
68 |
+
<?php Wp_Temporary_Login_Without_Password_Common::get_expiry_duration_html( 'week' ); ?>
|
69 |
+
</select>
|
70 |
</span>
|
71 |
|
72 |
<span style="display:none;" id="new-custom-date-picker">
|
80 |
<th scope="row" class="wtlwp-form-row"><label for="adduser-role"></label></th>
|
81 |
<td>
|
82 |
<p class="submit">
|
83 |
+
<input type="submit" class="button button-primary wtlwp-form-submit-button" value="<?php esc_html_e( 'Submit', 'temporary-login-without-password' ); ?>" class="button button-primary" id="generatetemporarylogin" name="generate_temporary_login"> <?php esc_html_e( 'or', 'temporary-login-without-password' ); ?>
|
84 |
+
<span class="cancel-new-login-form" id="cancel-new-login-form"><?php esc_html_e( 'Cancel', 'temporary-login-without-password' ); ?></span>
|
85 |
</p>
|
86 |
</td>
|
87 |
</tr>
|
templates/{temporary_logins_settings.php → temporary-logins-settings.php}
RENAMED
@@ -1,10 +1,18 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
<form method="post">
|
3 |
<table class="form-table wtlwp-form">
|
4 |
<tr class="form-field">
|
5 |
<th scope="row" class="wtlwp-form-row">
|
6 |
-
<label for="visible_roles"><?php echo
|
7 |
-
<p class="description"><?php echo
|
8 |
|
9 |
</th>
|
10 |
<td>
|
@@ -15,7 +23,7 @@
|
|
15 |
</tr>
|
16 |
<tr class="form-field">
|
17 |
<th scope="row" class="wtlwp-form-row">
|
18 |
-
<label for="adduser-role"><?php echo
|
19 |
</th>
|
20 |
<td>
|
21 |
<select name="tlwp_settings_data[default_role]" id="default-role" class="default-role-dropdown">
|
@@ -25,10 +33,10 @@
|
|
25 |
</tr>
|
26 |
|
27 |
<tr class="form-field">
|
28 |
-
|
29 |
<td>
|
30 |
<p class="submit">
|
31 |
-
<input type="submit" class="button button-primary wtlwp-form-submit-button" value="<?php
|
32 |
</p>
|
33 |
</td>
|
34 |
</tr>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Temporary Login settings template
|
4 |
+
*
|
5 |
+
* @package Temporary Login Without Password
|
6 |
+
*/
|
7 |
+
|
8 |
+
?>
|
9 |
+
<h2> <?php echo esc_html__( 'Temporary Login Settings', 'temporary-login-without-password' ); ?></h2>
|
10 |
<form method="post">
|
11 |
<table class="form-table wtlwp-form">
|
12 |
<tr class="form-field">
|
13 |
<th scope="row" class="wtlwp-form-row">
|
14 |
+
<label for="visible_roles"><?php echo esc_html__( 'Visible Roles', 'temporary-login-without-password' ); ?></label>
|
15 |
+
<p class="description"><?php echo esc_html__( 'select roles from which you want to create a temporary login', 'temporary-login-without-password' ); ?></p>
|
16 |
|
17 |
</th>
|
18 |
<td>
|
23 |
</tr>
|
24 |
<tr class="form-field">
|
25 |
<th scope="row" class="wtlwp-form-row">
|
26 |
+
<label for="adduser-role"><?php echo esc_html__( 'Default Role', 'temporary-login-without-password' ); ?></label>
|
27 |
</th>
|
28 |
<td>
|
29 |
<select name="tlwp_settings_data[default_role]" id="default-role" class="default-role-dropdown">
|
33 |
</tr>
|
34 |
|
35 |
<tr class="form-field">
|
36 |
+
<th scope="row" class="wtlwp-form-row"><label for="temporary-login-settings"></label></th>
|
37 |
<td>
|
38 |
<p class="submit">
|
39 |
+
<input type="submit" class="button button-primary wtlwp-form-submit-button" value="<?php esc_html_e( 'Submit', 'temporary-login-without-password' ); ?>" class="button button-primary" id="generatetemporarylogin" name="generate_temporary_login">
|
40 |
</p>
|
41 |
</td>
|
42 |
</tr>
|
templates/update-login.php
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Update Login template
|
4 |
+
*
|
5 |
+
* @package Temporary Login Without Password
|
6 |
+
*/
|
7 |
+
|
8 |
+
?>
|
9 |
+
<h2> <?php echo esc_html__( 'Update Temporary Login', 'temporary-login-without-password' ); ?></h2>
|
10 |
+
<form method="post">
|
11 |
+
<table class="form-table wtlwp-form">
|
12 |
+
<tr class="form-field form-required">
|
13 |
+
<th scope="row" class="wtlwp-form-row">
|
14 |
+
<label for="user_email"><?php echo esc_html__( 'Email', 'temporary-login-without-password' ); ?> </label>
|
15 |
+
</th>
|
16 |
+
<td>
|
17 |
+
<label for="user_email"><?php echo esc_attr( $temporary_user_data['email'] ); ?></label>
|
18 |
+
</td>
|
19 |
+
</tr>
|
20 |
+
|
21 |
+
<tr class="form-field form-required">
|
22 |
+
<th scope="row" class="wtlwp-form-row">
|
23 |
+
<label for="user_first_name"><?php echo esc_html__( 'First Name', 'temporary-login-without-password' ); ?> </label>
|
24 |
+
</th>
|
25 |
+
<td>
|
26 |
+
<input name="wtlwp_data[user_first_name]" type="text" id="user_first_name" value="<?php echo esc_attr( $temporary_user_data['first_name'] ); ?>" aria-required="true" maxlength="60" class="wtlwp-form-input"/>
|
27 |
+
</td>
|
28 |
+
</tr>
|
29 |
+
|
30 |
+
<tr class="form-field form-required">
|
31 |
+
<th scope="row" class="wtlwp-form-row">
|
32 |
+
<label for="user_last_name"><?php echo esc_html__( 'Last Name', 'temporary-login-without-password' ); ?> </label>
|
33 |
+
</th>
|
34 |
+
<td>
|
35 |
+
<input name="wtlwp_data[user_last_name]" type="text" id="user_last_name" value="<?php echo esc_attr( $temporary_user_data['last_name'] ); ?>" aria-required="true" maxlength="60" class="wtlwp-form-input"/>
|
36 |
+
</td>
|
37 |
+
</tr>
|
38 |
+
|
39 |
+
<?php if ( is_network_admin() ) { ?>
|
40 |
+
<tr class="form-field form-required">
|
41 |
+
<th scope="row" class="wtlwp-form-row">
|
42 |
+
<label for="user_super_admin"><?php echo esc_html__( 'Super Admin', 'temporary-login-without-password' ); ?> </label>
|
43 |
+
</th>
|
44 |
+
<td>
|
45 |
+
<input type="checkbox" id="user_super_admin" name="wtlwp_data[super_admin]">
|
46 |
+
<?php echo esc_html__( 'Grant this user super admin privileges for the Network.', 'temporary-login-without-password' ); ?>
|
47 |
+
</td>
|
48 |
+
</tr>
|
49 |
+
<?php } else { ?>
|
50 |
+
<tr class="form-field">
|
51 |
+
<th scope="row" class="wtlwp-form-row">
|
52 |
+
<label for="adduser-role"><?php echo esc_html__( 'Role', 'temporary-login-without-password' ); ?></label>
|
53 |
+
</th>
|
54 |
+
<td>
|
55 |
+
<select name="wtlwp_data[role]" id="user-role">
|
56 |
+
<?php
|
57 |
+
$role = $temporary_user_data['role'];
|
58 |
+
Wp_Temporary_Login_Without_Password_Common::tlwp_dropdown_roles( $visible_roles, $role );
|
59 |
+
?>
|
60 |
+
</select>
|
61 |
+
</td>
|
62 |
+
</tr>
|
63 |
+
<?php } ?>
|
64 |
+
|
65 |
+
<tr class="form-field">
|
66 |
+
<th scope="row" class="wtlwp-form-row">
|
67 |
+
<label for="adduser-role"><?php echo esc_html__( 'Extend Expiry', 'temporary-login-without-password' ); ?></label>
|
68 |
+
</th>
|
69 |
+
<td>
|
70 |
+
<span id="expiry-date-selection">
|
71 |
+
<select name="wtlwp_data[expiry]" id="update-user-expiry-time">
|
72 |
+
<?php Wp_Temporary_Login_Without_Password_Common::get_expiry_duration_html( 'week' ); ?>
|
73 |
+
</select>
|
74 |
+
</span>
|
75 |
+
|
76 |
+
<span style="display:none;" id="update-custom-date-picker">
|
77 |
+
<input type="date" id="datepicker" name="wtlwp_data[custom_date]" value="" class="update-custom-date-picker"/>
|
78 |
+
</span>
|
79 |
+
|
80 |
+
</td>
|
81 |
+
</tr>
|
82 |
+
|
83 |
+
<tr class="form-field">
|
84 |
+
<th scope="row" class="wtlwp-form-row"><label for="adduser-role"></label></th>
|
85 |
+
<td>
|
86 |
+
<p class="submit">
|
87 |
+
<input type="submit" class="button button-primary wtlwp-form-submit-button" value="<?php esc_html_e( 'Submit', 'temporary-login-without-password' ); ?>" class="button button-primary" id="generatetemporarylogin" name="generate_temporary_login"> <?php esc_html_e( 'or', 'temporary-login-without-password' ); ?>
|
88 |
+
<span class="cancel-update-login-form" id="cancel-update-login-form"><?php esc_html_e( 'Cancel', 'temporary-login-without-password' ); ?></span>
|
89 |
+
</p>
|
90 |
+
</td>
|
91 |
+
</tr>
|
92 |
+
<input type="hidden" name="wtlwp_action" value="update"/>
|
93 |
+
<input type="hidden" name="wtlwp_data[user_id]" value="<?php echo esc_attr( $user_id ); ?>"/>
|
94 |
+
<?php wp_nonce_field( 'manage-temporary-login_' . $user_id, 'manage-temporary-login', true, true ); ?>
|
95 |
+
</table>
|
96 |
+
</form>
|
templates/update_login.php
DELETED
@@ -1,88 +0,0 @@
|
|
1 |
-
<h2> <?php echo __( 'Update Temporary Login', 'temporary-login-without-password' ); ?></h2>
|
2 |
-
<form method="post">
|
3 |
-
<table class="form-table wtlwp-form">
|
4 |
-
<tr class="form-field form-required">
|
5 |
-
<th scope="row" class="wtlwp-form-row">
|
6 |
-
<label for="user_email"><?php echo __( 'Email', 'temporary-login-without-password' ); ?> </label>
|
7 |
-
</th>
|
8 |
-
<td>
|
9 |
-
<label for="user_email"><?php echo $temporary_user_data['email']; ?></label>
|
10 |
-
</td>
|
11 |
-
</tr>
|
12 |
-
|
13 |
-
<tr class="form-field form-required">
|
14 |
-
<th scope="row" class="wtlwp-form-row">
|
15 |
-
<label for="user_first_name"><?php echo __( 'First Name', 'temporary-login-without-password' ); ?> </label>
|
16 |
-
</th>
|
17 |
-
<td>
|
18 |
-
<input name="wtlwp_data[user_first_name]" type="text" id="user_first_name" value="<?php echo $temporary_user_data['first_name']; ?>" aria-required="true" maxlength="60" class="wtlwp-form-input"/>
|
19 |
-
</td>
|
20 |
-
</tr>
|
21 |
-
|
22 |
-
<tr class="form-field form-required">
|
23 |
-
<th scope="row" class="wtlwp-form-row">
|
24 |
-
<label for="user_last_name"><?php echo __( 'Last Name', 'temporary-login-without-password' ); ?> </label>
|
25 |
-
</th>
|
26 |
-
<td>
|
27 |
-
<input name="wtlwp_data[user_last_name]" type="text" id="user_last_name" value="<?php echo $temporary_user_data['last_name']; ?>" aria-required="true" maxlength="60" class="wtlwp-form-input"/>
|
28 |
-
</td>
|
29 |
-
</tr>
|
30 |
-
|
31 |
-
<?php if ( is_network_admin() ) { ?>
|
32 |
-
<tr class="form-field form-required">
|
33 |
-
<th scope="row" class="wtlwp-form-row">
|
34 |
-
<label for="user_super_admin"><?php echo __( 'Super Admin', 'temporary-login-without-password' ); ?> </label>
|
35 |
-
</th>
|
36 |
-
<td>
|
37 |
-
<input type="checkbox" id="user_super_admin" name="wtlwp_data[super_admin]">
|
38 |
-
<?php echo __( 'Grant this user super admin privileges for the Network.', 'temporary-login-without-password' ); ?>
|
39 |
-
</td>
|
40 |
-
</tr>
|
41 |
-
<?php } else { ?>
|
42 |
-
<tr class="form-field">
|
43 |
-
<th scope="row" class="wtlwp-form-row">
|
44 |
-
<label for="adduser-role"><?php echo __( 'Role', 'temporary-login-without-password' ); ?></label>
|
45 |
-
</th>
|
46 |
-
<td>
|
47 |
-
<select name="wtlwp_data[role]" id="user-role">
|
48 |
-
<?php
|
49 |
-
$role = $temporary_user_data['role'];
|
50 |
-
Wp_Temporary_Login_Without_Password_Common::tlwp_dropdown_roles( $visible_roles, $role );
|
51 |
-
?>
|
52 |
-
</select>
|
53 |
-
</td>
|
54 |
-
</tr>
|
55 |
-
<?php } ?>
|
56 |
-
|
57 |
-
<tr class="form-field">
|
58 |
-
<th scope="row" class="wtlwp-form-row">
|
59 |
-
<label for="adduser-role"><?php echo __( 'Extend Expiry', 'temporary-login-without-password' ); ?></label>
|
60 |
-
</th>
|
61 |
-
<td>
|
62 |
-
<span id="expiry-date-selection">
|
63 |
-
<select name="wtlwp_data[expiry]" id="update-user-expiry-time">
|
64 |
-
<?php Wp_Temporary_Login_Without_Password_Common::get_expiry_duration_html('week'); ?>
|
65 |
-
</select>
|
66 |
-
</span>
|
67 |
-
|
68 |
-
<span style="display:none;" id="update-custom-date-picker">
|
69 |
-
<input type="date" id="datepicker" name="wtlwp_data[custom_date]" value="" class="update-custom-date-picker"/>
|
70 |
-
</span>
|
71 |
-
|
72 |
-
</td>
|
73 |
-
</tr>
|
74 |
-
|
75 |
-
<tr class="form-field">
|
76 |
-
<th scope="row" class="wtlwp-form-row"><label for="adduser-role"></label></th>
|
77 |
-
<td>
|
78 |
-
<p class="submit">
|
79 |
-
<input type="submit" class="button button-primary wtlwp-form-submit-button" value="<?php _e( 'Submit', 'temporary-login-without-password' ); ?>" class="button button-primary" id="generatetemporarylogin" name="generate_temporary_login"> <?php _e( 'or', 'temporary-login-without-password' ); ?>
|
80 |
-
<span class="cancel-update-login-form" id="cancel-update-login-form"><?php _e( 'Cancel', 'temporary-login-without-password' ); ?></span>
|
81 |
-
</p>
|
82 |
-
</td>
|
83 |
-
</tr>
|
84 |
-
<input type="hidden" name="wtlwp_action" value="update" />
|
85 |
-
<input type="hidden" name="wtlwp_data[user_id]" value="<?php echo $user_id; ?>" />
|
86 |
-
<?php wp_nonce_field( 'manage-temporary-login_' . $user_id, 'manage-temporary-login', true, true ); ?>
|
87 |
-
</table>
|
88 |
-
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
temporary-login-without-password.php
CHANGED
@@ -3,7 +3,7 @@
|
|
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: http://storeapps.org
|
9 |
* Requires at least: 3.0.1
|
@@ -13,6 +13,8 @@
|
|
13 |
* Text Domain: temporary-login-without-password
|
14 |
* Domain Path: /languages
|
15 |
* Copyright (c) 2016, 2017 StoreApps, All right reserved
|
|
|
|
|
16 |
*/
|
17 |
|
18 |
// If this file is called directly, abort.
|
@@ -24,8 +26,8 @@ if ( ! defined( 'WPINC' ) ) {
|
|
24 |
* Define constants
|
25 |
*/
|
26 |
define( 'WTLWP_PLUGIN_DIR', dirname( __FILE__ ) );
|
27 |
-
define( 'WTLWP_PLUGIN_VERSION', '1.5.
|
28 |
-
define( 'WTLWP_PLUGIN_BASE_NAME', plugin_basename(__FILE__));
|
29 |
|
30 |
/**
|
31 |
* Deactivate Temporary Login Without Password
|
@@ -51,7 +53,7 @@ register_deactivation_hook( __FILE__, 'wp_deactivate_temporary_login_without_pas
|
|
51 |
register_activation_hook( __FILE__, 'wp_activate_temporary_login_without_password' );
|
52 |
|
53 |
|
54 |
-
// Include main class file
|
55 |
require plugin_dir_path( __FILE__ ) . 'includes/class-wp-temporary-login-without-password.php';
|
56 |
|
57 |
/**
|
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.8
|
7 |
* Author: StoreApps
|
8 |
* Author URI: http://storeapps.org
|
9 |
* Requires at least: 3.0.1
|
13 |
* Text Domain: temporary-login-without-password
|
14 |
* Domain Path: /languages
|
15 |
* Copyright (c) 2016, 2017 StoreApps, All right reserved
|
16 |
+
*
|
17 |
+
* @package Temporary Login Without Password
|
18 |
*/
|
19 |
|
20 |
// If this file is called directly, abort.
|
26 |
* Define constants
|
27 |
*/
|
28 |
define( 'WTLWP_PLUGIN_DIR', dirname( __FILE__ ) );
|
29 |
+
define( 'WTLWP_PLUGIN_VERSION', '1.5.8' );
|
30 |
+
define( 'WTLWP_PLUGIN_BASE_NAME', plugin_basename( __FILE__ ) );
|
31 |
|
32 |
/**
|
33 |
* Deactivate Temporary Login Without Password
|
53 |
register_activation_hook( __FILE__, 'wp_activate_temporary_login_without_password' );
|
54 |
|
55 |
|
56 |
+
// Include main class file.
|
57 |
require plugin_dir_path( __FILE__ ) . 'includes/class-wp-temporary-login-without-password.php';
|
58 |
|
59 |
/**
|