Move the auto register processing into class-register and check if is admin before redirecting. #236