Creating a login from scratch to understand how it works