1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-08 22:01:03 +01:00

Legalpad - make "Cancel" button "Log Out" button for required signature documents

Summary: Fixes T7299. Also re-direct the user to the initial request uri if the signature was required.

Test Plan: made a signature required legalpad doc. visit the instance at a specific uri, signed the document, and ended up at that specific uri

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7299

Differential Revision: https://secure.phabricator.com/D11809
This commit is contained in:
Bob Trahan 2015-02-18 13:19:07 -08:00
parent dd96967306
commit 17e5f7ff31

View file

@ -180,11 +180,19 @@ final class LegalpadDocumentSignController extends LegalpadController {
if (!$errors) {
$signature->save();
// If the viewer is logged in, send them to the document page, which
// will show that they have signed the document. Otherwise, send them
// to a completion page.
// If the viewer is logged in, signing for themselves, send them to
// the document page, which will show that they have signed the
// document. Unless of course they were required to sign the
// document to use Phabricator; in that case try really hard to
// re-direct them to where they wanted to go.
//
// Otherwise, send them to a completion page.
if ($viewer->isLoggedIn() && $is_individual) {
$next_uri = '/'.$document->getMonogram();
if ($document->getRequireSignature()) {
$request_uri = $request->getRequestURI();
$next_uri = (string) $request_uri;
}
} else {
$this->sendVerifySignatureEmail(
$document,
@ -401,11 +409,19 @@ final class LegalpadDocumentSignController extends LegalpadController {
'agree',
'agree',
pht('I agree to the terms laid forth above.'),
false))
false));
if ($document->getRequireSignature()) {
$cancel_uri = '/logout/';
$cancel_text = pht('Log Out');
} else {
$cancel_uri = $this->getApplicationURI();
$cancel_text = pht('Cancel');
}
$form
->appendChild(
id(new AphrontFormSubmitControl())
->setValue(pht('Sign Document'))
->addCancelButton($this->getApplicationURI()));
->addCancelButton($cancel_uri, $cancel_text));
return $form;
}