Sign in to follow this  

Question about logging people in

Recommended Posts

Is it a server? Does it have uptime requirements? How do you handle new users?

At the very least, if the program ever writes to the file it should do this in a robust manner to minimise the chances of the file becoming corrupted. For example, you could write to a temporary file, then use an atomic rename operation to replace the original file.

Another important aspect is security. Avoid keeping plaintext user passwords. Instead, store a hash of the user password, preferably using a "salt".

If the program is "serious", then the obvious way to go would be to move the user information into a database. A proper database will ensure there is no corruption of the data, and can be configured to handle high loads (e.g. multiple users creating accounts at the same time, while allowing others to log in). This also means that you can develop a separate user admin application quite easily, for example in a game you might want to handle ban requests.

At the end of the day though, the effort should be proportional to the size and scope of the project. If you have something working, you might find your time better spent making the rest of the program awesome, which may eventually drive in enough users to justify a more complex approach.

Share this post

Link to post
Share on other sites
Thanks for your reply.
It is a server. No uptime requirements. And currently new users are added in a very simple manner...packet uses a 'registering user' ID along with a name and pass and then checks this name against the current cache, and if it doesn't exist add it and write to text file.

I'll likely revisit this idea in the future when I have time to improve my login code.

Your input has been valuable.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this