Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93066887
PhabricatorAuthInvite.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Nov 25, 23:03
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Nov 27, 23:03 (2 d)
Engine
blob
Format
Raw Data
Handle
22565607
Attached To
rPH Phabricator
PhabricatorAuthInvite.php
View Options
<?php
final
class
PhabricatorAuthInvite
extends
PhabricatorUserDAO
{
protected
$authorPHID
;
protected
$emailAddress
;
protected
$verificationHash
;
protected
$acceptedByPHID
;
private
$verificationCode
;
protected
function
getConfiguration
()
{
return
array
(
self
::
CONFIG_COLUMN_SCHEMA
=>
array
(
'emailAddress'
=>
'sort128'
,
'verificationHash'
=>
'bytes12'
,
'acceptedByPHID'
=>
'phid?'
,
),
self
::
CONFIG_KEY_SCHEMA
=>
array
(
'key_address'
=>
array
(
'columns'
=>
array
(
'emailAddress'
),
'unique'
=>
true
,
),
'key_code'
=>
array
(
'columns'
=>
array
(
'verificationHash'
),
'unique'
=>
true
,
),
),
)
+
parent
::
getConfiguration
();
}
public
function
getVerificationCode
()
{
if
(!
$this
->
getVerificationHash
())
{
if
(
$this
->
verificationHash
)
{
throw
new
Exception
(
pht
(
'Verification code can not be regenerated after an invite is '
.
'created.'
));
}
$this
->
verificationCode
=
Filesystem
::
readRandomCharacters
(
16
);
}
return
$this
->
verificationCode
;
}
public
function
save
()
{
if
(!
$this
->
getVerificationHash
())
{
$hash
=
PhabricatorHash
::
digestForIndex
(
$this
->
getVerificationCode
());
$this
->
setVerificationHash
(
$hash
);
}
return
parent
::
save
();
}
}
Event Timeline
Log In to Comment