Changeset View
Changeset View
Standalone View
Standalone View
src/applications/people/storage/PhabricatorUser.php
Show First 20 Lines • Show All 314 Lines • ▼ Show 20 Lines | final class PhabricatorUser | ||||
private function generateConduitCertificate() { | private function generateConduitCertificate() { | ||||
return Filesystem::readRandomCharacters(255); | return Filesystem::readRandomCharacters(255); | ||||
} | } | ||||
const EMAIL_CYCLE_FREQUENCY = 86400; | const EMAIL_CYCLE_FREQUENCY = 86400; | ||||
const EMAIL_TOKEN_LENGTH = 24; | const EMAIL_TOKEN_LENGTH = 24; | ||||
private function cleanUpProfile() { | |||||
speck: Maybe include some comment/doc just indicating the intent of cleaning up the profile is to… | |||||
$this->profile->setBlurb(''); | |||||
// This function will be expanded later. | |||||
} | |||||
public function getUserProfile() { | public function getUserProfile() { | ||||
return $this->assertAttached($this->profile); | return $this->assertAttached($this->profile); | ||||
} | } | ||||
public function attachUserProfile(PhabricatorUserProfile $profile) { | public function attachUserProfile(PhabricatorUserProfile $profile) { | ||||
$this->profile = $profile; | $this->profile = $profile; | ||||
if ($this->isDisabled) { | |||||
$this->cleanUpProfile(); | |||||
} | |||||
return $this; | return $this; | ||||
} | } | ||||
public function loadUserProfile() { | public function loadUserProfile() { | ||||
if ($this->profile) { | if ($this->profile) { | ||||
return $this->profile; | return $this->profile; | ||||
} | } | ||||
$profile_dao = new PhabricatorUserProfile(); | $profile_dao = new PhabricatorUserProfile(); | ||||
$this->profile = $profile_dao->loadOneWhere('userPHID = %s', | $this->profile = $profile_dao->loadOneWhere('userPHID = %s', | ||||
$this->getPHID()); | $this->getPHID()); | ||||
if (!$this->profile) { | if (!$this->profile) { | ||||
$this->profile = PhabricatorUserProfile::initializeNewProfile($this); | $this->profile = PhabricatorUserProfile::initializeNewProfile($this); | ||||
} | } | ||||
if ($this->isDisabled) { | |||||
$this->cleanUpProfile(); | |||||
} | |||||
return $this->profile; | return $this->profile; | ||||
} | } | ||||
public function loadPrimaryEmailAddress() { | public function loadPrimaryEmailAddress() { | ||||
$email = $this->loadPrimaryEmail(); | $email = $this->loadPrimaryEmail(); | ||||
if (!$email) { | if (!$email) { | ||||
throw new Exception(pht('User has no primary email address!')); | throw new Exception(pht('User has no primary email address!')); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,110 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0
Maybe include some comment/doc just indicating the intent of cleaning up the profile is to scrub away user-created content which will likely be spam from most of our disabled accounts.