Skip to content

Commit

Permalink
Fix a crash
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed Aug 11, 2020
1 parent 8505b5b commit 5e05dd8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ matrix:
- python: 3.8
env: REQ="https://github.com/django/django/archive/master.zip#egg=Django"
- python: 3.8
env: REQ="Django>=3.1rc1,<3.2"
env: REQ="Django>=3.1,<3.2"
- python: 3.7
env: REQ="Django>=3.1rc1,<3.2"
env: REQ="Django>=3.1,<3.2"
- python: 3.6
env: REQ="Django>=3.1rc1,<3.2"
env: REQ="Django>=3.1,<3.2"
- python: 3.7
env: REQ="Django>=3.0,<3.1"
- python: 3.6
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Change log
- Fixed an ``authlib.admin_oauth`` crash when fetching user data fails.
- Replaced ``ugettext*`` with ``gettext*``.
- Replaced ``url()`` with ``re_path()``.
- Fixed a crash when creating ``little_auth`` users with invalid email
addresses.


`0.9`_ (2019-02-09)
Expand Down
2 changes: 1 addition & 1 deletion authlib/little_auth/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


def _obfuscate(email):
user, domain = email.rsplit("@", 1)
user, _sep, domain = email.partition("@")
return "%s%s@***.%s" % (
user[:3],
"***" if len(user) > 3 else "",
Expand Down
5 changes: 5 additions & 0 deletions tests/testapp/test_authlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ def test_login(self):
)
self.assertRedirects(response, "/?login=1", fetch_redirect_response=False)

def test_strange_email(self):
user = User(email="no-email")
self.assertEqual(user.get_full_name(), "no-***@***")
self.assertEqual(str(user), "no-***@***")


class OAuth2Test(TestCase):
def test_oauth2_authorization_redirect(self):
Expand Down

0 comments on commit 5e05dd8

Please sign in to comment.