Repeat email v1

Also adds some badly needed testing infrastructure.
@Chetco Yeah, remove the email uniqueness check from #78 then.