CHALLENGE: Read https://flask-wtf.readthedocs.io/en/1.0.x/form/ and use it to figure out how to create a simple login form.

SPECIFICATIONS:

  • It must have an email and password field.

  • They can both be StringFields.

  • You don't have to worry about validators.

  • Both email and password inputs should be size 30. (This describes the width of the input).

  • You should not need to create any <label> or <input> elements manually using HTML.

HINT: If you want to add csrf protection, you will need to add the following code in your login.html:

{‌{ form.csrf_token }}

and you will need to create a secret key in your main.py, which will be used to generate the csrf_token. e.g.

app.secret_key = "some secret string"


This is what you're aiming for:

SOLUTION:

https://gist.github.com/angelabauer/162f56578b9193090963a0691c826790

NOTE: in order to complete this challenge, you will need a good grasp of Python Classes and Objects/Inheritance, we've already covered this on day 16. If you find the code in the documentation hard to understand, it might be a good time for a recap.