Skip to content

Commit

Permalink
added unstyled password response
Browse files Browse the repository at this point in the history
  • Loading branch information
chr-peters committed Mar 19, 2021
1 parent a21f37d commit a51b971
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions strong_but_simple_passwords/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ <h3>3. Put a random symbol somewhere in between</h3>
</ol>
<button type="submit">Generate password!</button>
</form>
{% if generated_password is defined %}
Congratulations! 🎉🎉🎉 You successfully generated a secure password:
{{ generated_password }}
{% endif %}
</main>
</body>

Expand Down
9 changes: 7 additions & 2 deletions strong_but_simple_passwords/views.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from flask import render_template, request
from .core import get_random_sentence
from .core import get_random_sentence, generate_password_from_sentence


def index():
Expand All @@ -12,5 +12,10 @@ def index():
random_sentence = get_random_sentence()
return render_template("index.html", sentence=random_sentence)

# read user sentence and generate password
user_sentence = request.form["input_sentence"]
return render_template("index.html", sentence=user_sentence)
generated_password = generate_password_from_sentence(user_sentence)

return render_template(
"index.html", sentence=user_sentence, generated_password=generated_password
)

0 comments on commit a51b971

Please sign in to comment.