mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
Add some profile upload jonx.
This commit is contained in:
parent
78f0b4aff9
commit
701d029123
3 changed files with 101 additions and 1 deletions
|
@ -30,7 +30,7 @@ class PhabricatorUserSettingsController extends PhabricatorPeopleController {
|
|||
$user = $request->getUser();
|
||||
|
||||
$pages = array(
|
||||
// 'personal' => 'Profile',
|
||||
'account' => 'Account',
|
||||
// 'password' => 'Password',
|
||||
// 'facebook' => 'Facebook Account',
|
||||
'arcanist' => 'Arcanist Certificate',
|
||||
|
@ -71,6 +71,15 @@ class PhabricatorUserSettingsController extends PhabricatorPeopleController {
|
|||
$user->save();
|
||||
return id(new AphrontRedirectResponse())
|
||||
->setURI('/settings/page/arcanist/?regenerated=true');
|
||||
case 'account':
|
||||
if (!empty($_FILES['profile'])) {
|
||||
$file = PhabricatorFile::newFromPHPUpload($_FILES['profile']);
|
||||
$user->setProfileImagePHID($file->getPHID());
|
||||
}
|
||||
|
||||
$user->save();
|
||||
return id(new AphrontRedirectResponse())
|
||||
->setURI('/settings/page/account/');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,6 +87,9 @@ class PhabricatorUserSettingsController extends PhabricatorPeopleController {
|
|||
case 'arcanist':
|
||||
$content = $this->renderArcanistCertificateForm();
|
||||
break;
|
||||
case 'account':
|
||||
$content = $this->renderAccountForm();
|
||||
break;
|
||||
default:
|
||||
$content = 'derp derp';
|
||||
break;
|
||||
|
@ -164,5 +176,60 @@ class PhabricatorUserSettingsController extends PhabricatorPeopleController {
|
|||
|
||||
return $notice.$cert->render().$regen->render();
|
||||
}
|
||||
|
||||
private function renderAccountForm() {
|
||||
$request = $this->getRequest();
|
||||
$user = $request->getUser();
|
||||
|
||||
$img_src = PhabricatorFileURI::getViewURIForPHID(
|
||||
$user->getProfileImagePHID());
|
||||
|
||||
$form = new AphrontFormView();
|
||||
$form
|
||||
->setUser($user)
|
||||
->setEncType('multipart/form-data')
|
||||
->appendChild(
|
||||
id(new AphrontFormStaticControl())
|
||||
->setLabel('Username')
|
||||
->setValue($user->getUsername()))
|
||||
->appendChild(
|
||||
id(new AphrontFormStaticControl())
|
||||
->setLabel('Email')
|
||||
->setValue($user->getEmail()))
|
||||
->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
->setLabel('Real Name')
|
||||
->setValue($user->getRealName()))
|
||||
->appendChild(
|
||||
id(new AphrontFormMarkupControl())
|
||||
->setValue('<hr />'))
|
||||
->appendChild(
|
||||
id(new AphrontFormMarkupControl())
|
||||
->setLabel('Profile Image')
|
||||
->setValue(
|
||||
phutil_render_tag(
|
||||
'img',
|
||||
array(
|
||||
'src' => $img_src,
|
||||
))))
|
||||
->appendChild(
|
||||
id(new AphrontFormFileControl())
|
||||
->setLabel('Change Image')
|
||||
->setName('profile')
|
||||
->setCaption('Upload a 50x50px image.'))
|
||||
->appendChild(
|
||||
id(new AphrontFormMarkupControl())
|
||||
->setValue('<hr />'))
|
||||
->appendChild(
|
||||
id(new AphrontFormSubmitControl())
|
||||
->setValue('Save'));
|
||||
|
||||
$panel = new AphrontPanelView();
|
||||
$panel->setHeader('Profile Settings');
|
||||
$panel->setWidth(AphrontPanelView::WIDTH_FORM);
|
||||
$panel->appendChild($form);
|
||||
|
||||
return $panel->render();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
26
src/docs/certificates.diviner
Normal file
26
src/docs/certificates.diviner
Normal file
|
@ -0,0 +1,26 @@
|
|||
@title Installing Authentication Certificates
|
||||
@group config
|
||||
|
||||
Arcanist uses certificates to authenticate to Phabricator. Usernames and
|
||||
certificates for each host you have credentials on are stored in your
|
||||
##~/.arcrc## file under the "hosts" key. The configuration should look something
|
||||
like this:
|
||||
|
||||
{
|
||||
# ...
|
||||
"hosts" : {
|
||||
"http://phabricator.example.com/api/" : {
|
||||
"user" : "alincoln",
|
||||
"cert" : "Y2FTilanoONuPzAtXayoctmX6FmIt7QjxXhWVAv2EoWpeik1Deecl3jRo"
|
||||
}
|
||||
# If you have accounts on more than one host, add them here.
|
||||
}
|
||||
}
|
||||
|
||||
To retrieve the certificate for a Phabricator host:
|
||||
|
||||
- Login to Phabricator.
|
||||
- Go to Settings > Arcanist Certificate.
|
||||
|
||||
Copy the certificate into the "cert" field, and specify your username in the
|
||||
"user" field.
|
|
@ -97,3 +97,10 @@ table.aphront-form-control-checkbox-layout th {
|
|||
.aphront-form-control-checkbox-layout td input {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.aphront-form-input hr {
|
||||
border: none;
|
||||
background: #bbbbbb;
|
||||
height: 1px;
|
||||
position: relative;
|
||||
}
|
Loading…
Reference in a new issue