sanic-security 1.15.1__py3-none-any.whl → 1.15.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
sanic_security/models.py CHANGED
@@ -198,7 +198,7 @@ class Account(BaseModel):
198
198
  NotFoundError
199
199
  """
200
200
  try:
201
- return await Account.filter(email=email, deleted=False).get()
201
+ return await Account.filter(email=email.lower(), deleted=False).get()
202
202
  except (DoesNotExist, ValidationError):
203
203
  raise NotFoundError("Account with this email does not exist.")
204
204
 
@@ -506,7 +506,7 @@ class VerificationSession(Session):
506
506
  """
507
507
 
508
508
  attempts: int = fields.IntField(default=0)
509
- code: str = fields.CharField(max_length=6, default=get_code, null=True)
509
+ code: str = fields.CharField(max_length=6, null=True)
510
510
 
511
511
  async def check_code(self, code: str) -> None:
512
512
  """
@@ -542,10 +542,6 @@ class VerificationSession(Session):
542
542
  class TwoStepSession(VerificationSession):
543
543
  """Validates a client using a code sent via email or text."""
544
544
 
545
- code: str = fields.CharField(
546
- max_length=6, default=lambda: get_code(True), null=True
547
- )
548
-
549
545
  @classmethod
550
546
  async def new(cls, request: Request, account: Account, **kwargs):
551
547
  return await cls.create(
@@ -555,6 +551,7 @@ class TwoStepSession(VerificationSession):
555
551
  expiration_date=get_expiration_date(
556
552
  security_config.TWO_STEP_SESSION_EXPIRATION
557
553
  ),
554
+ code=get_code(True),
558
555
  )
559
556
 
560
557
  class Meta:
@@ -569,6 +566,7 @@ class CaptchaSession(VerificationSession):
569
566
  return await cls.create(
570
567
  **kwargs,
571
568
  ip=get_ip(request),
569
+ code=get_code(),
572
570
  expiration_date=get_expiration_date(
573
571
  security_config.CAPTCHA_SESSION_EXPIRATION
574
572
  ),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sanic-security
3
- Version: 1.15.1
3
+ Version: 1.15.2
4
4
  Summary: An async security library for the Sanic framework.
5
5
  Author-email: Aidan Stewart <me@na-stewart.com>
6
6
  Project-URL: Documentation, https://security.na-stewart.com/
@@ -3,14 +3,14 @@ sanic_security/authentication.py,sha256=3Pit1B4PN_MRvwAlhYPHl_6DGD9JVpdPjgjiyKQJ
3
3
  sanic_security/authorization.py,sha256=jAxfDT9cHN_zpMKcA3oYFZ5Eu2KItnMJZ7oPcqmMwrw,7537
4
4
  sanic_security/configuration.py,sha256=_E66ts5g9t_XHW9ZAnr48rWVcZmGNu_DWGDxm_AVVWE,5681
5
5
  sanic_security/exceptions.py,sha256=9zISLyAvP6qN8sNR8e5qxKP__FA4NLIXCun_fEKndOw,5297
6
- sanic_security/models.py,sha256=TytuQTjfKslPr893-mCYSzsRK7gfJtXmDz656iCCM0k,22530
6
+ sanic_security/models.py,sha256=1gMoPnzA9cpJaZXJ1GtgAzsXxGO-rts-f3YyVgcd7lY,22475
7
7
  sanic_security/utils.py,sha256=Il5MjFzVe975yx_CV2HV_LVQYl2W3XYDRGtCG5CQA8Q,3531
8
8
  sanic_security/verification.py,sha256=9bi8-NZ8GE3rcuELZ63yh18zDg8RxvxGPkhAu5SzLn0,8692
9
9
  sanic_security/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  sanic_security/test/server.py,sha256=RjL9Kfvkfqpm5TXWwFQKKa0J4hfTKgwI6U0s_TAKO8w,11984
11
11
  sanic_security/test/tests.py,sha256=bW5fHJfsCrg8eBmcSqVMLm0R5XRL1ou-XJJRgz09GOE,21993
12
- sanic_security-1.15.1.dist-info/LICENSE,sha256=sXlJs9_mG-dCkPfWsDnuzydJWagS82E2gYtkVH9enHA,1100
13
- sanic_security-1.15.1.dist-info/METADATA,sha256=EINxdSgG_LLkPu3QqXo1CMe_-GTQk5QDhO3b3909quI,23247
14
- sanic_security-1.15.1.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
15
- sanic_security-1.15.1.dist-info/top_level.txt,sha256=ZybkhHXSjfzhmv8XeqLvnNmLmv21Z0oPX6Ep4DJN8b0,15
16
- sanic_security-1.15.1.dist-info/RECORD,,
12
+ sanic_security-1.15.2.dist-info/LICENSE,sha256=sXlJs9_mG-dCkPfWsDnuzydJWagS82E2gYtkVH9enHA,1100
13
+ sanic_security-1.15.2.dist-info/METADATA,sha256=PNjYIu36zcUqehxfO0Zg7X98CwHSzGbPc1FYXsXo7qs,23247
14
+ sanic_security-1.15.2.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
15
+ sanic_security-1.15.2.dist-info/top_level.txt,sha256=ZybkhHXSjfzhmv8XeqLvnNmLmv21Z0oPX6Ep4DJN8b0,15
16
+ sanic_security-1.15.2.dist-info/RECORD,,