diff --git a/app.py b/app.py index 48485b6f4..6141d1877 100644 --- a/app.py +++ b/app.py @@ -3,6 +3,8 @@ import pytz # timezone import requests import os +import secrets +import string @@ -17,7 +19,6 @@ def home_page(): def profile(name): return render_template('index.html', name=name) - @app.route('/add_numbers', methods=['GET','POST']) def add_numbers_post(): # --> ['5', '6', '8'] @@ -89,6 +90,18 @@ def python_apps_page(): def contact(): return render_template('contact.html') +@app.route('/password_generator', methods=['GET','POST']) +def password_generate(): + if request.method == 'GET': + return render_template('password_generator.html') + elif request.method == 'POST': + print(request.form['text'].split()) + + for item in request.form['text'].split(): + chars = string.digits + string.ascii_letters + string.punctuation + + return render_template('password_generator.html', result="\n".join(secrets.choice(chars) for _ in range (40))) + @app.route('/blog', methods=['GET']) def blog_page(): return render_template('blog.html') diff --git a/static/img/generate_password.JPG b/static/img/generate_password.JPG new file mode 100644 index 000000000..666422ffb Binary files /dev/null and b/static/img/generate_password.JPG differ diff --git a/templates/index.html b/templates/index.html index 16334ffbd..28172e543 100755 --- a/templates/index.html +++ b/templates/index.html @@ -83,7 +83,7 @@
- +

Hey there {{name}}!


@@ -104,35 +104,14 @@

Portfolio


- @@ -170,8 +149,8 @@

About

diff --git a/templates/password_generator.html b/templates/password_generator.html new file mode 100644 index 000000000..ade2c15e4 --- /dev/null +++ b/templates/password_generator.html @@ -0,0 +1,65 @@ +{% extends "index.html" %} + +{% block title %}password_generator{% endblock %} + +{% block content %} + +
+
+
+ +
+

+
+ Generates a 256-bit password using python +
+
+
+
+ + + + +
+
+
+
+

Generate Password

+
+
+
+
+
+ + +
+
+
+ + +

+
+
+
+
+
+
+
+ +

+
+
+
+
+

Answer = {{result}}

+
+
+
+ +
+
+
+{% endblock %} + +{% block footer%} +{% endblock %} diff --git a/templates/python_apps.html b/templates/python_apps.html index cf743d352..c23a7273a 100644 --- a/templates/python_apps.html +++ b/templates/python_apps.html @@ -7,11 +7,11 @@
- +

Simple Python Apps


- Let's Play! + Python App Showcase
@@ -43,6 +43,20 @@

Addition

Cabin
+ +
+
+

Password Generator

+ +
+
+ +
+
+ Cabin +
+
+

Shopping List