forked from pallets-eco/flask-security-3.0
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix pallets-eco#806 - Login shouldn't attempt email delivery validati…
…on. (pallets-eco#812) Enpoints that need to actually send email - such as registration, forgot, confirmation continue to use the email_validator that by default checks for proper syntax as well as deliverability. /login no longer does - it just checks for syntax. - Removed a reference to Flask-Mongoengine in docs. - Document API AsaList() - remove pydantic dependency since webauthn has fixed it on their end. - bump package dependency requirements for extras. closes pallets-eco#806
- Loading branch information
Showing
12 changed files
with
110 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,5 @@ requests | |
sqlalchemy | ||
sqlalchemy-utils | ||
webauthn | ||
pydantic<2.0 | ||
werkzeug | ||
zxcvbn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,9 +3,9 @@ babel= | |
babel>=2.12.1 | ||
flask_babel>=3.1.0 | ||
fsqla= | ||
flask_sqlalchemy>=3.0.2 | ||
sqlalchemy>=1.4.35 | ||
sqlalchemy-utils>=0.38.3 | ||
flask_sqlalchemy>=3.0.3 | ||
sqlalchemy>=2.0.12 | ||
sqlalchemy-utils>=0.41.1 | ||
common= | ||
bcrypt>=4.0.1 | ||
flask_mailman>=0.3.0 | ||
|
@@ -14,7 +14,7 @@ mfa= | |
cryptography>=40.0.2 | ||
qrcode>=7.4.2 | ||
phonenumberslite>=8.13.11 | ||
webauthn>=1.8.0 | ||
webauthn>=1.9.0 | ||
|
||
[aliases] | ||
test=pytest | ||
|
@@ -28,7 +28,7 @@ domain = flask_security | |
|
||
[extract_messages] | ||
project= Flask-Security | ||
version=5.2.0 | ||
version=5.3.0 | ||
msgid_bugs_address = [email protected] | ||
mapping-file = babel.ini | ||
output-file = flask_security/translations/flask_security.pot | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,7 @@ | |
ChangePasswordForm, | ||
ConfirmRegisterForm, | ||
EmailField, | ||
EmailValidation, | ||
ForgotPasswordForm, | ||
LoginForm, | ||
PasswordField, | ||
|
@@ -52,7 +53,6 @@ | |
SendConfirmationForm, | ||
StringField, | ||
email_required, | ||
email_validator, | ||
valid_user_email, | ||
) | ||
from flask_security import auth_required, roles_required | ||
|
@@ -124,7 +124,7 @@ class MyRegisterForm(RegisterForm): | |
class MyForgotPasswordForm(ForgotPasswordForm): | ||
email = EmailField( | ||
"My Forgot Email Address Field", | ||
validators=[email_required, email_validator, valid_user_email], | ||
validators=[email_required, EmailValidation(verify=True), valid_user_email], | ||
) | ||
|
||
class MyResetPasswordForm(ResetPasswordForm): | ||
|
@@ -1419,3 +1419,28 @@ def test_multi_app(app, sqlalchemy_datastore): | |
|
||
assert hasattr(security2.forms["register_form"].cls, "username") | ||
assert "username" in security2.user_identity_attributes[1].keys() | ||
|
||
|
||
@pytest.mark.registerable() | ||
def test_login_email_whatever(app, client, get_message): | ||
# login, by default, shouldn't verify email address is deliverable.. | ||
# register etc can/should do that. | ||
app.config["SECURITY_EMAIL_VALIDATOR_ARGS"] = {"check_deliverability": True} | ||
|
||
# register should fail since non-deliverable TLD | ||
data = dict( | ||
email="[email protected]", | ||
password="awesome sunset", | ||
) | ||
response = client.post("/register", json=data) | ||
assert response.status_code == 400 | ||
assert response.json["response"]["errors"][0].encode("utf-8") == get_message( | ||
"INVALID_EMAIL_ADDRESS" | ||
) | ||
|
||
# login should work since we are just checking for identity | ||
response = client.post( | ||
"/login", data=dict(email="[email protected]", password="password") | ||
) | ||
assert response.status_code == 302 | ||
assert "/" in response.location |