auto_provision || $identity->email === null) { return null; } // A deleted account still holds its address, and the insert below // would hit the unique index — a 500 in the middle of a sign-in. // Refusing here gives the caller the same "there is no account here // for that address" it gives every other unprovisionable identity, // which is also all a stranger should learn: whether an address was // once an account here is not the provider's to publish. if (! $this->clients->addressIsFree($identity->email)) { Log::warning('A provider identity was not provisioned: the address belongs to a deleted account.', [ 'provider' => $settings->provider->value, 'email' => $identity->email, ]); return null; } return $this->clients->provision( name: $identity->name ?? $identity->email, email: $identity->email, // A password they will never use and never learn: this account // signs in through the provider. Generated rather than left // null so nothing downstream has to special-case an empty // hash, and it is why promoting one to staff requires setting // a real password — see AccountConversion::requiresNewPassword(). password: Str::password(64), action: Action::SocialClientProvisioned, source: AuthSource::Social, autoApprove: $autoApprove, context: ['provider' => $settings->provider->label()], ); } }