{"action":"created","issue":{"url":"https://api.github.com/repos/Weasyl/weasyl/issues/328","repository_url":"https://api.github.com/repos/Weasyl/weasyl","labels_url":"https://api.github.com/repos/Weasyl/weasyl/issues/328/labels{/name}","comments_url":"https://api.github.com/repos/Weasyl/weasyl/issues/328/comments","events_url":"https://api.github.com/repos/Weasyl/weasyl/issues/328/events","html_url":"https://github.com/Weasyl/weasyl/pull/328","id":305368667,"number":328,"title":"Track IP/UA for sessions. Track IP for user creation.","user":{"login":"kfkitsune","id":19718911,"avatar_url":"https://avatars3.githubusercontent.com/u/19718911?v=4","gravatar_id":"","url":"https://api.github.com/users/kfkitsune","html_url":"https://github.com/kfkitsune","followers_url":"https://api.github.com/users/kfkitsune/followers","following_url":"https://api.github.com/users/kfkitsune/following{/other_user}","gists_url":"https://api.github.com/users/kfkitsune/gists{/gist_id}","starred_url":"https://api.github.com/users/kfkitsune/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kfkitsune/subscriptions","organizations_url":"https://api.github.com/users/kfkitsune/orgs","repos_url":"https://api.github.com/users/kfkitsune/repos","events_url":"https://api.github.com/users/kfkitsune/events{/privacy}","received_events_url":"https://api.github.com/users/kfkitsune/received_events","type":"User","site_admin":false},"labels":[{"id":372292702,"url":"https://api.github.com/repos/Weasyl/weasyl/labels/enhancement","name":"enhancement","color":"84b6eb","default":true},{"id":422913505,"url":"https://api.github.com/repos/Weasyl/weasyl/labels/moderation","name":"moderation","color":"c5def5","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-03-14T23:51:19Z","updated_at":"2018-03-24T23:52:39Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/Weasyl/weasyl/pulls/328","html_url":"https://github.com/Weasyl/weasyl/pull/328","diff_url":"https://github.com/Weasyl/weasyl/pull/328.diff","patch_url":"https://github.com/Weasyl/weasyl/pull/328.patch"},"body":"For #128 / #129 (assuming a user doesn't log out of a session; full tracking can be added later, if still desired (likely as ``login.last_ip_addr``, or some other field)).\r\n\r\nAdds IP information to the ``login`` record for newly created users.\r\n\r\nAdds IP and user agent information to the ``sessions`` record. User agent information is stored in a separate table to avoid unnecessary waste of storage duplicating user agent strings."},"comment":{"url":"https://api.github.com/repos/Weasyl/weasyl/issues/comments/375933572","html_url":"https://github.com/Weasyl/weasyl/pull/328#issuecomment-375933572","issue_url":"https://api.github.com/repos/Weasyl/weasyl/issues/328","id":375933572,"user":{"login":"kfkitsune","id":19718911,"avatar_url":"https://avatars3.githubusercontent.com/u/19718911?v=4","gravatar_id":"","url":"https://api.github.com/users/kfkitsune","html_url":"https://github.com/kfkitsune","followers_url":"https://api.github.com/users/kfkitsune/followers","following_url":"https://api.github.com/users/kfkitsune/following{/other_user}","gists_url":"https://api.github.com/users/kfkitsune/gists{/gist_id}","starred_url":"https://api.github.com/users/kfkitsune/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kfkitsune/subscriptions","organizations_url":"https://api.github.com/users/kfkitsune/orgs","repos_url":"https://api.github.com/users/kfkitsune/repos","events_url":"https://api.github.com/users/kfkitsune/events{/privacy}","received_events_url":"https://api.github.com/users/kfkitsune/received_events","type":"User","site_admin":false},"created_at":"2018-03-24T23:52:39Z","updated_at":"2018-03-24T23:52:39Z","author_association":"MEMBER","body":"> Is it practical to treat the registration IP as the first \"session\" in the table, rather than storing it separately?\r\n\r\nThere's only one instance where this results in an IP not being recorded for a user: the period immediately after verifying the account creation via the verify link. If you're fine with this, I can pull the logic/column for recording the signup IP address out. Though, I wouldn't be surprised if most services track this. The one case I can think of immediately where this might be useful is if a person creates multiple sleeper accounts all at once.\r\n\r\n> A link to /admincontrol/manageuser\r\n\r\nEasy, and done. I'm swapping the current link to the profile (i.e., ``/~user``) to the admincontrol/manageuser page, as there is a button to get to the profile from that page.\r\n\r\n> searching by IP returns all accounts with IPs containing the search terms\r\n\r\nThat was from copying the logic from earlier. It used a string format ``%%%s%%`` as part of the substitution. Searching for leading patterns is easy, and was as simple as making the pattern ``%s%%``.\r\n\r\n> The session times appear to be UTC-7 for some reason.\r\n\r\nThe column is stored as ``timestamp without time zone`` (``ArrowColumn()`` in the ORM model, which is something that is defined in ``libweasyl``, and not in SQLAlchemy as DateTime is). I'm not entirely sure how to convert this to ``timestamp with time zone``/``DateTime(timezone=True)`` without losing data, here. I do agree that it _should_ be UTC, though. This was a pre-existing time, so a change would be needed for #145 even in the absence of this merge request.\r\n\r\n> Use 1 second precision for session times\r\n\r\nFixed (by passing the existing timestamp through ``arrow.get``, and formatting as ``YYYY-MM-DD HH:mm:ss``)\r\n\r\n> The \"Last Login\" and most recent session times aren't matching for some reason\r\n\r\nTimes are set in two different places in the code, and are not stored in the same format. ``login.last_login`` is stored as a PSQL ``integer``, while ``sessions.created_at`` is stored as PSQL ``timestamp without time zone``. That said, sure, I remvoed the ``last_login`` data from the page."}}
{"actor":{"display_login":"kfkitsune"}}