Improved and uses sqlalchemy now

remade the login function with the use of sqlalchemy