mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-12 16:26:12 +01:00
bug fix: 2fa
This commit is contained in:
@@ -104,14 +104,13 @@ def verifyLogin(request):
|
|||||||
|
|
||||||
|
|
||||||
if hashPassword.check_password(admin.password, password):
|
if hashPassword.check_password(admin.password, password):
|
||||||
|
|
||||||
if admin.twoFA:
|
if admin.twoFA:
|
||||||
if request.session['twofa'] == 0:
|
if request.session['twofa'] == 0:
|
||||||
import pyotp
|
import pyotp
|
||||||
totp = pyotp.TOTP(admin.secretKey)
|
totp = pyotp.TOTP(admin.secretKey)
|
||||||
del request.session['twofa']
|
del request.session['twofa']
|
||||||
logging.writeToFile(str(totp.now()))
|
if totp.now() != data['twofa']:
|
||||||
if totp.verify(data['twofa']):
|
request.session['twofa'] = 0
|
||||||
data = {'userID': 0, 'loginStatus': 0, 'error_message': "Invalid verification code."}
|
data = {'userID': 0, 'loginStatus': 0, 'error_message': "Invalid verification code."}
|
||||||
json_data = json.dumps(data)
|
json_data = json.dumps(data)
|
||||||
response.write(json_data)
|
response.write(json_data)
|
||||||
|
|||||||
Reference in New Issue
Block a user