updated register function for generating confirm token, along with the tests