Record last login timestamp in the database
This commit is contained in:
parent
7e5d69302b
commit
250d5c21e0
@ -54,7 +54,7 @@ Router\post_action('new-db', function() {
|
|||||||
Response\redirect('?action=database');
|
Response\redirect('?action=database');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Comfirmation box before auto-update
|
// Confirmation box before auto-update
|
||||||
Router\get_action('confirm-auto-update', function() {
|
Router\get_action('confirm-auto-update', function() {
|
||||||
|
|
||||||
Response\html(Template\layout('confirm_auto_update', array(
|
Response\html(Template\layout('confirm_auto_update', array(
|
||||||
|
@ -244,4 +244,5 @@ return array(
|
|||||||
// 'view' => '',
|
// 'view' => '',
|
||||||
// 'Item title links to' => '',
|
// 'Item title links to' => '',
|
||||||
// 'Original' => '',
|
// 'Original' => '',
|
||||||
|
// 'Last login:' => '',
|
||||||
);
|
);
|
||||||
|
@ -244,4 +244,5 @@ return array(
|
|||||||
'view' => 'zobrazit',
|
'view' => 'zobrazit',
|
||||||
'Item title links to' => 'Titulek článku odkazuje na',
|
'Item title links to' => 'Titulek článku odkazuje na',
|
||||||
'Original' => 'Originál',
|
'Original' => 'Originál',
|
||||||
|
// 'Last login:' => '',
|
||||||
);
|
);
|
||||||
|
@ -244,4 +244,5 @@ return array(
|
|||||||
// 'view' => '',
|
// 'view' => '',
|
||||||
// 'Item title links to' => '',
|
// 'Item title links to' => '',
|
||||||
// 'Original' => '',
|
// 'Original' => '',
|
||||||
|
// 'Last login:' => '',
|
||||||
);
|
);
|
||||||
|
@ -244,4 +244,5 @@ return array(
|
|||||||
// 'view' => '',
|
// 'view' => '',
|
||||||
// 'Item title links to' => '',
|
// 'Item title links to' => '',
|
||||||
// 'Original' => '',
|
// 'Original' => '',
|
||||||
|
// 'Last login:' => '',
|
||||||
);
|
);
|
||||||
|
@ -243,5 +243,6 @@ return array(
|
|||||||
'Back to the group' => 'Revenir sur le groupe',
|
'Back to the group' => 'Revenir sur le groupe',
|
||||||
'view' => 'voir',
|
'view' => 'voir',
|
||||||
'Item title links to' => 'Le titre des articles redirige vers',
|
'Item title links to' => 'Le titre des articles redirige vers',
|
||||||
'Original' => 'Original'
|
'Original' => 'Original',
|
||||||
|
'Last login:' => 'Dernière connexion :',
|
||||||
);
|
);
|
||||||
|
@ -244,4 +244,5 @@ return array(
|
|||||||
// 'view' => '',
|
// 'view' => '',
|
||||||
// 'Item title links to' => '',
|
// 'Item title links to' => '',
|
||||||
// 'Original' => '',
|
// 'Original' => '',
|
||||||
|
// 'Last login:' => '',
|
||||||
);
|
);
|
||||||
|
@ -245,5 +245,6 @@ return array(
|
|||||||
'Back to the group' => 'グループへ戻る',
|
'Back to the group' => 'グループへ戻る',
|
||||||
'view' => '表示',
|
'view' => '表示',
|
||||||
'Item title links to' => 'アイテムのタイトルのリンク先',
|
'Item title links to' => 'アイテムのタイトルのリンク先',
|
||||||
'Original' => '元のページ'
|
'Original' => '元のページ',
|
||||||
|
// 'Last login:' => '',
|
||||||
);
|
);
|
||||||
|
@ -244,4 +244,5 @@ return array(
|
|||||||
// 'view' => '',
|
// 'view' => '',
|
||||||
// 'Item title links to' => '',
|
// 'Item title links to' => '',
|
||||||
// 'Original' => '',
|
// 'Original' => '',
|
||||||
|
// 'Last login:' => '',
|
||||||
);
|
);
|
||||||
|
@ -243,5 +243,6 @@ return array(
|
|||||||
'Back to the group' => 'Назад в группу',
|
'Back to the group' => 'Назад в группу',
|
||||||
'view' => 'смотреть',
|
'view' => 'смотреть',
|
||||||
'Item title links to' => 'Заголовок статьи ведет на',
|
'Item title links to' => 'Заголовок статьи ведет на',
|
||||||
'Original' => 'Оригинал'
|
'Original' => 'Оригинал',
|
||||||
|
// 'Last login:' => '',
|
||||||
);
|
);
|
||||||
|
@ -244,4 +244,5 @@ return array(
|
|||||||
// 'view' => '',
|
// 'view' => '',
|
||||||
// 'Item title links to' => '',
|
// 'Item title links to' => '',
|
||||||
// 'Original' => '',
|
// 'Original' => '',
|
||||||
|
// 'Last login:' => '',
|
||||||
);
|
);
|
||||||
|
@ -244,4 +244,5 @@ return array(
|
|||||||
// 'view' => '',
|
// 'view' => '',
|
||||||
// 'Item title links to' => '',
|
// 'Item title links to' => '',
|
||||||
// 'Original' => '',
|
// 'Original' => '',
|
||||||
|
// 'Last login:' => '',
|
||||||
);
|
);
|
||||||
|
@ -244,4 +244,5 @@ return array(
|
|||||||
'view' => 'görüntüle',
|
'view' => 'görüntüle',
|
||||||
// 'Item title links to' => '',
|
// 'Item title links to' => '',
|
||||||
// 'Original' => '',
|
// 'Original' => '',
|
||||||
|
// 'Last login:' => '',
|
||||||
);
|
);
|
||||||
|
@ -244,4 +244,5 @@ return array(
|
|||||||
'view' => '查看',
|
'view' => '查看',
|
||||||
// 'Item title links to' => '',
|
// 'Item title links to' => '',
|
||||||
// 'Original' => '',
|
// 'Original' => '',
|
||||||
|
// 'Last login:' => '',
|
||||||
);
|
);
|
||||||
|
@ -24,13 +24,21 @@ function logout()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the credentials from the current selected database
|
// Get the credentials from the current selected database
|
||||||
function getCredentials()
|
function get_credentials()
|
||||||
{
|
{
|
||||||
return Database::getInstance('db')
|
return Database::getInstance('db')
|
||||||
->hashtable('settings')
|
->hashtable('settings')
|
||||||
->get('username', 'password');
|
->get('username', 'password');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set last login date
|
||||||
|
function set_last_login()
|
||||||
|
{
|
||||||
|
return Database::getInstance('db')
|
||||||
|
->hashtable('settings')
|
||||||
|
->put(array('last_login' => time()));
|
||||||
|
}
|
||||||
|
|
||||||
// Validate authentication
|
// Validate authentication
|
||||||
function validate_login(array $values)
|
function validate_login(array $values)
|
||||||
{
|
{
|
||||||
@ -45,10 +53,10 @@ function validate_login(array $values)
|
|||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
|
|
||||||
$credentials = getCredentials();
|
$credentials = get_credentials();
|
||||||
|
|
||||||
if ($credentials && $credentials['username'] === $values['username'] && password_verify($values['password'], $credentials['password'])) {
|
if ($credentials && $credentials['username'] === $values['username'] && password_verify($values['password'], $credentials['password'])) {
|
||||||
|
set_last_login();
|
||||||
$_SESSION['loggedin'] = true;
|
$_SESSION['loggedin'] = true;
|
||||||
$_SESSION['config'] = Config\get_all();
|
$_SESSION['config'] = Config\get_all();
|
||||||
|
|
||||||
|
@ -28,6 +28,9 @@
|
|||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<h3><?= t('About') ?></h3>
|
<h3><?= t('About') ?></h3>
|
||||||
<ul>
|
<ul>
|
||||||
|
<?php if (! empty($config['last_login'])): ?>
|
||||||
|
<li><?= t('Last login:') ?> <strong><?= date('Y-m-d H:i', $config['last_login']) ?></strong></li>
|
||||||
|
<?php endif ?>
|
||||||
<li><?= t('Miniflux version:') ?> <strong><?= APP_VERSION ?></strong></li>
|
<li><?= t('Miniflux version:') ?> <strong><?= APP_VERSION ?></strong></li>
|
||||||
<li><?= t('Official website:') ?> <a href="https://miniflux.net" rel="noreferrer" target="_blank">https://miniflux.net</a></li>
|
<li><?= t('Official website:') ?> <a href="https://miniflux.net" rel="noreferrer" target="_blank">https://miniflux.net</a></li>
|
||||||
<li><a href="?action=console"><?= t('Console') ?></a></li>
|
<li><a href="?action=console"><?= t('Console') ?></a></li>
|
||||||
|
Loading…
Reference in New Issue
Block a user