mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-09 06:11:01 +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:
parent
dd96967306
commit
17e5f7ff31
1 changed files with 21 additions and 5 deletions
|
@ -180,11 +180,19 @@ final class LegalpadDocumentSignController extends LegalpadController {
|
||||||
if (!$errors) {
|
if (!$errors) {
|
||||||
$signature->save();
|
$signature->save();
|
||||||
|
|
||||||
// If the viewer is logged in, send them to the document page, which
|
// If the viewer is logged in, signing for themselves, send them to
|
||||||
// will show that they have signed the document. Otherwise, send them
|
// the document page, which will show that they have signed the
|
||||||
// to a completion page.
|
// 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) {
|
if ($viewer->isLoggedIn() && $is_individual) {
|
||||||
$next_uri = '/'.$document->getMonogram();
|
$next_uri = '/'.$document->getMonogram();
|
||||||
|
if ($document->getRequireSignature()) {
|
||||||
|
$request_uri = $request->getRequestURI();
|
||||||
|
$next_uri = (string) $request_uri;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->sendVerifySignatureEmail(
|
$this->sendVerifySignatureEmail(
|
||||||
$document,
|
$document,
|
||||||
|
@ -401,11 +409,19 @@ final class LegalpadDocumentSignController extends LegalpadController {
|
||||||
'agree',
|
'agree',
|
||||||
'agree',
|
'agree',
|
||||||
pht('I agree to the terms laid forth above.'),
|
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(
|
->appendChild(
|
||||||
id(new AphrontFormSubmitControl())
|
id(new AphrontFormSubmitControl())
|
||||||
->setValue(pht('Sign Document'))
|
->setValue(pht('Sign Document'))
|
||||||
->addCancelButton($this->getApplicationURI()));
|
->addCancelButton($cancel_uri, $cancel_text));
|
||||||
|
|
||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue