add login and register function code