Changeset View
Changeset View
Standalone View
Standalone View
src/applications/people/storage/PhabricatorUserEmail.php
Show All 12 Lines | final class PhabricatorUserEmail | ||||
protected $isVerified; | protected $isVerified; | ||||
protected $isPrimary; | protected $isPrimary; | ||||
protected $verificationCode; | protected $verificationCode; | ||||
const MAX_ADDRESS_LENGTH = 128; | const MAX_ADDRESS_LENGTH = 128; | ||||
protected function getConfiguration() { | protected function getConfiguration() { | ||||
return array( | return array( | ||||
self::CONFIG_AUX_PHID => true, | |||||
self::CONFIG_COLUMN_SCHEMA => array( | self::CONFIG_COLUMN_SCHEMA => array( | ||||
'address' => 'sort128', | 'address' => 'sort128', | ||||
'isVerified' => 'bool', | 'isVerified' => 'bool', | ||||
'isPrimary' => 'bool', | 'isPrimary' => 'bool', | ||||
'verificationCode' => 'text64?', | 'verificationCode' => 'text64?', | ||||
), | ), | ||||
self::CONFIG_KEY_SCHEMA => array( | self::CONFIG_KEY_SCHEMA => array( | ||||
'address' => array( | 'address' => array( | ||||
'columns' => array('address'), | 'columns' => array('address'), | ||||
'unique' => true, | 'unique' => true, | ||||
), | ), | ||||
'userPHID' => array( | 'userPHID' => array( | ||||
'columns' => array('userPHID', 'isPrimary'), | 'columns' => array('userPHID', 'isPrimary'), | ||||
), | ), | ||||
), | ), | ||||
) + parent::getConfiguration(); | ) + parent::getConfiguration(); | ||||
} | } | ||||
public function getPHIDType() { | |||||
return PhabricatorPeopleUserEmailPHIDType::TYPECONST; | |||||
} | |||||
public function getVerificationURI() { | public function getVerificationURI() { | ||||
return '/emailverify/'.$this->getVerificationCode().'/'; | return '/emailverify/'.$this->getVerificationCode().'/'; | ||||
} | } | ||||
public function save() { | public function save() { | ||||
if (!$this->verificationCode) { | if (!$this->verificationCode) { | ||||
$this->setVerificationCode(Filesystem::readRandomCharacters(24)); | $this->setVerificationCode(Filesystem::readRandomCharacters(24)); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 239 Lines • Show Last 20 Lines |