| | @@ -667,10 +667,11 @@ |
| 667 | 667 | fossil_print("[%s]\n", blob_str(&answer)); |
| 668 | 668 | } |
| 669 | 669 | |
| 670 | 670 | /* |
| 671 | 671 | ** WEBPAGE: access_log |
| 672 | +** WEBPAGE: user_log |
| 672 | 673 | ** |
| 673 | 674 | ** Show login attempts, including timestamp and IP address. |
| 674 | 675 | ** Requires Admin privileges. |
| 675 | 676 | ** |
| 676 | 677 | ** Query parameters: |
| | @@ -677,11 +678,11 @@ |
| 677 | 678 | ** |
| 678 | 679 | ** y=N 1: success only. 2: failure only. 3: both (default: 3) |
| 679 | 680 | ** n=N Number of entries to show (default: 200) |
| 680 | 681 | ** o=N Skip this many entries (default: 0) |
| 681 | 682 | */ |
| 682 | | -void access_log_page(void){ |
| 683 | +void user_log_page(void){ |
| 683 | 684 | int y = atoi(PD("y","3")); |
| 684 | 685 | int n = atoi(PD("n","200")); |
| 685 | 686 | int skip = atoi(PD("o","0")); |
| 686 | 687 | const char *zUser = P("u"); |
| 687 | 688 | Blob sql; |
| | @@ -695,34 +696,32 @@ |
| 695 | 696 | create_accesslog_table(); |
| 696 | 697 | |
| 697 | 698 | |
| 698 | 699 | if( P("delall") && P("delallbtn") ){ |
| 699 | 700 | db_multi_exec("DELETE FROM accesslog"); |
| 700 | | - cgi_redirectf("%R/access_log?y=%d&n=%d&o=%o", y, n, skip); |
| 701 | + cgi_redirectf("%R/user_log?y=%d&n=%d&o=%o", y, n, skip); |
| 701 | 702 | return; |
| 702 | 703 | } |
| 703 | 704 | if( P("delanon") && P("delanonbtn") ){ |
| 704 | 705 | db_multi_exec("DELETE FROM accesslog WHERE uname='anonymous'"); |
| 705 | | - cgi_redirectf("%R/access_log?y=%d&n=%d&o=%o", y, n, skip); |
| 706 | + cgi_redirectf("%R/user_log?y=%d&n=%d&o=%o", y, n, skip); |
| 706 | 707 | return; |
| 707 | 708 | } |
| 708 | 709 | if( P("delfail") && P("delfailbtn") ){ |
| 709 | 710 | db_multi_exec("DELETE FROM accesslog WHERE NOT success"); |
| 710 | | - cgi_redirectf("%R/access_log?y=%d&n=%d&o=%o", y, n, skip); |
| 711 | + cgi_redirectf("%R/user_log?y=%d&n=%d&o=%o", y, n, skip); |
| 711 | 712 | return; |
| 712 | 713 | } |
| 713 | 714 | if( P("delold") && P("deloldbtn") ){ |
| 714 | 715 | db_multi_exec("DELETE FROM accesslog WHERE rowid in" |
| 715 | 716 | "(SELECT rowid FROM accesslog ORDER BY rowid DESC" |
| 716 | 717 | " LIMIT -1 OFFSET 200)"); |
| 717 | | - cgi_redirectf("%R/access_log?y=%d&n=%d", y, n); |
| 718 | + cgi_redirectf("%R/user_log?y=%d&n=%d", y, n); |
| 718 | 719 | return; |
| 719 | 720 | } |
| 720 | | - style_header("Access Log"); |
| 721 | | - style_submenu_element("Admin-Log", "admin_log"); |
| 722 | | - style_submenu_element("Artifact-Log", "rcvfromlist"); |
| 723 | | - style_submenu_element("Error-Log", "errorlog"); |
| 721 | + style_header("User Log"); |
| 722 | + style_submenu_element("Log-Menu", "setup-logmenu"); |
| 724 | 723 | |
| 725 | 724 | blob_zero(&sql); |
| 726 | 725 | blob_append_sql(&sql, |
| 727 | 726 | "SELECT uname, ipaddr, datetime(mtime,toLocal()), success" |
| 728 | 727 | " FROM accesslog" |
| | @@ -736,16 +735,16 @@ |
| 736 | 735 | }else if( y==2 ){ |
| 737 | 736 | blob_append(&sql, " WHERE NOT success", -1); |
| 738 | 737 | } |
| 739 | 738 | blob_append_sql(&sql," ORDER BY rowid DESC LIMIT %d OFFSET %d", n+1, skip); |
| 740 | 739 | if( skip ){ |
| 741 | | - style_submenu_element("Newer", "%R/access_log?o=%d&n=%d&y=%d", |
| 740 | + style_submenu_element("Newer", "%R/user_log?o=%d&n=%d&y=%d", |
| 742 | 741 | skip>=n ? skip-n : 0, n, y); |
| 743 | 742 | } |
| 744 | 743 | rc = db_prepare_ignore_error(&q, "%s", blob_sql_text(&sql)); |
| 745 | 744 | fLogEnabled = db_get_boolean("access-log", 0); |
| 746 | | - @ <div align="center">Access logging is %s(fLogEnabled?"on":"off"). |
| 745 | + @ <div align="center">User logging is %s(fLogEnabled?"on":"off"). |
| 747 | 746 | @ (Change this on the <a href="setup_settings">settings</a> page.)</div> |
| 748 | 747 | @ <table border="1" cellpadding="5" class="sortable" align="center" \ |
| 749 | 748 | @ data-column-types='Ttt' data-init-sort='1'> |
| 750 | 749 | @ <thead><tr><th width="33%%">Date</th><th width="34%%">User</th> |
| 751 | 750 | @ <th width="33%%">IP Address</th></tr></thead><tbody> |
| | @@ -754,11 +753,11 @@ |
| 754 | 753 | const char *zIP = db_column_text(&q, 1); |
| 755 | 754 | const char *zDate = db_column_text(&q, 2); |
| 756 | 755 | int bSuccess = db_column_int(&q, 3); |
| 757 | 756 | cnt++; |
| 758 | 757 | if( cnt>n ){ |
| 759 | | - style_submenu_element("Older", "%R/access_log?o=%d&n=%d&y=%d", |
| 758 | + style_submenu_element("Older", "%R/user_log?o=%d&n=%d&y=%d", |
| 760 | 759 | skip+n, n, y); |
| 761 | 760 | break; |
| 762 | 761 | } |
| 763 | 762 | if( bSuccess ){ |
| 764 | 763 | @ <tr> |
| | @@ -766,33 +765,33 @@ |
| 766 | 765 | @ <tr bgcolor="#ffacc0"> |
| 767 | 766 | } |
| 768 | 767 | @ <td>%s(zDate)</td><td>%h(zName)</td><td>%h(zIP)</td></tr> |
| 769 | 768 | } |
| 770 | 769 | if( skip>0 || cnt>n ){ |
| 771 | | - style_submenu_element("All", "%R/access_log?n=10000000"); |
| 770 | + style_submenu_element("All", "%R/user_log?n=10000000"); |
| 772 | 771 | } |
| 773 | 772 | @ </tbody></table> |
| 774 | 773 | db_finalize(&q); |
| 775 | 774 | @ <hr> |
| 776 | | - @ <form method="post" action="%R/access_log"> |
| 775 | + @ <form method="post" action="%R/user_log"> |
| 777 | 776 | @ <label><input type="checkbox" name="delold"> |
| 778 | 777 | @ Delete all but the most recent 200 entries</input></label> |
| 779 | 778 | @ <input type="submit" name="deloldbtn" value="Delete"></input> |
| 780 | 779 | @ </form> |
| 781 | | - @ <form method="post" action="%R/access_log"> |
| 780 | + @ <form method="post" action="%R/user_log"> |
| 782 | 781 | @ <label><input type="checkbox" name="delanon"> |
| 783 | 782 | @ Delete all entries for user "anonymous"</input></label> |
| 784 | 783 | @ <input type="submit" name="delanonbtn" value="Delete"></input> |
| 785 | 784 | @ </form> |
| 786 | | - @ <form method="post" action="%R/access_log"> |
| 785 | + @ <form method="post" action="%R/user_log"> |
| 787 | 786 | @ <label><input type="checkbox" name="delfail"> |
| 788 | 787 | @ Delete all failed login attempts</input></label> |
| 789 | 788 | @ <input type="submit" name="delfailbtn" value="Delete"></input> |
| 790 | 789 | @ </form> |
| 791 | | - @ <form method="post" action="%R/access_log"> |
| 790 | + @ <form method="post" action="%R/user_log"> |
| 792 | 791 | @ <label><input type="checkbox" name="delall"> |
| 793 | 792 | @ Delete all entries</input></label> |
| 794 | 793 | @ <input type="submit" name="delallbtn" value="Delete"></input> |
| 795 | 794 | @ </form> |
| 796 | 795 | style_table_sorter(); |
| 797 | 796 | style_finish_page(); |
| 798 | 797 | } |
| 799 | 798 | |