pre work for login and register