feat(engine): last logged in ip address & number of days #1040
+98
−27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Current State
The welcome screen interface displays some details about your account when you login. Currently, this always shows that you "last logged in today" and your "current" ip address that is connected through the client. It never actually counts the number of days you actually last logged in. As well as never showing the actual last ip address that was used.
The problem
Adding this feature technically requires 2004scape to collect ip addresses of players and save them into their saves. The reason they have to be saved is because 2004scape would have to provide to the player what the last ip address was, which means saving that state for a future purpose. I personally don't care, but it is PII and I'm sure others would care.
This solution
The best solution I could think of was to use the players own password as the key for encrypting and decrypting their own ip address. The only drawback is storing the password in memory for it to be used by the ciphering functions. So the password exists in memory of the server until the player is no longer online in the world.
If a players password was changed, it would fail the decryption one time for the next login only, resulting in the welcome screen not showing for that login. This is actually because it gets defaulted to
0
when sent to the client, and the client checks if it's not0
to open the interface.Examples