implemented back-end of login