diff --git a/requirements.txt b/requirements.txt index 703b030bd945c2f94fa89580ebfc99a7d84837a4..180909790320ec800cbf5187857b28f76a42eaa7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ coverage==5.2.1 Django==3.0.7 django-cors-headers==3.4.0 django-filter==2.3.0 -django-graphql-auth==0.3.11 +django-graphql-auth==0.3.14 django-graphql-jwt==0.3.1 freezegun==1.0.0 graphene-django==2.10.1 diff --git a/sizakat/settings.py b/sizakat/settings.py index cd1d75ee82cae97b18009b518e572e5f93a9a363..54484a9aec4b2f9fde06ec0c7c943ae98e6f2996 100644 --- a/sizakat/settings.py +++ b/sizakat/settings.py @@ -15,7 +15,6 @@ import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ @@ -27,6 +26,8 @@ DEBUG = os.environ.get("DEBUG", False) ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS').split() +FRONTEND_BASE_URL = os.environ.get('FRONTEND_BASE_URL', 'http://localhost:3000') + # Application definition @@ -58,15 +59,14 @@ MIDDLEWARE = [ 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] -CORS_ORIGIN_WHITELIST = os.environ.get( - 'CORS_ORIGIN_WHITELIST', 'http://localhost:3000').split() +CORS_ORIGIN_WHITELIST = os.environ.get('CORS_ORIGIN_WHITELIST', FRONTEND_BASE_URL).split() ROOT_URLCONF = 'sizakat.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [os.path.join(BASE_DIR, "templates")], + 'DIRS': [os.path.join(BASE_DIR, 'sizakat', 'templates')], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ @@ -202,3 +202,13 @@ GRAPHQL_JWT = { 'JWT_VERIFY_EXPIRATION': True, 'JWT_LONG_RUNNING_REFRESH_TOKEN': True, } + + +# Django GraphQL Auth +# https://django-graphql-auth.readthedocs.io/en/latest/settings/ + +GRAPHQL_AUTH = { + 'EMAIL_TEMPLATE_VARIABLES': { + 'frontend_base_url': FRONTEND_BASE_URL, + } +} diff --git a/sizakat/templates/email/activation_email.html b/sizakat/templates/email/activation_email.html new file mode 100644 index 0000000000000000000000000000000000000000..518f359bd465bf06a70c2bf99065de35a157156a --- /dev/null +++ b/sizakat/templates/email/activation_email.html @@ -0,0 +1,7 @@ +<p>Assalamu'alaikum warrahmatullah wabarakatuh.</p> + +<p>Bapak/Ibu dapat mengaktifkan akun {{ user.username }} di Aplikasi SIZAKAT dengan klik link berikut:</p> + +<p>{{ frontend_base_url }}/{{ path }}/{{ token }}.</p> + +<p>Jazaakumullahu Khoiron.</p> diff --git a/sizakat/templates/email/activation_subject.txt b/sizakat/templates/email/activation_subject.txt new file mode 100644 index 0000000000000000000000000000000000000000..56cb27f2fb44e793cb84540ae6e0085f420ae615 --- /dev/null +++ b/sizakat/templates/email/activation_subject.txt @@ -0,0 +1 @@ +[PENGAKTIFKAN AKUN SIZAKAT] diff --git a/sizakat/templates/email/password_reset_email.html b/sizakat/templates/email/password_reset_email.html new file mode 100644 index 0000000000000000000000000000000000000000..900eca05e79cb507fb0bdc05f8696047a2a66a0d --- /dev/null +++ b/sizakat/templates/email/password_reset_email.html @@ -0,0 +1,7 @@ +<p>Assalamu'alaikum warrahmatullah wabarakatuh.</p> + +<p>Bapak/Ibu dapat membuat ulang password untuk akun {{ user.username }} di Aplikasi SIZAKAT dengan klik link berikut:</p> + +<p>{{ frontend_base_url }}/{{ path }}/{{ token }}</p> + +<p>Jazaakumullahu Khoiron.</p> diff --git a/sizakat/templates/email/password_reset_subject.txt b/sizakat/templates/email/password_reset_subject.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7e7ffdc2ea0431408708ec314ac646821b1717b --- /dev/null +++ b/sizakat/templates/email/password_reset_subject.txt @@ -0,0 +1 @@ +[RESET PASSWORD SIZAKAT]