Skip to content

Commit eba0ce9

Browse files
author
Robert Knight
authored
Merge pull request #18 from docusign/private
Made embedded signing ceremony the only item on the homepage when qui…
2 parents e4d871e + 3484ce2 commit eba0ce9

File tree

5 files changed

+95
-9
lines changed

5 files changed

+95
-9
lines changed

app/__init__.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@
1616
csrf = CSRFProtect(app)
1717

1818
# Set whether this is a quickstart in config
19-
app.config["quickstart"] = DS_CONFIG["quickstart"]
19+
#app.config["quickstart"] = DS_CONFIG["quickstart"]
2020

2121
# Set whether user has logged in
22-
app.config["isLoggedIn"] = False
22+
#app.config["isLoggedIn"] = False
2323

2424
# Register home page
2525
app.register_blueprint(core)
26+
2627
# Register OAuth
2728
app.register_blueprint(ds)
2829
# Register examples

app/docusign/views.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,15 @@ def ds_callback():
7676

7777
@ds.route("/must_authenticate")
7878
def ds_must_authenticate():
79-
return render_template("must_authenticate.html", title="Must authenticate")
80-
79+
qs = DS_CONFIG["quickstart"]
80+
if qs:
81+
return redirect(url_for("ds.ds_quickstart_auth"))
82+
else:
83+
return render_template("must_authenticate.html", title="Must authenticate")
84+
85+
@ds.route(("/quickstart_auth"))
86+
def ds_quickstart_auth():
87+
return render_template("quickstart_auth.html", title = "Must authenticate")
8188

8289
@ds.route("/ds_return")
8390
def ds_return():

app/templates/quickstart_auth.html

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!-- extend base layout -->
2+
{% extends "base.html" %}
3+
4+
{% block content %}
5+
<div style="margin:1% 5%;">
6+
<h1 class="display-4">Please Authenticate with DocuSign</h1>
7+
8+
<form method="post" data-busy="form" action={{ url_for("ds.ds_login") }}>
9+
<div class="form-group col-md-5">
10+
<label for="auth_type">Please choose your OAuth2.0 grant type</label>
11+
<select class="form-control" id="auth_type" name="auth_type">
12+
<option value="code_grant">Authorization Code Grant</option>
13+
</select>
14+
<p class="lead" style="padding-top: .5rem;">
15+
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
16+
<button type="submit" class="btn btn-docu">Authenticate with DocuSign</button>
17+
</p>
18+
</div>
19+
</form>
20+
<hr class="my-4">
21+
<p>You need to authenticate with DocuSign to continue your request.</p>
22+
</div>
23+
{% endblock %}

app/templates/quickstarthome.html

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<!-- extend base layout -->
2+
{% extends "base.html" %}
3+
4+
{% block content %}
5+
6+
{% if not 'ds_user_name' in session %}
7+
<!-- IF not signed in -->
8+
<div>
9+
<div class="jumbotron jumbotron-fluid"> <table>
10+
<tbody>
11+
<tr>
12+
<td>
13+
<h1 class="display-4">Python Launcher</h1>
14+
<p class="Xlead">Welcome to the DocuSign Python Quickstart launcher.</p>
15+
</td>
16+
<td>
17+
<img src="/static/assets/banner-code.png" />
18+
</td>
19+
</tr>
20+
</tbody>
21+
</table>
22+
</div>
23+
{% endif %}
24+
25+
<!-- Future: add a table of contents or navigation pane
26+
Eg, see https://stackoverflow.com/questions/21868610/make-column-fixed-position-in-bootstrap
27+
-->
28+
29+
<div class="container" style="margin-top: 40px" id="index-page">
30+
<h2>Welcome</h2>
31+
<p>This launcher includes the following examples for the DocuSign eSignature REST API.</p>
32+
33+
{% if show_doc %}
34+
<p><a target='_blank' href='{{ documentation | safe }}'>Documentation</a> on using JWT or Authorization Code Grant from a Python Flask application.</p>
35+
{% endif %}
36+
37+
<h2>Basic Examples</h2>
38+
39+
<h4 id="example001">1. <a href="eg001">Embedded Signing Ceremony</a></h4>
40+
<p>This example sends an envelope, and then uses an embedded signing ceremony for the first signer.
41+
With embedded signing, the DocuSign signing ceremony is initiated from your website.
42+
</p>
43+
<p>API methods used:
44+
<a target ='_blank' href="https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create">Envelopes::create</a> and
45+
<a target ='_blank' href="https://developers.docusign.com/esign-rest-api/reference/Envelopes/EnvelopeViews/createRecipient">EnvelopeViews::createRecipient</a>.
46+
</p>
47+
</div>
48+
49+
<!-- anchor-js is only for the index page -->
50+
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/4.1.1/anchor.min.js"></script>
51+
<script>anchors.options.placement = 'left'; anchors.add('h4')</script>
52+
53+
{% endblock %}

app/views.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,20 @@
88

99
@core.route("/")
1010
def index():
11-
#if quickstart go to eg001 else go to homepage
12-
quickstart=app.config["quickstart"]
13-
if quickstart == True:
14-
return render_template("eg001_embedded_signing.html", title="Embedded signing ceremony")
11+
qs = DS_CONFIG["quickstart"]
12+
if qs:
13+
return redirect(url_for("core.qshome"))
1514
else:
1615
return render_template("home.html", title="Home - Python Code Examples")
1716

17+
@core.route("/quickstarthome")
18+
def qshome():
19+
return render_template("quickstarthome.html", title = "Homepage for Quickstart")
20+
1821
@core.route("/index")
1922
def r_index():
2023
return redirect(url_for("core.index"))
2124

22-
2325
@core.app_errorhandler(404)
2426
def not_found_error(error):
2527
return render_template("404.html"), 404

0 commit comments

Comments
 (0)