Fossil SCM

Add a button to delete failed login attempts from the access log history.

drh 2011-03-07 03:00 trunk
Commit ba0852c9df6b3f88f3a06d9a1aaedac7a51e3f9b
1 file changed +10
+10
--- src/user.c
+++ src/user.c
@@ -414,10 +414,15 @@
414414
}
415415
if( P("delanon") && P("delanonbtn") ){
416416
db_multi_exec("DELETE FROM accesslog WHERE uname='anonymous'");
417417
cgi_redirectf("%s/access_log?y=%d&n=%d&o=%o", g.zTop, y, n, skip);
418418
return;
419
+ }
420
+ if( P("delfail") && P("delfailbtn") ){
421
+ db_multi_exec("DELETE FROM accesslog WHERE NOT success");
422
+ cgi_redirectf("%s/access_log?y=%d&n=%d&o=%o", g.zTop, y, n, skip);
423
+ return;
419424
}
420425
if( P("delold") && P("deloldbtn") ){
421426
db_multi_exec("DELETE FROM accesslog WHERE rowid in"
422427
"(SELECT rowid FROM accesslog ORDER BY rowid DESC"
423428
" LIMIT -1 OFFSET 200)");
@@ -478,12 +483,17 @@
478483
@ <form method="post" action="%s(g.zTop)/access_log">
479484
@ <input type="checkbox" name="delanon">
480485
@ Delete all entries for user "anonymous"</input>
481486
@ <input type="submit" name="delanonbtn" value="Delete"></input>
482487
@ </form>
488
+ @ <form method="post" action="%s(g.zTop)/access_log">
489
+ @ <input type="checkbox" name="delfail">
490
+ @ Delete all failed login attempts</input>
491
+ @ <input type="submit" name="delfailbtn" value="Delete"></input>
492
+ @ </form>
483493
@ <form method="post" action="%s(g.zTop)/access_log">
484494
@ <input type="checkbox" name="delall">
485495
@ Delete all entries</input>
486496
@ <input type="submit" name="delallbtn" value="Delete"></input>
487497
@ </form>
488498
style_footer();
489499
}
490500
--- src/user.c
+++ src/user.c
@@ -414,10 +414,15 @@
414 }
415 if( P("delanon") && P("delanonbtn") ){
416 db_multi_exec("DELETE FROM accesslog WHERE uname='anonymous'");
417 cgi_redirectf("%s/access_log?y=%d&n=%d&o=%o", g.zTop, y, n, skip);
418 return;
 
 
 
 
 
419 }
420 if( P("delold") && P("deloldbtn") ){
421 db_multi_exec("DELETE FROM accesslog WHERE rowid in"
422 "(SELECT rowid FROM accesslog ORDER BY rowid DESC"
423 " LIMIT -1 OFFSET 200)");
@@ -478,12 +483,17 @@
478 @ <form method="post" action="%s(g.zTop)/access_log">
479 @ <input type="checkbox" name="delanon">
480 @ Delete all entries for user "anonymous"</input>
481 @ <input type="submit" name="delanonbtn" value="Delete"></input>
482 @ </form>
 
 
 
 
 
483 @ <form method="post" action="%s(g.zTop)/access_log">
484 @ <input type="checkbox" name="delall">
485 @ Delete all entries</input>
486 @ <input type="submit" name="delallbtn" value="Delete"></input>
487 @ </form>
488 style_footer();
489 }
490
--- src/user.c
+++ src/user.c
@@ -414,10 +414,15 @@
414 }
415 if( P("delanon") && P("delanonbtn") ){
416 db_multi_exec("DELETE FROM accesslog WHERE uname='anonymous'");
417 cgi_redirectf("%s/access_log?y=%d&n=%d&o=%o", g.zTop, y, n, skip);
418 return;
419 }
420 if( P("delfail") && P("delfailbtn") ){
421 db_multi_exec("DELETE FROM accesslog WHERE NOT success");
422 cgi_redirectf("%s/access_log?y=%d&n=%d&o=%o", g.zTop, y, n, skip);
423 return;
424 }
425 if( P("delold") && P("deloldbtn") ){
426 db_multi_exec("DELETE FROM accesslog WHERE rowid in"
427 "(SELECT rowid FROM accesslog ORDER BY rowid DESC"
428 " LIMIT -1 OFFSET 200)");
@@ -478,12 +483,17 @@
483 @ <form method="post" action="%s(g.zTop)/access_log">
484 @ <input type="checkbox" name="delanon">
485 @ Delete all entries for user "anonymous"</input>
486 @ <input type="submit" name="delanonbtn" value="Delete"></input>
487 @ </form>
488 @ <form method="post" action="%s(g.zTop)/access_log">
489 @ <input type="checkbox" name="delfail">
490 @ Delete all failed login attempts</input>
491 @ <input type="submit" name="delfailbtn" value="Delete"></input>
492 @ </form>
493 @ <form method="post" action="%s(g.zTop)/access_log">
494 @ <input type="checkbox" name="delall">
495 @ Delete all entries</input>
496 @ <input type="submit" name="delallbtn" value="Delete"></input>
497 @ </form>
498 style_footer();
499 }
500

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button