Implemented the register and login functionality