File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4040- [-] Auto-create-storage
4141- [v] jtiStore
4242
43- - [ ] Cleanup for expired verify tokens, password, deletion
44- - [ ] Password requirements
43+ - [v ] Cleanup for expired verify tokens, password, deletion
44+ - [v ] Password requirements
4545
4646----------------------
4747
Original file line number Diff line number Diff line change 55 const KEYDIR = __DIR__ . "/keys/";
66 const FRONTENDDIR = __DIR__ . "/frontend/";
77 const DBPATH = __DIR__ . "/db/solid.db";
8+ const CLEANUP_FILE = __DIR__ . "/db/lastcleanup";
89
910 const MAILER = [
1011 "host" => "mailpit",
Original file line number Diff line number Diff line change @@ -334,5 +334,17 @@ public static function deleteAccount($email) {
334334 // FIXME: Delete storage;
335335 self ::deleteAllowedClients ($ email );
336336 self ::deleteUser ($ email );
337- }
337+ }
338+
339+ public static function cleanupTokens () {
340+ self ::connect ();
341+
342+ $ now = new \DateTime ();
343+ $ query = self ::$ pdo ->prepare (
344+ 'DELETE FROM verify WHERE expires < :now '
345+ );
346+ $ query ->execute ([
347+ ':now ' => $ now ->getTimestamp ()
348+ ]);
349+ }
338350 }
Original file line number Diff line number Diff line change 379379 header ($ _SERVER ['SERVER_PROTOCOL ' ] . " 404 Not found " );
380380 break ;
381381 }
382+ if (!file_exists (CLEANUP_FILE ) || (filemtime (CLEANUP_FILE ) < time ())) {
383+ touch (CLEANUP_FILE , time () + 3600 );
384+ User::cleanupTokens ();
385+ }
382386 break ;
383387 case "OPTIONS " :
384388 break ;
You can’t perform that action at this time.
0 commit comments