Differential D20059 Diff 47903 src/aphront/handler/PhabricatorHighSecurityRequestExceptionHandler.php
Changeset View
Changeset View
Standalone View
Standalone View
src/aphront/handler/PhabricatorHighSecurityRequestExceptionHandler.php
Show First 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | $dialog = id(new AphrontDialogView()) | ||||
->addHiddenInput(AphrontRequest::TYPE_HISEC, true) | ->addHiddenInput(AphrontRequest::TYPE_HISEC, true) | ||||
->setSubmitURI($request->getPath()) | ->setSubmitURI($request->getPath()) | ||||
->addCancelButton($throwable->getCancelURI()) | ->addCancelButton($throwable->getCancelURI()) | ||||
->addSubmitButton($submit); | ->addSubmitButton($submit); | ||||
$form_layout = $form->buildLayoutView(); | $form_layout = $form->buildLayoutView(); | ||||
if ($is_upgrade) { | if ($is_upgrade) { | ||||
$messages = array( | $message = pht( | ||||
pht( | |||||
'You are taking an action which requires you to enter '. | 'You are taking an action which requires you to enter '. | ||||
'high security.'), | 'high security.'); | ||||
); | |||||
$info_view = id(new PHUIInfoView()) | $info_view = id(new PHUIInfoView()) | ||||
->setSeverity(PHUIInfoView::SEVERITY_MFA) | ->setSeverity(PHUIInfoView::SEVERITY_MFA) | ||||
->setErrors($messages); | ->setErrors(array($message)); | ||||
$dialog | $dialog | ||||
->appendChild($info_view) | ->appendChild($info_view) | ||||
->appendParagraph( | ->appendParagraph( | ||||
pht( | pht( | ||||
'To enter high security mode, confirm your credentials:')) | 'To enter high security mode, confirm your credentials:')) | ||||
->appendChild($form_layout) | ->appendChild($form_layout) | ||||
->appendParagraph( | ->appendParagraph( | ||||
pht( | pht( | ||||
'Your account will remain in high security mode for a short '. | 'Your account will remain in high security mode for a short '. | ||||
'period of time. When you are finished taking sensitive '. | 'period of time. When you are finished taking sensitive '. | ||||
'actions, you should leave high security.')); | 'actions, you should leave high security.')); | ||||
} else { | } else { | ||||
$message = pht( | |||||
'You are taking an action which requires you to provide '. | |||||
'multi-factor credentials.'); | |||||
$info_view = id(new PHUIInfoView()) | |||||
->setSeverity(PHUIInfoView::SEVERITY_MFA) | |||||
->setErrors(array($message)); | |||||
$dialog | $dialog | ||||
->appendChild($info_view) | |||||
->setErrors( | ->setErrors( | ||||
array( | array( | ||||
pht( | |||||
'You are taking an action which requires you to provide '. | |||||
'multi-factor credentials.'), | |||||
)) | )) | ||||
->appendChild($form_layout); | ->appendChild($form_layout); | ||||
} | } | ||||
$request_parameters = $request->getPassthroughRequestParameters( | $request_parameters = $request->getPassthroughRequestParameters( | ||||
$respect_quicksand = true); | $respect_quicksand = true); | ||||
foreach ($request_parameters as $key => $value) { | foreach ($request_parameters as $key => $value) { | ||||
$dialog->addHiddenInput($key, $value); | $dialog->addHiddenInput($key, $value); | ||||
} | } | ||||
return $dialog; | return $dialog; | ||||
} | } | ||||
} | } |