GithubHelp home page GithubHelp logo

miguelgrinberg / two-factor-auth-flask Goto Github PK

View Code? Open in Web Editor NEW
145.0 12.0 52.0 14 KB

Example application for my "Two Factor Authentication with Flask" blog article.

Home Page: http://blog.miguelgrinberg.com/post/two-factor-authentication-with-flask

License: MIT License

Python 65.01% HTML 34.99%

two-factor-auth-flask's Introduction

Two Factor Authentication with Flask

This repository contains the example application for my Two Factor Authentication with Flask blog article.

Installation

To install your application on your computer follow these steps:

  1. Clone this repository.
  2. Create a virtual environment and activate it.
  3. Run pip install -r requirements.txt to import all the dependencies.
  4. Run the application with python app.py.
  5. Go to http://localhost:5000 in your address bar to connect to the application.

See my blog post for detailed information on how this application works.

two-factor-auth-flask's People

Contributors

dependabot[bot] avatar miguelgrinberg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

two-factor-auth-flask's Issues

No module named _winreg

  • Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
    • Restarting with stat
      Traceback (most recent call last):
      File "app.py", line 181, in
      app.run(host='0.0.0.0', debug=True)
      File "/usr/lib/python2.7/dist-packages/flask/app.py", line 772, in run
      run_simple(host, port, self, **options)
      File "/usr/local/lib/python2.7/dist-packages/werkzeug/serving.py", line 622, in run_simple
      reloader_type)
      File "/usr/local/lib/python2.7/dist-packages/werkzeug/_reloader.py", line 269, in run_with_reloader
      reloader.run()
      File "/usr/local/lib/python2.7/dist-packages/werkzeug/_reloader.py", line 159, in run
      for filename in chain(_iter_module_files(), self.extra_files):
      File "/usr/local/lib/python2.7/dist-packages/werkzeug/_reloader.py", line 70, in _iter_module_files
      for package_path in getattr(module, 'path', ()):
      File "/usr/lib/python2.7/dist-packages/six.py", line 116, in getattr
      _module = self._resolve()
      File "/usr/lib/python2.7/dist-packages/six.py", line 105, in _resolve
      return _import_module(self.mod)
      File "/usr/lib/python2.7/dist-packages/six.py", line 76, in _import_module
      import(name)
      ImportError: No module named _winreg

If error happens the user is added but you can't access

Hi, Miguel. Thank you for this.

I see a problem here.

When you are in development environment some errors may occur, and if something goes wrong at the time you use the register form, the user will be added but no qr code will be showed.

Another thing here is, I'm trying to add some validation for deleting the session username, cause for any reason the page could be reloaded and, again, the user will be added and you won't get access to this added account. Any advice here?

MarkupSafe throws error. Upgrading to newer version fixes it.

pip install -r requirements.txt throws this error on macOS Big Sur:

 ERROR: Command errored out with exit status 1:
     command: /Users/wschrep/pythonWork/two-factor-auth-flask/python_env/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/68/c_pd8_vj55d9mdvv3mvllkh00000gn/T/pip-install-6ogd9rqk/MarkupSafe/setup.py'"'"'; __file__='"'"'/private/var/folders/68/c_pd8_vj55d9mdvv3mvllkh00000gn/T/pip-install-6ogd9rqk/MarkupSafe/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/68/c_pd8_vj55d9mdvv3mvllkh00000gn/T/pip-pip-egg-info-ow2onn_4
         cwd: /private/var/folders/68/c_pd8_vj55d9mdvv3mvllkh00000gn/T/pip-install-6ogd9rqk/MarkupSafe/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/68/c_pd8_vj55d9mdvv3mvllkh00000gn/T/pip-install-6ogd9rqk/MarkupSafe/setup.py", line 6, in <module>
        from setuptools import setup, Extension, Feature
    ImportError: cannot import name 'Feature' from 'setuptools' (/Users/wschrep/pythonWork/two-factor-auth-flask/python_env/lib/python3.8/site-packages/setuptools/__init__.py)

Just changing this 1 line in requirements.txt to newer version of markupsafe fixes it for me. Maybe it can help others or maybe it can be changed in this repo? :

MarkupSafe==1.1.1

Other than that everything works great. I tested it with google authenticator app (instead of freeotp) that is suggested with an iphone and it also totally worked. Thanks for this nice example!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.