refactoring UI login and register