PluginProbe
DoLogin Security / trunk
DoLogin Security vtrunk
5.0.10 4.8.3 trunk 1.0 1.1 1.1.1 1.2 1.2.1 1.2.2 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.5 1.6 All 64 releases
dologin / tpl / site.tpl.php

site.tpl.php in DoLogin Security trunk, at tpl/site.tpl.php

139 lines 5.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Site connections template.
4 *
5 * @package dologin
6 */
7
8 namespace dologin;
9
10 defined( 'WPINC' ) || exit;
11
12 ?>
13 <?php if ( KLSso::force_enabled() ) : ?>
14 <div class="notice notice-warning inline"><p><?php echo wp_kses_post( __( '<code>Force KeyLockr SSO</code> is enabled. Connected-site login tokens remain manageable here but cannot be used to log in.', 'dologin' ) ); ?></p></div>
15 <?php endif; ?>
16 <form method="post" action="<?php echo esc_url( menu_page_url( 'dologin', false ) ); ?>" class="dologin-relative" id="token_form">
17 <input type="hidden" name="<?php echo esc_attr( Router::ACTION ); ?>" value="<?php echo esc_attr( Router::ACTION_SITE ); ?>" />
18 <input type="hidden" name="<?php echo esc_attr( Router::TYPE ); ?>" value="<?php echo esc_attr( Site::TYPE_CONNECT ); ?>" />
19 <?php wp_nonce_field( 'site', Router::NONCE ); ?>
20
21 <h3 class="dologin-title-short"><?php esc_html_e( 'Add Child Site Connection', 'dologin' ); ?></h3>
22
23 <table class="wp-list-table striped dologin-table">
24 <tbody>
25 <tr>
26 <th><?php esc_html_e( 'Token', 'dologin' ); ?></th>
27 <td>
28 <div class="dologin-textarea-recommended">
29 <div>
30 <textarea name='token' rows='3' cols='80' id="token_textarea"></textarea>
31 </div>
32 <div>
33 <?php submit_button( esc_html__( 'Add Site', 'dologin' ), 'dologin-btn-success', 'dologin-submit' ); ?>
34 </div>
35 </div>
36 <div class="dologin-desc">
37 <?php esc_html_e( "Add the child site's token you want to connect to.", 'dologin' ); ?>
38 <?php esc_html_e( 'This will allow you to login to other sites by one click in future.', 'dologin' ); ?><br>
39 <?php if ( Conf::val( '_pk' ) ) : ?>
40 <?php esc_html_e( 'Your root public key is:', 'dologin' ); ?>
41 <code><?php echo esc_html( Conf::val( '_pk' ) ); ?></code>
42 <?php endif; ?>
43 </div>
44 </td>
45 </tr>
46 </tbody>
47 </table>
48 <script>
49 document.getElementById('token_textarea').addEventListener('keydown', function(event) {
50 if (event.key === 'Enter' && !event.shiftKey) { // Submit on Enter, allow Shift+Enter for new line
51 event.preventDefault(); // Prevent new line in textarea
52 document.getElementById('token_form').submit(); // Submit the form
53 }
54 });
55 </script>
56 </form>
57
58 <div class="dologin-relative">
59 <h3 class="dologin-title-short">
60 <?php esc_html_e( 'Site Connections', 'dologin' ); ?>
61 </h3>
62
63 <div class="dologin-float-submit">
64 <a href="users.php" class="button button-primary "><?php esc_html_e( 'Generate Child Site Token from Users List', 'dologin' ); ?></a>
65 </div>
66 </div>
67
68 <table class="wp-list-table widefat striped">
69 <thead>
70 <tr>
71 <th>#</th>
72 <th><?php esc_html_e( 'Action', 'dologin' ); ?></th>
73 <th><?php esc_html_e( 'Site Title', 'dologin' ); ?></th>
74 <th><?php esc_html_e( 'Site URL', 'dologin' ); ?></th>
75 <th><?php esc_html_e( 'Site Public Key', 'dologin' ); ?></th>
76 <th><?php esc_html_e( 'Created At', 'dologin' ); ?></th>
77 <th><?php esc_html_e( 'Login As', 'dologin' ); ?></th>
78 <th><?php esc_html_e( 'Last Used', 'dologin' ); ?></th>
79 <th><?php esc_html_e( 'Status', 'dologin' ); ?></th>
80 </tr>
81 </thead>
82 <tbody>
83 <?php $dologin_site_list = (array) $this->sites(); ?>
84 <?php if ( ! $dologin_site_list ) : ?>
85 <tr class="no-items">
86 <td colspan="9"><?php esc_html_e( 'No list yet.', 'dologin' ); ?></td>
87 </tr>
88 <?php endif; ?>
89 <?php foreach ( $dologin_site_list as $dologin_v ) : ?>
90 <tr>
91 <td><?php echo (int) $dologin_v->id; ?></td>
92 <?php if ( $dologin_v->url && $dologin_v->pk ) : ?>
93 <td>
94 <?php if ( $dologin_v->easy_login ) : ?>
95 <a href="<?php echo esc_url( $dologin_v->easy_login ); ?>" target="_blank" class="button dologin-btn-tiny dologin-btn-success" rel="noopener"><?php esc_html_e( 'Easy Login', 'dologin' ); ?></a>
96 <?php else : ?>
97 <?php esc_html_e( 'Root Site', 'dologin' ); ?>
98 <?php endif; ?>
99 </td>
100 <td><?php echo esc_html( $dologin_v->title ); ?></td>
101 <td><?php echo esc_url( $dologin_v->url ); ?></td>
102 <td><code><?php echo esc_html( $dologin_v->pk ); ?></code></td>
103 <?php elseif ( $dologin_v->_valid ) : ?>
104 <td colspan="4">
105 <div class="dologin-warn"><?php esc_html_e( 'The secret token was shown only when created and is not stored. Generate a new token if it was not copied.', 'dologin' ); ?></div>
106 </td>
107 <?php else : ?>
108 <td colspan="4" class="dologin-danger">
109 <?php esc_html_e( 'Token expired', 'dologin' ); ?>
110 </td>
111 <?php endif; ?>
112 <td><?php echo esc_html( Util::readable_time( $dologin_v->dateline ) ); ?></td>
113 <td>
114 <div class="dologin-warn"><?php echo esc_html( strtoupper( implode( ', ', $dologin_v->roles ) ) ); ?></div>
115 <div><?php echo esc_html( $dologin_v->username ); ?></div>
116 </td>
117 <td><?php echo $dologin_v->last_used_at ? esc_html( Util::readable_time( $dologin_v->last_used_at ) ) : '-'; ?></td>
118 <td>
119 <a href="<?php echo esc_url( $dologin_v->_lock_link ); ?>"><?php echo $dologin_v->active ? '<span class="dashicons dashicons-unlock"></span>' : '<span class="dashicons dashicons-lock"></span>'; ?></a>
120 <?php
121 if ( 1 === (int) $dologin_v->active ) :
122 echo '<span style="color:green;">' . esc_html__( 'Active', 'dologin' ) . '</span>';
123 else :
124 echo '<span style="color:red;">' . esc_html__( 'Disabled', 'dologin' ) . '</span>';
125 endif;
126 ?>
127 <a href="<?php echo esc_url( $dologin_v->_del_link ); ?>" class="dologin-right"><span class="dashicons dashicons-dismiss"></span></a>
128 </td>
129 </tr>
130 <?php endforeach; ?>
131 </tbody>
132 </table>
133
134
135 <p class="description">
136 <?php esc_html_e( 'Here you can connect child sites to allow login from a root site.', 'dologin' ); ?><br>
137 <?php esc_html_e( 'This is used to easy login if you have multiple WordPress sites to manage.', 'dologin' ); ?>
138 </p>
139