complete login and register function in db module