Completing the login through database