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');
|
||||
});
|
||||
|
||||
// Comfirmation box before auto-update
|
||||
// Confirmation box before auto-update
|
||||
Router\get_action('confirm-auto-update', function() {
|
||||
|
||||
Response\html(Template\layout('confirm_auto_update', array(
|
||||
|
@ -244,4 +244,5 @@ return array(
|
||||
// 'view' => '',
|
||||
// 'Item title links to' => '',
|
||||
// 'Original' => '',
|
||||
// 'Last login:' => '',
|
||||
);
|
||||
|
@ -244,4 +244,5 @@ return array(
|
||||
'view' => 'zobrazit',
|
||||
'Item title links to' => 'Titulek článku odkazuje na',
|
||||
'Original' => 'Originál',
|
||||
// 'Last login:' => '',
|
||||
);
|
||||
|
@ -244,4 +244,5 @@ return array(
|
||||
// 'view' => '',
|
||||
// 'Item title links to' => '',
|
||||
// 'Original' => '',
|
||||
// 'Last login:' => '',
|
||||
);
|
||||
|
@ -244,4 +244,5 @@ return array(
|
||||
// 'view' => '',
|
||||
// 'Item title links to' => '',
|
||||
// 'Original' => '',
|
||||
// 'Last login:' => '',
|
||||
);
|
||||
|
@ -243,5 +243,6 @@ return array(
|
||||
'Back to the group' => 'Revenir sur le groupe',
|
||||
'view' => 'voir',
|
||||
'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' => '',
|
||||
// 'Item title links to' => '',
|
||||
// 'Original' => '',
|
||||
// 'Last login:' => '',
|
||||
);
|
||||
|
@ -245,5 +245,6 @@ return array(
|
||||
'Back to the group' => 'グループへ戻る',
|
||||
'view' => '表示',
|
||||
'Item title links to' => 'アイテムのタイトルのリンク先',
|
||||
'Original' => '元のページ'
|
||||
'Original' => '元のページ',
|
||||
// 'Last login:' => '',
|
||||
);
|
||||
|
@ -244,4 +244,5 @@ return array(
|
||||
// 'view' => '',
|
||||
// 'Item title links to' => '',
|
||||
// 'Original' => '',
|
||||
// 'Last login:' => '',
|
||||
);
|
||||
|
@ -243,5 +243,6 @@ return array(
|
||||
'Back to the group' => 'Назад в группу',
|
||||
'view' => 'смотреть',
|
||||
'Item title links to' => 'Заголовок статьи ведет на',
|
||||
'Original' => 'Оригинал'
|
||||
'Original' => 'Оригинал',
|
||||
// 'Last login:' => '',
|
||||
);
|
||||
|
@ -244,4 +244,5 @@ return array(
|
||||
// 'view' => '',
|
||||
// 'Item title links to' => '',
|
||||
// 'Original' => '',
|
||||
// 'Last login:' => '',
|
||||
);
|
||||
|
@ -244,4 +244,5 @@ return array(
|
||||
// 'view' => '',
|
||||
// 'Item title links to' => '',
|
||||
// 'Original' => '',
|
||||
// 'Last login:' => '',
|
||||
);
|
||||
|
@ -244,4 +244,5 @@ return array(
|
||||
'view' => 'görüntüle',
|
||||
// 'Item title links to' => '',
|
||||
// 'Original' => '',
|
||||
// 'Last login:' => '',
|
||||
);
|
||||
|
@ -244,4 +244,5 @@ return array(
|
||||
'view' => '查看',
|
||||
// 'Item title links to' => '',
|
||||
// 'Original' => '',
|
||||
// 'Last login:' => '',
|
||||
);
|
||||
|
@ -24,13 +24,21 @@ function logout()
|
||||
}
|
||||
|
||||
// Get the credentials from the current selected database
|
||||
function getCredentials()
|
||||
function get_credentials()
|
||||
{
|
||||
return Database::getInstance('db')
|
||||
->hashtable('settings')
|
||||
->get('username', 'password');
|
||||
}
|
||||
|
||||
// Set last login date
|
||||
function set_last_login()
|
||||
{
|
||||
return Database::getInstance('db')
|
||||
->hashtable('settings')
|
||||
->put(array('last_login' => time()));
|
||||
}
|
||||
|
||||
// Validate authentication
|
||||
function validate_login(array $values)
|
||||
{
|
||||
@ -45,10 +53,10 @@ function validate_login(array $values)
|
||||
|
||||
if ($result) {
|
||||
|
||||
$credentials = getCredentials();
|
||||
$credentials = get_credentials();
|
||||
|
||||
if ($credentials && $credentials['username'] === $values['username'] && password_verify($values['password'], $credentials['password'])) {
|
||||
|
||||
set_last_login();
|
||||
$_SESSION['loggedin'] = true;
|
||||
$_SESSION['config'] = Config\get_all();
|
||||
|
||||
|
@ -28,6 +28,9 @@
|
||||
<div class="panel panel-default">
|
||||
<h3><?= t('About') ?></h3>
|
||||
<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('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>
|
||||
|
Loading…
Reference in New Issue
Block a user