invitation codes generation and validation working