diff --git a/ofu_app/core/settings.py b/ofu_app/core/settings.py index 7ad5c41..64e121f 100755 --- a/ofu_app/core/settings.py +++ b/ofu_app/core/settings.py @@ -43,6 +43,7 @@ INSTALLED_APPS = [ 'apps.registration', 'rest_framework', 'rest_framework.authtoken', + 'djoser', 'analytical', 'corsheaders', ] @@ -50,9 +51,14 @@ INSTALLED_APPS = [ SITE_ID = 1 REST_FRAMEWORK = { + 'DEFAULT_AUTHENTICATION_CLASSES': ( + 'rest_framework.authentication.BasicAuthentication', + 'rest_framework.authentication.SessionAuthentication', + 'rest_framework.authentication.TokenAuthentication', + ), 'DEFAULT_PERMISSION_CLASSES': [ 'rest_framework.permissions.IsAuthenticated', - 'rest_framework.authentication.TokenAuthentication' + 'rest_framework.authentication.TokenAuthentication', ], } MIDDLEWARE = [ @@ -232,3 +238,17 @@ CORS_ORIGIN_ALLOW_ALL = False CORS_ORIGIN_WHITELIST = ( 'localhost:3000', ) + +DJOSER = { + 'SEND_ACTIVATION_EMAIL': True, + 'PASSWORD_RESET_CONFIRM_URL': '/#/password-reset/confirm/{uid}/{token}', + 'PASSWORD_RESET_SHOW_EMAIL_NOT_FOUND': True, + # re_new_password + 'PASSWORD_RESET_CONFIRM_RETYPE': True, + 'SET_PASSWORD_RETYPE': True, + 'ACTIVATION_URL': '/#/activation/{uid}/{token}', +} + +# TODO: env vars +DOMAIN = 'localhost:3000' +SITE_NAME = 'BaStA' diff --git a/ofu_app/core/urls.py b/ofu_app/core/urls.py index 75d6b51..c48cc98 100755 --- a/ofu_app/core/urls.py +++ b/ofu_app/core/urls.py @@ -13,6 +13,7 @@ Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ + from core import views from django.conf.urls import url, include from django.contrib import admin @@ -59,5 +60,6 @@ urlpatterns = [ # -- Third Party APIs url(r'^api/auth/', include('rest_framework.urls', namespace='rest_framework')), - url(r'^api/token-auth/', token_auth_views.obtain_auth_token), + url(r'^api/token-auth/', include('djoser.urls')), + url(r'^api/token-auth/', include('djoser.urls.authtoken')), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/ofu_app/requirements.txt b/ofu_app/requirements.txt index b5750cc..5f14e65 100644 --- a/ofu_app/requirements.txt +++ b/ofu_app/requirements.txt @@ -11,4 +11,4 @@ beautifulsoup4==4.6.0 xmltodict==0.11.0 coverage==3.6 django-cors-headers - +djoser==1.1.5 \ No newline at end of file