Changeset View
Changeset View
Standalone View
Standalone View
src/applications/people/storage/PhabricatorUserEmail.php
<?php | <?php | ||||
/** | /** | ||||
* @task restrictions Domain Restrictions | * @task restrictions Domain Restrictions | ||||
* @task email Email About Email | * @task email Email About Email | ||||
*/ | */ | ||||
final class PhabricatorUserEmail extends PhabricatorUserDAO { | final class PhabricatorUserEmail extends PhabricatorUserDAO { | ||||
protected $userPHID; | protected $userPHID; | ||||
protected $address; | protected $address; | ||||
protected $isVerified; | protected $isVerified; | ||||
protected $isPrimary; | protected $isPrimary; | ||||
protected $verificationCode; | protected $verificationCode; | ||||
const MAX_ADDRESS_LENGTH = 128; | const MAX_ADDRESS_LENGTH = 128; | ||||
public function getConfiguration() { | |||||
return array( | |||||
self::CONFIG_COLUMN_SCHEMA => array( | |||||
'address' => 'text128', | |||||
'isVerified' => 'bool', | |||||
'isPrimary' => 'bool', | |||||
'verificationCode' => 'text64?', | |||||
), | |||||
self::CONFIG_KEY_SCHEMA => array( | |||||
'address' => array( | |||||
'columns' => array('address'), | |||||
'unique' => true, | |||||
), | |||||
'userPHID' => array( | |||||
'columns' => array('userPHID', 'isPrimary'), | |||||
), | |||||
), | |||||
) + parent::getConfiguration(); | |||||
} | |||||
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 232 Lines • Show Last 20 Lines |