Fix 500 error on reactivation email
Add tests