finish login and register backend code