invalidate sessions after 4 hours

master
Benjamin 'blindCoder' Schieder 2017-04-26 09:51:03 +02:00
parent 3cfcef2ee6
commit d1a8ee0ffc
2 changed files with 5 additions and 0 deletions

View File

@ -8,6 +8,7 @@ use RSSTootalizer::Feed;
use RSSTootalizer::Filter;
use RSSTootalizer::User;
use RSSTootalizer::Entry;
use RSSTootalizer::DB;
our $config = "";
open CONFIG, "rsstootalizer.conf.json" or die "Cannot open rsstootalizer.conf.json";
@ -92,3 +93,5 @@ FEED: foreach my $feed (@feeds){
RSSTootalizer::Entry->create(%ne);
}
}
RSSTootalizer::DB->doUPDATE("UPDATE `users` SET session_id = 'invalid' WHERE TIME_TO_SEC(NOW()) - TIME_TO_SEC(`valid_from`) > 60*60*4;"); # invalidate old sessions

View File

@ -0,0 +1,2 @@
ALTER TABLE `users` ADD `valid_from` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `session_id`;
UPDATE `users` SET `valid_from` = NOW();