Skip to content
This repository has been archived by the owner on May 5, 2020. It is now read-only.

Commit

Permalink
fix: Use timezone.now() instead of datetime.now()
Browse files Browse the repository at this point in the history
  • Loading branch information
rubengrill authored and relekang committed Sep 14, 2018
1 parent 2559624 commit cf22def
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nopassword/backends/base.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta
from datetime import timedelta

from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.auth.backends import ModelBackend
from django.utils import timezone

from nopassword.models import LoginCode

Expand All @@ -24,7 +25,7 @@ def authenticate(self, request, username=None, code=None, **kwargs):
return

timeout = getattr(settings, 'NOPASSWORD_LOGIN_CODE_TIMEOUT', 900)
timestamp = datetime.now() - timedelta(seconds=timeout)
timestamp = timezone.now() - timedelta(seconds=timeout)

# We don't delete the login code when authenticating,
# as that is done during validation of the login form
Expand Down

0 comments on commit cf22def

Please sign in to comment.