refactor User::register() a bit