Skip to content

Commit 50c7078

Browse files
authored
Merge pull request doccano#250 from guillim/authentification
Authentification
2 parents 1c4894a + 7298650 commit 50c7078

33 files changed

+510
-3
lines changed

.coveragerc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ omit =
77
app/server/tests/*
88
app/api/migrations/*
99
app/api/tests/*
10+
app/authentification/tests/*
11+
app/authentification/templatetags/*
1012

1113
exclude_lines =
1214
pragma: no cover

app.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
"description": "Debug mode or not.",
3030
"required": false,
3131
"value": "False"
32+
},
33+
"ALLOW_SIGNUP": {
34+
"description": "Allow users to signup themselves or not",
35+
"required": false,
36+
"value": "True"
3237
}
3338
},
3439
"scripts": {

app/app/settings.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
# SECURITY WARNING: don't run with debug turned on in production!
3636
DEBUG = env.bool('DEBUG', True)
3737

38+
# True if you want to allow users to be able to create an account
39+
ALLOW_SIGNUP = env.bool('ALLOW_SIGNUP', True)
40+
3841
# ALLOWED_HOSTS = []
3942

4043

@@ -85,7 +88,7 @@
8588
TEMPLATES = [
8689
{
8790
'BACKEND': 'django.template.backends.django.DjangoTemplates',
88-
'DIRS': [path.join(BASE_DIR, 'server/templates')],
91+
'DIRS': [path.join(BASE_DIR, 'server/templates'), path.join(BASE_DIR, 'authentification/templates')],
8992
'APP_DIRS': True,
9093
'OPTIONS': {
9194
'context_processors': [
@@ -98,6 +101,7 @@
98101
],
99102
'libraries': {
100103
'analytics': 'server.templatetags.analytics',
104+
'utils_templating': 'authentification.templatetags.utils_templating',
101105
},
102106
},
103107
},
@@ -266,3 +270,13 @@
266270
APPLICATION_INSIGHTS = {
267271
'ikey': AZURE_APPINSIGHTS_IKEY if AZURE_APPINSIGHTS_IKEY else None,
268272
}
273+
274+
## necessary for email verification setup
275+
# EMAIL_USE_TLS = True
276+
# EMAIL_HOST = 'smtp.gmail.com'
277+
# EMAIL_HOST_USER = '[email protected]'
278+
# EMAIL_HOST_PASSWORD = 'gfds6jk#4ljIr%G8%'
279+
# EMAIL_PORT = 587
280+
#
281+
## During development only
282+
# EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

app/app/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222

2323
urlpatterns = [
24+
path('', include('authentification.urls')),
2425
path('', include('server.urls')),
2526
path('admin/', admin.site.urls),
2627
path('social/', include('social_django.urls')),

app/authentification/__init__.py

Whitespace-only changes.

app/authentification/admin.py

Whitespace-only changes.

app/authentification/forms.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from django import forms
2+
from django.contrib.auth.forms import UserCreationForm
3+
from django.contrib.auth import get_user_model
4+
5+
User = get_user_model()
6+
7+
class SignupForm(UserCreationForm):
8+
email = forms.EmailField(max_length=200, help_text='Required')
9+
10+
class Meta:
11+
model = User
12+
fields = ('username', 'email', 'password1', 'password2')

app/authentification/models.py

Whitespace-only changes.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{% autoescape off %}
2+
Hi {{ user.username }},
3+
Please click on the link to confirm your email,
4+
http://{{ domain }}{% url 'activate' uidb64=uid token=token %}
5+
{% endautoescape %}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{% extends 'base.html' %}
2+
3+
{% block content %}
4+
<div class="hero-body">
5+
<div class="container">
6+
<div class="card is-shady column is-4 is-offset-4">
7+
{% block content_auth %}{% endblock %}
8+
</div>
9+
</div>
10+
</div>
11+
{% endblock %}

0 commit comments

Comments
 (0)