Skip to content
Myr

Tutorial: Note extensions for encrypting passwords (#1854)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fix #836

authored by wldtyp · committed by Jeff Widman · parent 62aaee0 · Browse files · 1 file+19 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+19 added−6 removed

  • other:+19 added−6 removed

1 file+19 added−6 removed

modified:docs/tutorial/views.rst+19 added-6 removed
92 unmodified lines
93 def logout():94 session.pop('logged_in', None)95 flash('You were logged out')96 return redirect(url_for('show_entries'))97 98Note that it is not a good idea to store passwords in plain text. You want to99protect login credentials if someone happens to have access to your database.100One way to do this is to use Security Helpers from Werkzeug to hash the101password. However, the emphasis of this tutorial is to demonstrate the basics102of Flask and plain text passwords are used for simplicity.9798.. admonition:: Security Note99100 Passwords should never be stored in plain text in a production 101 system. This tutorial uses plain text passwords for simplicity. If you 102 plan to release a project based off this tutorial out into the world, 103 passwords should be both `hashed and salted`_ before being stored in a 104 database or file. 105106 Fortunately, there are Flask extensions for the purpose of 107 hashing passwords and verifying passwords against hashes, so adding 108 this functionality is fairly straight forward. There are also 109 many general python libraries that can be used for hashing.110111 You can find a list of recommended Flask extensions 112 `here <http://flask.pocoo.org/extensions/>`_113114115Continue with :ref:`tutorial-templates`.116117.. _hashed and salted: https://blog.codinghorror.com/youre-probably-storing-passwords-incorrectly/