Skip to content

Made embedded signing ceremony the only item on the homepage when qui… #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
csrf = CSRFProtect(app)

# Set whether this is a quickstart in config
app.config["quickstart"] = DS_CONFIG["quickstart"]
#app.config["quickstart"] = DS_CONFIG["quickstart"]

# Set whether user has logged in
app.config["isLoggedIn"] = False
#app.config["isLoggedIn"] = False

# Register home page
app.register_blueprint(core)

# Register OAuth
app.register_blueprint(ds)
# Register examples
Expand Down
11 changes: 9 additions & 2 deletions app/docusign/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,15 @@ def ds_callback():

@ds.route("/must_authenticate")
def ds_must_authenticate():
return render_template("must_authenticate.html", title="Must authenticate")

qs = DS_CONFIG["quickstart"]
if qs:
return redirect(url_for("ds.ds_quickstart_auth"))
else:
return render_template("must_authenticate.html", title="Must authenticate")

@ds.route(("/quickstart_auth"))
def ds_quickstart_auth():
return render_template("quickstart_auth.html", title = "Must authenticate")

@ds.route("/ds_return")
def ds_return():
Expand Down
23 changes: 23 additions & 0 deletions app/templates/quickstart_auth.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!-- extend base layout -->
{% extends "base.html" %}

{% block content %}
<div style="margin:1% 5%;">
<h1 class="display-4">Please Authenticate with DocuSign</h1>

<form method="post" data-busy="form" action={{ url_for("ds.ds_login") }}>
<div class="form-group col-md-5">
<label for="auth_type">Please choose your OAuth2.0 grant type</label>
<select class="form-control" id="auth_type" name="auth_type">
<option value="code_grant">Authorization Code Grant</option>
</select>
<p class="lead" style="padding-top: .5rem;">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
<button type="submit" class="btn btn-docu">Authenticate with DocuSign</button>
</p>
</div>
</form>
<hr class="my-4">
<p>You need to authenticate with DocuSign to continue your request.</p>
</div>
{% endblock %}
53 changes: 53 additions & 0 deletions app/templates/quickstarthome.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<!-- extend base layout -->
{% extends "base.html" %}

{% block content %}

{% if not 'ds_user_name' in session %}
<!-- IF not signed in -->
<div>
<div class="jumbotron jumbotron-fluid"> <table>
<tbody>
<tr>
<td>
<h1 class="display-4">Python Launcher</h1>
<p class="Xlead">Welcome to the DocuSign Python Quickstart launcher.</p>
</td>
<td>
<img src="/static/assets/banner-code.png" />
</td>
</tr>
</tbody>
</table>
</div>
{% endif %}

<!-- Future: add a table of contents or navigation pane
Eg, see https://stackoverflow.com/questions/21868610/make-column-fixed-position-in-bootstrap
-->

<div class="container" style="margin-top: 40px" id="index-page">
<h2>Welcome</h2>
<p>This launcher includes the following examples for the DocuSign eSignature REST API.</p>

{% if show_doc %}
<p><a target='_blank' href='{{ documentation | safe }}'>Documentation</a> on using JWT or Authorization Code Grant from a Python Flask application.</p>
{% endif %}

<h2>Basic Examples</h2>

<h4 id="example001">1. <a href="eg001">Embedded Signing Ceremony</a></h4>
<p>This example sends an envelope, and then uses an embedded signing ceremony for the first signer.
With embedded signing, the DocuSign signing ceremony is initiated from your website.
</p>
<p>API methods used:
<a target ='_blank' href="https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create">Envelopes::create</a> and
<a target ='_blank' href="https://developers.docusign.com/esign-rest-api/reference/Envelopes/EnvelopeViews/createRecipient">EnvelopeViews::createRecipient</a>.
</p>
</div>

<!-- anchor-js is only for the index page -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/4.1.1/anchor.min.js"></script>
<script>anchors.options.placement = 'left'; anchors.add('h4')</script>

{% endblock %}
12 changes: 7 additions & 5 deletions app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,20 @@

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

@core.route("/quickstarthome")
def qshome():
return render_template("quickstarthome.html", title = "Homepage for Quickstart")

@core.route("/index")
def r_index():
return redirect(url_for("core.index"))


@core.app_errorhandler(404)
def not_found_error(error):
return render_template("404.html"), 404
Expand Down