Skip to content

Commit

Permalink
Attribute revision
Browse files Browse the repository at this point in the history
  • Loading branch information
na-stewart committed Dec 4, 2024
1 parent 6da9307 commit 7751f92
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions sanic_security/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ class VerificationSession(Session):
"""

attempts: int = fields.IntField(default=0)
code: str = fields.CharField(max_length=6, default=get_code, null=True)
code: str = fields.CharField(max_length=6, null=True)

async def check_code(self, code: str) -> None:
"""
Expand Down Expand Up @@ -542,10 +542,6 @@ class Meta:
class TwoStepSession(VerificationSession):
"""Validates a client using a code sent via email or text."""

code: str = fields.CharField(
max_length=6, default=lambda: get_code(True), null=True
)

@classmethod
async def new(cls, request: Request, account: Account, **kwargs):
return await cls.create(
Expand All @@ -555,6 +551,7 @@ async def new(cls, request: Request, account: Account, **kwargs):
expiration_date=get_expiration_date(
security_config.TWO_STEP_SESSION_EXPIRATION
),
code=get_code(True),
)

class Meta:
Expand All @@ -569,6 +566,7 @@ async def new(cls, request: Request, **kwargs):
return await cls.create(
**kwargs,
ip=get_ip(request),
code=get_code(),
expiration_date=get_expiration_date(
security_config.CAPTCHA_SESSION_EXPIRATION
),
Expand Down

0 comments on commit 7751f92

Please sign in to comment.