~roadmr/canonical-identity-provider/fix-deprecation-warnings-1

« back to all changes in this revision

Viewing changes to src/identityprovider/models/twofactor.py

  • Committer: Tom Wardill
  • Date: 2018-02-14 14:05:59 UTC
  • mfrom: (1602 work)
  • mto: (1597.1.44 django-1.10)
  • mto: This revision was merged to the branch mainline in revision 1603.
  • Revision ID: tom.wardill@canonical.com-20180214140559-ow5txzwy46nopws2
Merge flake8 changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
import logging
7
7
from datetime import timedelta
8
8
 
 
9
from django.conf import settings
9
10
from django.db import models
10
 
from django.conf import settings
 
11
from django.utils.timezone import now
11
12
from django.utils.translation import ugettext_lazy as _
12
 
from django.utils.timezone import now
13
13
from gargoyle import gargoyle
14
14
from oath import accept_hotp, accept_totp, hotp
15
15
 
25
25
 
26
26
def get_otp_type(otp):
27
27
    """Returns the format of otp, return None if not supported"""
28
 
    l = len(otp)
29
 
    if l == 6:
 
28
    length = len(otp)
 
29
    if length == 6:
30
30
        return 'dec6'
31
 
    elif l == 8:
 
31
    elif length == 8:
32
32
        return 'dec8'
33
33
    return None
34
34