Allow selecting the last 100 logged in users
This commit is contained in:
parent
d15cca047c
commit
7840ee2cb7
2 changed files with 30 additions and 4 deletions
5
src/assets/js/login-as.js
Normal file
5
src/assets/js/login-as.js
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
$(function() {
|
||||||
|
|
||||||
|
$('.ui.dropdown').dropdown();
|
||||||
|
|
||||||
|
});
|
|
@ -13,8 +13,12 @@ $page = new Page(__FILE__, __('Login as'), 100);
|
||||||
if (isset($_POST['email'])) {
|
if (isset($_POST['email'])) {
|
||||||
$email = $_POST['email'];
|
$email = $_POST['email'];
|
||||||
|
|
||||||
$user = $database->query('SELECT * FROM `users`
|
$user = $database
|
||||||
WHERE `email` = "' . $email . '";')
|
->query(
|
||||||
|
'SELECT *
|
||||||
|
FROM `users`
|
||||||
|
WHERE `email` = "' . $email . '";'
|
||||||
|
)
|
||||||
->fetch();
|
->fetch();
|
||||||
|
|
||||||
$success = false !== $user;
|
$success = false !== $user;
|
||||||
|
@ -27,6 +31,18 @@ if (isset($_POST['email'])) {
|
||||||
$page->header();
|
$page->header();
|
||||||
$page->bodyStart();
|
$page->bodyStart();
|
||||||
$page->navigation();
|
$page->navigation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recent users
|
||||||
|
*/
|
||||||
|
$users = $database
|
||||||
|
->query(
|
||||||
|
' SELECT *
|
||||||
|
FROM `users`
|
||||||
|
ORDER BY `last_login` DESC
|
||||||
|
LIMIT 100;'
|
||||||
|
)
|
||||||
|
->fetchAll();
|
||||||
?>
|
?>
|
||||||
<main>
|
<main>
|
||||||
<div class="ui container">
|
<div class="ui container">
|
||||||
|
@ -46,7 +62,12 @@ $page->navigation();
|
||||||
<form class="ui form" method="POST">
|
<form class="ui form" method="POST">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label><?= __('Email') ?></label>
|
<label><?= __('Email') ?></label>
|
||||||
<input type="email" name="email" placeholder="john.doe@domain.tld" />
|
|
||||||
|
<select class="ui fluid search selection dropdown" name="email">
|
||||||
|
<?php foreach ($users as $user) { ?>
|
||||||
|
<option value="<?= $user['email'] ?>"><?= $user['email'] ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input class="ui primary button"
|
<input class="ui primary button"
|
||||||
|
|
Loading…
Reference in a new issue