summaryrefslogtreecommitdiffstats
path: root/aurweb/scripts/usermaint.py
blob: 1621d41069e9f4f1d152bf213a9085dca5655d75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env python3

import time

import aurweb.db


def main():
    conn = aurweb.db.Connection()

    limit_to = int(time.time()) - 86400 * 7
    conn.execute("UPDATE Users SET LastLoginIPAddress = NULL " +
                 "WHERE LastLogin < ?", [limit_to])
    conn.execute("UPDATE Users SET LastSSHLoginIPAddress = NULL " +
                 "WHERE LastSSHLogin < ?", [limit_to])

    conn.commit()
    conn.close()


if __name__ == '__main__':
    main()