Skip to content

Commit

Permalink
Clean up, adding oauth to multiple templates at the same time.:
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Sep 11, 2017
1 parent 622d163 commit 87291c1
Show file tree
Hide file tree
Showing 10 changed files with 149 additions and 96 deletions.
Empty file modified nginx.conf 100644 → 100755
Empty file.
127 changes: 82 additions & 45 deletions statelesshosting.py

Large diffs are not rendered by default.

Empty file modified uwsgi.ini 100644 → 100755
Empty file.
43 changes: 27 additions & 16 deletions views/async.tpl
@@ -1,23 +1,34 @@
<html>
<head>
<style>body {font-family: "Trebuchet MS", Helvetica, sans-serif;}</style>
%include('header.tpl')


<body>
% if applied == 0:
<h1>Access Granted</h1>
Access has been granted. Normally the server would later provision the template onto the domain.
<p/>
Here we simply emulate this asynchronous provisioning by allowing the template to be applied now.
Access has been granted to {{domain}}.
<br/><br/>
% else:
<h1>Applied</h1>
You've applied a template to {{domain}}
% if subdomain != '' and subdomain != None:
with sub domain '{{subdomain}}'
% end
. You can apply either template to the same domain, or to another sub domain.
% end
<h1>Interesting information (read only):</h1>
<form method="post" action="/asyncconfig">
<table>
<tr><td>Domain:</td><td><input size=50 name=domain type=text readonly value="{{domain}}"/></td></tr>
<tr><td>Message:</td><td><input size=50 name=message type=text readonly value="{{message}}"/></td></tr>
<tr><td>API Url Root:</td><td><input size=50 name=urlAPI type=text readonly value="{{urlAPI}}"/></td></tr>
<tr><td>Code:</td><td><input size=50 name=oAuthCode type=text readonly value="{{code}}"/></td></tr>
% if applied == 0:
<tr><td>oAuth Response Code from consent:</td><td><input size=50 name=oAuthCode type=text readonly value="{{code}}"/></td></tr>
<tr><td>JSON from Access Token Fetch</td><td><textarea name=json_response type=text readonly rows="10" cols="50">{{json_response}}</textarea></td></tr>
<tr><td>Access Token (oAuth):</td><td><input size=50 name=access_token type=text readonly value="{{access_token}}"/></td></tr>
<tr><td>&nbsp;</td><td><input type="submit"/></td>
% end
<tr><td>Domain:</td><td><input size=50 name=domain type=text readonly value="{{domain}}"/></td></tr>
<tr><td>API Url Root from DNS Provider:</td><td><input size=50 name=urlAPI type=text readonly value="{{urlAPI}}"/></td></tr>
<tr><td>Access Token:</td><td><input size=50 name=access_token type=text readonly value="{{access_token}}"/></td></tr>
</table>
<h1>Apply template:</h1>
<table>
<tr><td>Sub Domain:</td><td><input size=50 name=subdomain type=text value="{{subdomain}}"/></td></tr>
<tr><td>Message:</td><td><input size=50 name=message type=text value="{{message}}"/></td></tr>
<tr><td>&nbsp;</td><td><input type="submit" value="Apply Template 1"/></td>
<tr><td>&nbsp;</td><td><input type="submit" value="Apply Template 2" name="template2"/></td>
</table>
</form>
</body>
</html>
%include('footer.tpl')
17 changes: 8 additions & 9 deletions views/confirm.tpl
@@ -1,20 +1,19 @@
<html>
<head>
<style>body {font-family: "Trebuchet MS", Helvetica, sans-serif;}</style>
</head>
%include('header.tpl')

<body>
<h1>Provider Found</h1>
Your domain uses {{providerName}}
<p/>
<a target=_new href='{{synchronousTargetUrl}}'>Configure Synchronously</a>
<a target=_new href='{{synchronousTargetUrl1}}'>Configure Synchronously</a>
<p/>
<a target=_new href='{{synchronousSignedTargetUrl}}'>Configure Synchronously with Signature verification (not supported by all providers)</a> (Verified = {{verified}})
<a target=_new href='{{synchronousTargetUrl2}}'>Configure Synchronously (alternative template)</a>
<p/>
<a target=_new href='{{synchronousSignedTargetUrl1}}'>Configure Synchronously with Signature verification (not supported by all providers)</a> (Verified = {{verified}})
<p/>
<a target=_new href='{{synchronousSignedTargetUrl2}}'>Configure Synchronously (alternative template) with Signature verification (not supported by all providers)</a> (Verified = {{verified}})
<p/>
% if asynchronousTargetUrl != None:
<a href='{{asynchronousTargetUrl}}'>Configure Asynchronously</a>
% else:
Async not supported by provider
% end
</body>
</html>
%include('footer.tpl')
2 changes: 2 additions & 0 deletions views/footer.tpl
@@ -0,0 +1,2 @@
</body>
</html>
19 changes: 19 additions & 0 deletions views/header.tpl
@@ -0,0 +1,19 @@
<html>
<head>
<title>Domain Connect Example</title>
<style>body {font-family: "Trebuchet MS", Helvetica, sans-serif;}</style>
</head>

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-102550640-1', 'auto');
ga('send', 'pageview');
</script>
<body>
<a href="/domainconnect.org"><img src="static/dclogo.png"></a>
16 changes: 6 additions & 10 deletions views/index.tpl
@@ -1,19 +1,15 @@
<html>
<head>
<style>body {font-family: "Trebuchet MS", Helvetica, sans-serif;}</style>
</head>
%include('header.tpl')

<body>
<img src="static/dclogo.png">
<h1>Example Service Provider</h1>
<h2>This website uses stateless hosting to demonstrate Domain Connect.</h2>
<h2>This website demonstrates a sample Domain Connect Service Provider. You enter your domain name, subdomain (optional) and a message to display. Using Domain Connect, these values are places in DNS which are used to later render the message entered as the site content for the domain/subdomain.</h2>

<form method="post" action='/config'>
<table>
<tr><td>Domain Name</td><td><input name='domain' type="text"/></td></tr>
<tr><td>Sub Domain Name (optional)</td><td><input name='subdomain' type="text"/></td></tr>
<tr><td>Message</td><td><input name='message' type="text"/></td></tr>
<tr><td>&nbsp;</td><td><input type="submit"/></td></tr>
<tr><td>&nbsp;</td><td><input type="submit" value="Configure" /></td></tr>
</table>
</form>
</body>
</html>

%include('footer.tpl')
10 changes: 2 additions & 8 deletions views/invalid_data.tpl
@@ -1,12 +1,6 @@
<html>
<head>
<style>body {font-family: "Trebuchet MS", Helvetica, sans-serif;}</style>
</head>

<body>
%include('header.tpl')
<h1>Invalid Data</h1>
Domain name must be a valid domain name.
<br/>
Message is required, must be less than 255 characters, and must not contain any special characters.
</body>
</html>
%include('footer.tpl')
11 changes: 3 additions & 8 deletions views/no_domain_connect.tpl
@@ -1,10 +1,5 @@
<html>
<head>
<style>body {font-family: "Trebuchet MS", Helvetica, sans-serif;}</style>
</head>

<body>
%include('header.tpl')
<h1>Manual Change Needed</h1
Domain does not support domain connect. You would need to make DNS changes manually.
</body>
</html>
%include('footer.tpl')

0 comments on commit 87291c1

Please sign in to comment.