mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-11 16:16:14 +01:00
f0c6ee4823
Summary: Ref T920. To send you SMS messages, we need to know your phone number. This adds bare-bone basics (transactions, storage, editor, etc). From here: **Disabling Numbers**: I'll let you disable numbers in an upcoming diff. **Primary Number**: I think I'm just going to let you pick a number as "primary", similar to how email works. We could imagine a world where you have one "MFA" number and one "notifications" number, but this seems unlikely-ish? **Publishing Numbers (Profile / API)**: At some point, we could let you say that a number is public / "show on my profile" and provide API access / directory features. Not planning to touch this for now. **Non-Phone Numbers**: Eventually this could be a list of other similar contact mechanisms (APNS/GCM devices, Whatsapp numbers, ICQ number, twitter handle so MFA can slide into your DM's?). Not planning to touch this for now, but the path should be straightforward when we get there. This is why it's called "Contact Number", not "Phone Number". **MFA-Required + SMS**: Right now, if the only MFA provider is SMS and MFA is required on the install, you can't actually get into Settings to add a contact number to configure SMS. I'll look at the best way to deal with this in an upcoming diff -- likely, giving you partial access to more of Setings before you get thorugh the MFA gate. Conceptually, it seems reasonable to let you adjust some other settings, like "Language" and "Accessibility", before you set up MFA, so if the "you need to add MFA" portal was more like a partial Settings screen, maybe that's pretty reasonable. **Verifying Numbers**: We'll probably need to tackle this eventually, but I'm not planning to worry about it for now. Test Plan: {F6137174} Reviewers: amckinley Reviewed By: amckinley Subscribers: avivey, PHID-OPKG-gm6ozazyms6q6i22gyam Maniphest Tasks: T920 Differential Revision: https://secure.phabricator.com/D19988
86 lines
2 KiB
PHP
86 lines
2 KiB
PHP
<?php
|
|
|
|
final class PhabricatorAuthContactNumberEditEngine
|
|
extends PhabricatorEditEngine {
|
|
|
|
const ENGINECONST = 'auth.contact';
|
|
|
|
public function isEngineConfigurable() {
|
|
return false;
|
|
}
|
|
|
|
public function getEngineName() {
|
|
return pht('Contact Numbers');
|
|
}
|
|
|
|
public function getSummaryHeader() {
|
|
return pht('Edit Contact Numbers');
|
|
}
|
|
|
|
public function getSummaryText() {
|
|
return pht('This engine is used to edit contact numbers.');
|
|
}
|
|
|
|
public function getEngineApplicationClass() {
|
|
return 'PhabricatorAuthApplication';
|
|
}
|
|
|
|
protected function newEditableObject() {
|
|
$viewer = $this->getViewer();
|
|
return PhabricatorAuthContactNumber::initializeNewContactNumber($viewer);
|
|
}
|
|
|
|
protected function newObjectQuery() {
|
|
return new PhabricatorAuthContactNumberQuery();
|
|
}
|
|
|
|
protected function getObjectCreateTitleText($object) {
|
|
return pht('Create Contact Number');
|
|
}
|
|
|
|
protected function getObjectCreateButtonText($object) {
|
|
return pht('Create Contact Number');
|
|
}
|
|
|
|
protected function getObjectEditTitleText($object) {
|
|
return pht('Edit Contact Number');
|
|
}
|
|
|
|
protected function getObjectEditShortText($object) {
|
|
return $object->getObjectName();
|
|
}
|
|
|
|
protected function getObjectCreateShortText() {
|
|
return pht('Create Contact Number');
|
|
}
|
|
|
|
protected function getObjectName() {
|
|
return pht('Contact Number');
|
|
}
|
|
|
|
protected function getEditorURI() {
|
|
return '/auth/contact/edit/';
|
|
}
|
|
|
|
protected function getObjectCreateCancelURI($object) {
|
|
return '/settings/panel/contact/';
|
|
}
|
|
|
|
protected function getObjectViewURI($object) {
|
|
return $object->getURI();
|
|
}
|
|
|
|
protected function buildCustomEditFields($object) {
|
|
return array(
|
|
id(new PhabricatorTextEditField())
|
|
->setKey('contactNumber')
|
|
->setTransactionType(
|
|
PhabricatorAuthContactNumberNumberTransaction::TRANSACTIONTYPE)
|
|
->setLabel(pht('Contact Number'))
|
|
->setDescription(pht('The contact number.'))
|
|
->setValue($object->getContactNumber())
|
|
->setIsRequired(true),
|
|
);
|
|
}
|
|
|
|
}
|