mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-12-28 14:05:41 +00:00
Replace onetimepass with pyotp
pyotp is more common and better maintained Signed-off-by: Felix Kaechele <felix@kaechele.ca>
This commit is contained in:
parent
8118ed0a75
commit
9b8c85c5c1
@ -6,7 +6,7 @@ import bcrypt
|
|||||||
import urlparse
|
import urlparse
|
||||||
import itertools
|
import itertools
|
||||||
import traceback
|
import traceback
|
||||||
import onetimepass
|
import pyotp
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from distutils.version import StrictVersion
|
from distutils.version import StrictVersion
|
||||||
@ -111,7 +111,8 @@ class User(db.Model):
|
|||||||
return 'otpauth://totp/PowerDNS-Admin:%s?secret=%s&issuer=PowerDNS-Admin' % (self.username, self.otp_secret)
|
return 'otpauth://totp/PowerDNS-Admin:%s?secret=%s&issuer=PowerDNS-Admin' % (self.username, self.otp_secret)
|
||||||
|
|
||||||
def verify_totp(self, token):
|
def verify_totp(self, token):
|
||||||
return onetimepass.valid_totp(token, self.otp_secret)
|
totp = pyotp.TOTP(self.otp_secret)
|
||||||
|
return totp.verify(int(token))
|
||||||
|
|
||||||
def get_hashed_password(self, plain_text_password=None):
|
def get_hashed_password(self, plain_text_password=None):
|
||||||
# Hash a password for the first time
|
# Hash a password for the first time
|
||||||
|
@ -8,7 +8,7 @@ python-ldap==2.4.21
|
|||||||
Flask-SQLAlchemy==2.1
|
Flask-SQLAlchemy==2.1
|
||||||
SQLAlchemy==1.0.9
|
SQLAlchemy==1.0.9
|
||||||
sqlalchemy-migrate==0.10.0
|
sqlalchemy-migrate==0.10.0
|
||||||
onetimepass==1.0.1
|
pyotp==2.2.1
|
||||||
PyQRCode==1.2
|
PyQRCode==1.2
|
||||||
Flask-OAuthlib==0.9.3
|
Flask-OAuthlib==0.9.3
|
||||||
dnspython>=1.12.0
|
dnspython>=1.12.0
|
||||||
|
Loading…
Reference in New Issue
Block a user