\chapter{User management system}
The system is made for human, and human means a lot of people. So the system should have a mechanism to manage a lot of users.

Let's assume you got a server, it acts like an authority who can create a user, authorize a user.

How do you know a connection was coming from a user that you created than someone else? 

The simplest way for doing that is to ask that user to give you a password, if the password matches the password stored in your dataset, then it is the user that you created before.

\section{The basic idea of user management}
\begin{enumerate}
    \item sign up
    \item log in
    \item log out
    \item account deletion
\end{enumerate}

\section{Implementation}
\lstinputlisting[language=Python]{data/codes/7/user_management.py}

\section{sign up}
When we get a 'user-management' request, we first check if that request is made for 'signup'. If it is, we check if that request contains a username and a password. If it is, we check our database to see if we haven't that user in our database. If it is, we create a new account.

\section{log in}
When we get a 'user-management' request, we first check if that request is made for 'login'. If it is, we check if that request contains a username and a password. If it is, we check our database to see if we have that user in our database. If it is, we can say it is our user.

\section{log out}
Not so important for our application. So I won't implement it.

\section{account deletion}
When we get a 'user-management' request, we first check if that request is made for 'deletion'. If it is, we check if that request contains a username and a password. If it is, we check our database to see if we have that user in our database. If it is, we delete that user record from our database.
