Finalzed Python 3 Support

This commit is contained in:
Mohamed ElKalioby
2019-01-23 15:34:47 +03:00
parent 6efd643022
commit 7efd3ccc38
10 changed files with 35 additions and 11 deletions

View File

@@ -12,7 +12,7 @@ from django.conf import settings
from .models import *
from fido2.utils import websafe_decode,websafe_encode
from fido2.ctap2 import AttestedCredentialData
from views import login
from .views import login
import datetime
from django.utils import timezone

View File

@@ -10,7 +10,7 @@ from django.template.context import RequestContext
from django.template.context_processors import csrf
from django.conf import settings
from django.http import HttpResponse
from.models import *
from .models import *
from .views import login
from django.utils import timezone

View File

@@ -1 +1,10 @@
from . import urls
# @property
# def urls():
# import django
# if django.VERSION < (1, 9):
# from .mfa_urls import url_patterns
# return url_patterns, 'mfa', ''
# else:
# from .mfa_urls import url_patterns
# return url_patterns,'mfa'
#

4
mfa/apps.py Normal file
View File

@@ -0,0 +1,4 @@
from django.apps import AppConfig
class myAppNameConfig(AppConfig):
name = 'mfa'
verbose_name = 'A Much Better Name'

View File

@@ -5,8 +5,13 @@ from django.db import models, migrations
import jsonfield.fields
class Migration(migrations.Migration):
def modify_json(apps, schema_editor):
from django.conf import settings
if "mysql" in settings.DATABASES.get("default", {}).get("engine", ""):
migrations.RunSQL("alter table mfa_user_keys modify column properties json;")
class Migration(migrations.Migration):
dependencies = [
('mfa', '0004_user_keys_enabled'),
]
@@ -21,5 +26,5 @@ class Migration(migrations.Migration):
name='properties',
field=jsonfield.fields.JSONField(null=True),
),
migrations.RunSQL("alter table mfa_user_keys modify column properties json;")
migrations.RunPython(modify_json)
]

View File

@@ -18,3 +18,5 @@ class User_Keys(models.Model):
self.properties["signature"]= jwt.encode({"username": self.username, "key": self.properties["key"]}, settings.SECRET_KEY)
super(User_Keys, self).save(force_insert=force_insert, force_update=force_update, using=using, update_fields=update_fields)
class Meta:
app_label='mfa'

View File

@@ -1,6 +1,7 @@
from django.conf.urls import url
from . import views,totp,U2F,TrustedDevice,helpers,FIDO2,Email
from . import views,totp,U2F,TrustedDevice,helpers,FIDO2,Email
app_name='mfa'
urlpatterns = [
url(r'totp/start/', totp.start , name="start_new_otop"),
url(r'totp/getToken', totp.getToken , name="get_new_otop"),

View File

@@ -1,7 +1,10 @@
from django.shortcuts import render,render_to_response
from django.http import HttpResponse,HttpResponseRedirect
from .models import *
from django.core.urlresolvers import reverse
try:
from django.urls import reverse
except:
from django.core.urlresolvers import reverse
from django.template.context_processors import csrf
from django.template.context import RequestContext
from django.conf import settings