Commit 468b2904 authored by Jean-Baptiste's avatar Jean-Baptiste

update: add registration workflow

parent 24cd5d12
Pipeline #5065 passed with stage
in 28 seconds
......@@ -43,6 +43,20 @@ MIDDLEWARE = [ ..., 'djangoldp_account.auth.middleware.JWTUserMiddleware']
You should also ensure that `SITE_URL` and `BASE_URL` are set correctly.
## User registration
Add these settings on settings.py :
```python
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'you@gmail.com'
EMAIL_HOST_PASSWORD = 'password'
EMAIL_PORT = 587
```
The workflow starts at : http://127.0.0.1:8000/accounts/register/
## Authenticate from an external provider
......
......@@ -34,6 +34,7 @@ urlpatterns = [
permission_classes=getattr(settings, 'USER_PERMISSION_CLASSES', [LDPPermissions]),
nested_fields=user_nested_fields
)),
url(r'^accounts/', include('django_registration.backends.activation.urls')),
url(r'^accounts/', include('django.contrib.auth.urls')),
url(r'^accounts/', LDPViewSet.urls(model=Account, permission_classes=[LDPPermissions])),
url(r'^chat-profile/', LDPViewSet.urls(model=ChatProfile, permission_classes=[LDPPermissions])),
......
{% extends "django_registration/registration_base.html" %}
{% load i18n %}
{% block title %}{% trans "Activation complete" %}{% endblock %}
{% block content %}
{% url 'login' as auth_login_url %}
{% blocktrans %}
Thanks, activation complete! You may now <a href='{{ auth_login_url }}'>login</a> using the username and password you set at registration.
{% endblocktrans %}
{% endblock %}
{% load i18n %}
{% url 'django_registration_activate' activation_key as activation_key_url%}
{% blocktrans with sitename=site.name siteurl=site.domain %}
You (or someone pretending to be you) have asked to register an account at
{{ sitename }}. If this wasn't you, please ignore this email
and your address will be removed from our records.
To activate this account, please click the following link within the next
{{ expiration_days }} days:
http://{{ siteurl }}{{ activation_key_url }}
Sincerely,
{{ sitename }} Management
{% endblocktrans %}
{% load i18n %}{% blocktrans with sitename=site.name %}Account registration for {{ sitename }}{% endblocktrans %}
User activation failed. Please contact {{ sitename }} for more information.
{% comment %}
TODO: Add more info from the activation_error dict.
See https://django-registration.readthedocs.io/en/3.0/quickstart.html#django-registration-activation-failed-html
{% endcomment %}
{% extends "django_registration/registration_base.html" %}
{% load i18n %}
{% block title %}{% trans "Registration closed" %}{% endblock %}
{% block content %}
{% blocktrans %}Registration is closed for this site.{% endblocktrans %}
{% endblock %}
{% extends "django_registration/registration_base.html" %}
{% load i18n %}
{% block title %}{% trans "Activation email sent" %}{% endblock %}
{% block content %}
{% blocktrans %}An activation email has been sent.
Please check your email and click on the link to activate your account.{% endblocktrans %}
{% endblock %}
{% extends "django_registration/registration_base.html" %}
{% load i18n %}
{% block title %}{% trans "Register for an account" %}{% endblock %}
{% block content %}
<table>
<form method='post' action=''>{% csrf_token %}
{{ form }}
<tr><td></td><td><input type="submit" value="{% trans "Send activation email" %}" /></td>
</form>
</table>
{% endblock %}
......@@ -12,6 +12,7 @@ include_package_data = True
packages = find:
install_requires =
djangoldp~=0.5
django_registration~=3.0.1
validators~=0.12
oic~=0.15
django-oidc-provider==0.6.2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment