Skip to content
This repository was archived by the owner on Jul 30, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
915b1b4
Security two factor authentication feature
galstat88 Jun 1, 2016
eb6e673
fix double import and unused import, revert get_user
TillerBurr May 7, 2019
8befa63
Merge branch 'develop1' into develop
TillerBurr May 7, 2019
794faea
syntax error
May 8, 2019
3eebb5f
fix missing setup.py install_requires
May 8, 2019
ab07db1
fix TestMail (remove __init_)
May 8, 2019
4e1b9cb
verify_and_update_password fix
May 8, 2019
cf617fd
formatting
May 8, 2019
0f23a50
more formatting
May 8, 2019
09e9c69
too many blank lines
May 8, 2019
9cfa47d
double imports in forms.py
May 8, 2019
6a932b0
formatting forms.py
May 8, 2019
9fa6005
signals line length
May 8, 2019
117a0e1
twofactor formatting
May 8, 2019
46c77af
utils formatting
May 8, 2019
0944672
update twilio client import
May 8, 2019
d1f854d
missing import
May 8, 2019
f8c00ec
blueprint line length (twofactor)
May 8, 2019
1d1578c
trailing whitespace...
May 8, 2019
47a5cd5
line too long/import/authors inadv. deleted
May 9, 2019
948d248
TillerBurr May 10, 2019
a2c82c8
update install_requires in setup.py
May 10, 2019
d7d0cb4
bump flask_sqlalchemy
May 10, 2019
5076a3c
conftest.py allow nulls in sqlalchemy
May 10, 2019
176b8ca
Spelling, Update Functions and Tests Python 3.7 Support
TillerBurr May 13, 2019
a9feee7
Update docs/configuration.rst
TillerBurr May 28, 2019
185fcbc
consistent two-factor
TillerBurr May 28, 2019
148f866
.gitignore .venv/
TillerBurr May 28, 2019
3b90197
fixes. passlib.totp, if not request.is_json
TillerBurr May 28, 2019
0b0c366
translation stubs for new messages
TillerBurr May 28, 2019
4a766a1
Make two-factor login more JSON friendly
TillerBurr May 28, 2019
4f909eb
make pyqrcode and onetimepass optional, check imps
TillerBurr May 30, 2019
7ef9003
fix function def and import
TillerBurr May 30, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
line too long/import/authors inadv. deleted
  • Loading branch information
tbaur committed May 9, 2019
commit 47a5cd550ab22f7748cf00c17fb6ed54303fa7df
2 changes: 2 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,6 @@ Tristan Escalada
Vadim Kotov
Walt Askew
John Paraskevopoulos
Gal Stainfeld
Ivan Piskunov
Tyler Baur
14 changes: 7 additions & 7 deletions flask_security/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import inspect

from flask import Markup, current_app, flash, request
from flask import Markup, current_app, request
from flask import session, abort
from wtforms import BooleanField, Field, HiddenField, PasswordField, \
StringField, SubmitField, ValidationError, validators, RadioField
Expand All @@ -22,7 +22,7 @@

from .confirmable import requires_confirmation
from .utils import _, _datastore, config_value, get_message, hash_password, \
localize_callback, url_for_security, validate_redirect_url
localize_callback, url_for_security, validate_redirect_url, do_flash
from .twofactor import verify_totp

lazy_gettext = make_lazy_gettext(lambda: localize_callback)
Expand Down Expand Up @@ -141,7 +141,7 @@ class NextFormMixin():
def validate_next(self, field):
if field.data and not validate_redirect_url(field.data):
field.data = ''
flash(*get_message('INVALID_REDIRECT'))
do_flash(*get_message('INVALID_REDIRECT'))
raise ValidationError(get_message('INVALID_REDIRECT')[0])


Expand Down Expand Up @@ -322,7 +322,7 @@ def __init__(self, *args, **kwargs):
def validate(self):
if 'setup' not in self.data or self.data['setup']\
not in config_value('TWO_FACTOR_ENABLED_METHODS'):
flash(*get_message('TWO_FACTOR_METHOD_NOT_AVAILABLE'))
do_flash(*get_message('TWO_FACTOR_METHOD_NOT_AVAILABLE'))
return False

return True
Expand Down Expand Up @@ -358,7 +358,7 @@ def validate(self):
if not verify_totp(token=self.code.data,
totp_secret=session['totp_secret'],
window=self.window):
flash(*get_message('TWO_FACTOR_INVALID_TOKEN'))
do_flash(*get_message('TWO_FACTOR_INVALID_TOKEN'))
return False

return True
Expand All @@ -372,7 +372,7 @@ class TwoFactorChangeMethodVerifyPasswordForm(Form, PasswordFormMixin):
def validate(self):
if not super(TwoFactorChangeMethodVerifyPasswordForm,
self).validate():
flash(*get_message('INVALID_PASSWORD'))
do_flash(*get_message('INVALID_PASSWORD'))
return False
if 'email' in session:
self.user = _datastore.find_user(email=session['email'])
Expand Down Expand Up @@ -406,7 +406,7 @@ def validate(self):
self.user = _datastore.find_user(email=session['email'])

if 'primary_method' not in session or 'totp_secret' not in session:
flash(*get_message('TWO_FACTOR_PERMISSION_DENIED'))
do_flash(*get_message('TWO_FACTOR_PERMISSION_DENIED'))
return False

return True
3 changes: 2 additions & 1 deletion flask_security/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,8 @@ def two_factor_login():
session['has_two_factor'] = True
session['primary_method'] = user.two_factor_primary_method
session['totp_secret'] = user.totp_secret
send_security_token(user=user, method=user.two_factor_primary_method,
send_security_token(user=user,
method=user.two_factor_primary_method,
totp_secret=user.totp_secret)
return redirect(url_for('two_factor_token_validation'))

Expand Down