lint: fix boolean expressions
This commit is contained in:
@@ -177,7 +177,7 @@ def authenticate_complete(request):
|
||||
request.session["mfa"] = mfa
|
||||
if not request.user.is_authenticated:
|
||||
res = login(request)
|
||||
if not "location" in res:
|
||||
if "location" not in res:
|
||||
return reset_cookie(request)
|
||||
return JsonResponse(
|
||||
{"status": "OK", "redirect": res["location"]}
|
||||
|
||||
@@ -117,7 +117,7 @@ def start(request):
|
||||
td.save()
|
||||
request.session["td_id"] = td.id
|
||||
try:
|
||||
if td == None:
|
||||
if td is None:
|
||||
td = User_Keys.objects.get(id=request.session["td_id"])
|
||||
context = {"key": td.properties["key"]}
|
||||
except:
|
||||
|
||||
@@ -36,7 +36,7 @@ def recheck(request):
|
||||
|
||||
def process_recheck(request):
|
||||
x = validate(request, request.user.username)
|
||||
if x == True:
|
||||
if x is True:
|
||||
request.session["mfa"]["rechecked_at"] = time.time()
|
||||
return JsonResponse({"recheck": True})
|
||||
return x
|
||||
@@ -57,7 +57,7 @@ def validate(request, username):
|
||||
data = simplejson.loads(request.POST["response"])
|
||||
|
||||
res = check_errors(request, data)
|
||||
if res != True:
|
||||
if res is not True:
|
||||
return res
|
||||
|
||||
challenge = request.session.pop("_u2f_challenge_")
|
||||
@@ -135,7 +135,7 @@ def sign(username):
|
||||
|
||||
def verify(request):
|
||||
x = validate(request, request.session["base_username"])
|
||||
if x == True:
|
||||
if x is True:
|
||||
return login(request)
|
||||
else:
|
||||
return x
|
||||
|
||||
@@ -72,7 +72,7 @@ def delKey(request):
|
||||
|
||||
|
||||
def __get_callable_function__(func_path):
|
||||
if not "." in func_path:
|
||||
if "." not in func_path:
|
||||
raise Exception("class Name should include modulename.classname")
|
||||
|
||||
parsed_str = func_path.split(".")
|
||||
@@ -90,7 +90,7 @@ def toggleKey(request):
|
||||
q = User_Keys.objects.filter(username=request.user.username, id=id)
|
||||
if q.count() == 1:
|
||||
key = q[0]
|
||||
if not key.key_type in settings.MFA_HIDE_DISABLE:
|
||||
if key.key_type not in settings.MFA_HIDE_DISABLE:
|
||||
key.enabled = not key.enabled
|
||||
key.save()
|
||||
return HttpResponse("OK")
|
||||
|
||||
Reference in New Issue
Block a user