├── myproject ├── __init__.py ├── core │ ├── __init__.py │ ├── migrations │ │ └── __init__.py │ ├── static │ │ ├── css │ │ │ ├── style.css │ │ │ ├── form.css │ │ │ └── icons │ │ │ │ └── simple-line-icons.min.css │ │ ├── fonts │ │ │ ├── gijgo-material.eot │ │ │ ├── gijgo-material.ttf │ │ │ ├── gijgo-material.woff │ │ │ ├── Simple-Line-Icons.eot │ │ │ ├── Simple-Line-Icons.ttf │ │ │ ├── Simple-Line-Icons.woff │ │ │ ├── Simple-Line-Icons.woff2 │ │ │ └── gijgo-material.svg │ │ ├── img │ │ │ └── django-logo-negative.png │ │ └── js │ │ │ ├── popper.min.js │ │ │ └── bootstrap.min.js │ ├── models.py │ ├── admin.py │ ├── tests.py │ ├── apps.py │ ├── urls.py │ ├── views.py │ └── templates │ │ ├── index.html │ │ ├── nav.html │ │ ├── base.html │ │ └── base_login.html ├── accounts │ ├── __init__.py │ ├── migrations │ │ ├── __init__.py │ │ ├── 0002_alter_profile_id.py │ │ └── 0001_initial.py │ ├── templates │ │ ├── registration │ │ │ ├── password_reset_subject.txt │ │ │ ├── password_reset_complete.html │ │ │ ├── password_reset_email.html │ │ │ ├── password_change_done.html │ │ │ ├── password_reset_done.html │ │ │ ├── password_change_form.html │ │ │ ├── password_reset_form.html │ │ │ └── password_reset_confirm.html │ │ ├── email │ │ │ └── account_activation_email.html │ │ └── accounts │ │ │ ├── account_activation_done.html │ │ │ ├── signup_email_form.html │ │ │ ├── login.html │ │ │ └── signup.html │ ├── tests.py │ ├── apps.py │ ├── admin.py │ ├── tokens.py │ ├── models.py │ ├── urls.py │ ├── forms.py │ └── views.py ├── urls.py ├── asgi.py ├── wsgi.py └── settings.py ├── img ├── youtube.png ├── 01_login.png ├── 02_signup.png ├── 102_signup.png ├── 101_login_logout.png ├── 03_change_password.png ├── 04_forgot_password.png ├── 103_change_password.png └── 104_reset_password.png ├── requirements.txt ├── manage.py ├── contrib └── env_gen.py ├── .gitignore ├── README.md └── passo-a-passo.md /myproject/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /myproject/core/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /myproject/accounts/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /myproject/core/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /myproject/accounts/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /myproject/core/static/css/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin-top: 60px; 3 | } -------------------------------------------------------------------------------- /img/youtube.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rg3915/django-auth-tutorial/main/img/youtube.png -------------------------------------------------------------------------------- /myproject/accounts/templates/registration/password_reset_subject.txt: -------------------------------------------------------------------------------- 1 | Redefinição de senha 2 | -------------------------------------------------------------------------------- /myproject/core/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /img/01_login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rg3915/django-auth-tutorial/main/img/01_login.png -------------------------------------------------------------------------------- /img/02_signup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rg3915/django-auth-tutorial/main/img/02_signup.png -------------------------------------------------------------------------------- /myproject/core/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /myproject/core/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /img/102_signup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rg3915/django-auth-tutorial/main/img/102_signup.png -------------------------------------------------------------------------------- /myproject/accounts/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /myproject/core/static/css/form.css: -------------------------------------------------------------------------------- 1 | span.required:after { 2 | content: "*"; 3 | color: red; 4 | } -------------------------------------------------------------------------------- /img/101_login_logout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rg3915/django-auth-tutorial/main/img/101_login_logout.png -------------------------------------------------------------------------------- /img/03_change_password.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rg3915/django-auth-tutorial/main/img/03_change_password.png -------------------------------------------------------------------------------- /img/04_forgot_password.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rg3915/django-auth-tutorial/main/img/04_forgot_password.png -------------------------------------------------------------------------------- /img/103_change_password.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rg3915/django-auth-tutorial/main/img/103_change_password.png -------------------------------------------------------------------------------- /img/104_reset_password.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rg3915/django-auth-tutorial/main/img/104_reset_password.png -------------------------------------------------------------------------------- /myproject/core/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class CoreConfig(AppConfig): 5 | name = 'myproject.core' 6 | -------------------------------------------------------------------------------- /myproject/accounts/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class AccountsConfig(AppConfig): 5 | name = 'myproject.accounts' 6 | -------------------------------------------------------------------------------- /myproject/core/static/fonts/gijgo-material.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rg3915/django-auth-tutorial/main/myproject/core/static/fonts/gijgo-material.eot -------------------------------------------------------------------------------- /myproject/core/static/fonts/gijgo-material.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rg3915/django-auth-tutorial/main/myproject/core/static/fonts/gijgo-material.ttf -------------------------------------------------------------------------------- /myproject/core/static/fonts/gijgo-material.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rg3915/django-auth-tutorial/main/myproject/core/static/fonts/gijgo-material.woff -------------------------------------------------------------------------------- /myproject/core/static/fonts/Simple-Line-Icons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rg3915/django-auth-tutorial/main/myproject/core/static/fonts/Simple-Line-Icons.eot -------------------------------------------------------------------------------- /myproject/core/static/fonts/Simple-Line-Icons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rg3915/django-auth-tutorial/main/myproject/core/static/fonts/Simple-Line-Icons.ttf -------------------------------------------------------------------------------- /myproject/core/static/fonts/Simple-Line-Icons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rg3915/django-auth-tutorial/main/myproject/core/static/fonts/Simple-Line-Icons.woff -------------------------------------------------------------------------------- /myproject/core/static/img/django-logo-negative.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rg3915/django-auth-tutorial/main/myproject/core/static/img/django-logo-negative.png -------------------------------------------------------------------------------- /myproject/core/static/fonts/Simple-Line-Icons.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rg3915/django-auth-tutorial/main/myproject/core/static/fonts/Simple-Line-Icons.woff2 -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | dj-database-url==0.5.0 2 | django-extensions==3.1.1 3 | django-utils-six==2.0 4 | django-widget-tweaks==1.4.8 5 | Django==4.0.* 6 | isort==5.8.0 7 | python-decouple==3.4 8 | -------------------------------------------------------------------------------- /myproject/core/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | 3 | from myproject.core import views as v 4 | 5 | app_name = 'core' 6 | 7 | 8 | urlpatterns = [ 9 | path('', v.index, name='index'), 10 | ] 11 | -------------------------------------------------------------------------------- /myproject/accounts/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | from .models import Profile 4 | 5 | 6 | @admin.register(Profile) 7 | class ProfileAdmin(admin.ModelAdmin): 8 | list_display = ('user', 'cpf', 'rg') 9 | -------------------------------------------------------------------------------- /myproject/core/views.py: -------------------------------------------------------------------------------- 1 | from django.contrib.auth.decorators import login_required 2 | from django.shortcuts import render 3 | 4 | 5 | @login_required 6 | def index(request): 7 | template_name = 'index.html' 8 | return render(request, template_name) 9 | -------------------------------------------------------------------------------- /myproject/accounts/templates/email/account_activation_email.html: -------------------------------------------------------------------------------- 1 | {% autoescape off %} 2 | Olá {{ user.username }}, 3 | 4 | Por favor clique no link abaixo para confirmar seu cadastro: 5 | 6 | {{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %} 7 | {% endautoescape %} 8 | -------------------------------------------------------------------------------- /myproject/accounts/templates/accounts/account_activation_done.html: -------------------------------------------------------------------------------- 1 | {% extends 'base_login.html' %} 2 | {% load static %} 3 | 4 | {% block content %} 5 |
7 | Por favor confirme seu e-mail para completar o cadastro.
8 |
7 | Sua senha foi definida. Você pode prosseguir e se autenticar agora.
8 |Olá {{ user }}
9 |
7 | Nós te enviamos um email com instruções para configurar sua senha, se uma conta existe com o email fornecido. Você receberá a mensagem em breve.
8 |Se você não recebeu um email, por favor certifique-se que você forneceu o endereço que você está cadastrado, e verifique sua pasta de spam.
9 |Crie sua conta.
14 | 15 | 49 |{{ error }}
17 | {% endfor %} 18 | {% endif %} 19 | 20 | 47 | 48 |Digite seu e-mail.
12 | 47 |Crie sua conta.
14 | 15 | 51 |Digite sua nova senha.
12 | {% if validlink %} 13 | 44 | {% else %} 45 |46 | O link para a recuperação de senha era inválido, possivelmente porque já foi utilizado. Por favor, solicite uma nova recuperação de senha. 47 |
48 | {% endif %} 49 |
7 |
8 |
9 | Live parte 2
10 |
11 |
12 |
13 |
14 |
15 |
16 | ## Este projeto foi feito com:
17 |
18 | * [Python 3.8.2](https://www.python.org/)
19 | * [Django 4.0.*](https://www.djangoproject.com/)
20 | * [Bootstrap 4.0](https://getbootstrap.com/)
21 |
22 | ## Como rodar o projeto?
23 |
24 | * Clone esse repositório.
25 | * Crie um virtualenv com Python 3.
26 | * Ative o virtualenv.
27 | * Instale as dependências.
28 | * Rode as migrações.
29 |
30 | ```
31 | git clone https://github.com/rg3915/django-auth-tutorial.git
32 | cd django-auth-tutorial
33 | python3 -m venv .venv
34 | source .venv/bin/activate
35 | pip install -r requirements.txt
36 | python contrib/env_gen.py
37 | python manage.py migrate
38 | python manage.py createsuperuser --username='admin' --email=''
39 | ```
40 |
41 | ### Configurar settings.py
42 |
43 | ```python
44 | INSTALLED_APPS = [
45 | 'myproject.accounts', # <---
46 | 'django.contrib.admin',
47 | 'django.contrib.auth',
48 | ...
49 | 'django_extensions',
50 | 'widget_tweaks',
51 | 'myproject.core',
52 | ]
53 |
54 | LOGIN_URL = 'login'
55 | LOGIN_REDIRECT_URL = 'core:index'
56 | LOGOUT_REDIRECT_URL = 'core:index'
57 | ```
58 |
59 | Leia o [passo-a-passo.md](passo-a-passo.md).
60 |
61 |
62 |
63 | ## Telas
64 |
65 | ### Login
66 |
67 | 
68 |
69 | ### Cadastro
70 |
71 | 
72 |
73 | ### Trocar senha
74 |
75 | 
76 |
77 | ### Esqueci minha senha
78 |
79 | 
80 |
81 |
82 |
83 | ## Estrutura
84 |
85 | ### Login
86 |
87 | 
88 |
89 | ### Cadastro
90 |
91 | 
92 |
93 | ### Trocar senha
94 |
95 | 
96 |
97 | ### Esqueci minha senha
98 |
99 | 
100 |
101 |
102 |
103 | ## MailHog
104 |
105 | Rodar [MailHog](https://github.com/mailhog/MailHog) via Docker.
106 |
107 | ```
108 | docker run -d -p 1025:1025 -p 8025:8025 mailhog/mailhog
109 | ```
110 |
111 | ### Configurar settings.py
112 |
113 | ```python
114 | EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
115 |
116 | DEFAULT_FROM_EMAIL = config('DEFAULT_FROM_EMAIL', 'webmaster@localhost')
117 | EMAIL_HOST = config('EMAIL_HOST', '0.0.0.0') # localhost
118 | EMAIL_PORT = config('EMAIL_PORT', 1025, cast=int)
119 | EMAIL_HOST_USER = config('EMAIL_HOST_USER', '')
120 | EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD', '')
121 | EMAIL_USE_TLS = config('EMAIL_USE_TLS', default=False, cast=bool)
122 | ```
123 |
124 |
125 |
126 | ## Links
127 |
128 | https://docs.djangoproject.com/en/3.1/topics/auth/default/#module-django.contrib.auth.views
129 |
130 | https://simpleisbetterthancomplex.com/tutorial/2016/09/19/how-to-create-password-reset-view.html
131 |
132 | https://simpleisbetterthancomplex.com/tutorial/2017/02/18/how-to-create-user-sign-up-view.html
133 |
134 | https://simpleisbetterthancomplex.com/tips/2016/08/04/django-tip-9-password-change-form.html
135 |
136 | https://github.com/egorsmkv/simple-django-login-and-register
137 |
138 | https://github.com/Antonio-Neves/Custom-User-Django-pt
139 |
140 | https://github.com/django/django/tree/main/django/contrib/admin/templates/registration
141 |
142 | https://github.com/django/django/blob/main/django/contrib/auth/views.py
143 |
144 | https://github.com/django/django/blob/main/django/contrib/auth/forms.py
145 |
146 | https://github.com/django/django/blob/main/django/contrib/auth/tokens.py
147 |
--------------------------------------------------------------------------------
/myproject/settings.py:
--------------------------------------------------------------------------------
1 | """
2 | Django settings for myproject project.
3 |
4 | Generated by 'django-admin startproject' using Django 3.1.8.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/3.1/topics/settings/
8 |
9 | For the full list of settings and their values, see
10 | https://docs.djangoproject.com/en/3.1/ref/settings/
11 | """
12 |
13 | import os
14 |
15 | from decouple import Csv, config
16 | from dj_database_url import parse as dburl
17 |
18 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
19 |
20 | SECRET_KEY = config('SECRET_KEY')
21 |
22 | DEBUG = config('DEBUG', default=False, cast=bool)
23 |
24 | ALLOWED_HOSTS = config('ALLOWED_HOSTS', default=[], cast=Csv())
25 |
26 | # Application definition
27 |
28 | INSTALLED_APPS = [
29 | 'myproject.accounts', # <---
30 | 'django.contrib.admin',
31 | 'django.contrib.auth',
32 | 'django.contrib.contenttypes',
33 | 'django.contrib.sessions',
34 | 'django.contrib.messages',
35 | 'django.contrib.staticfiles',
36 | 'django_extensions',
37 | 'widget_tweaks',
38 | 'myproject.core',
39 | ]
40 |
41 | MIDDLEWARE = [
42 | 'django.middleware.security.SecurityMiddleware',
43 | 'django.contrib.sessions.middleware.SessionMiddleware',
44 | 'django.middleware.common.CommonMiddleware',
45 | 'django.middleware.csrf.CsrfViewMiddleware',
46 | 'django.contrib.auth.middleware.AuthenticationMiddleware',
47 | 'django.contrib.messages.middleware.MessageMiddleware',
48 | 'django.middleware.clickjacking.XFrameOptionsMiddleware',
49 | ]
50 |
51 | ROOT_URLCONF = 'myproject.urls'
52 |
53 | EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
54 |
55 | DEFAULT_FROM_EMAIL = config('DEFAULT_FROM_EMAIL', 'webmaster@localhost')
56 | EMAIL_HOST = config('EMAIL_HOST', '0.0.0.0') # localhost
57 | EMAIL_PORT = config('EMAIL_PORT', 1025, cast=int)
58 | EMAIL_HOST_USER = config('EMAIL_HOST_USER', '')
59 | EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD', '')
60 | EMAIL_USE_TLS = config('EMAIL_USE_TLS', default=False, cast=bool)
61 |
62 | TEMPLATES = [
63 | {
64 | 'BACKEND': 'django.template.backends.django.DjangoTemplates',
65 | 'DIRS': [],
66 | 'APP_DIRS': True,
67 | 'OPTIONS': {
68 | 'context_processors': [
69 | 'django.template.context_processors.debug',
70 | 'django.template.context_processors.request',
71 | 'django.contrib.auth.context_processors.auth',
72 | 'django.contrib.messages.context_processors.messages',
73 | ],
74 | },
75 | },
76 | ]
77 |
78 | WSGI_APPLICATION = 'myproject.wsgi.application'
79 |
80 |
81 | # Database
82 | # https://docs.djangoproject.com/en/3.1/ref/settings/#databases
83 |
84 | default_dburl = 'sqlite:///' + os.path.join(BASE_DIR, 'db.sqlite3')
85 | DATABASES = {
86 | 'default': config('DATABASE_URL', default=default_dburl, cast=dburl),
87 | }
88 |
89 | # Password validation
90 | # https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
91 |
92 | AUTH_PASSWORD_VALIDATORS = [
93 | {
94 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
95 | },
96 | {
97 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
98 | },
99 | {
100 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
101 | },
102 | {
103 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
104 | },
105 | ]
106 |
107 |
108 | # Internationalization
109 | # https://docs.djangoproject.com/en/3.1/topics/i18n/
110 |
111 | LANGUAGE_CODE = 'pt-br'
112 |
113 | TIME_ZONE = 'America/Sao_Paulo'
114 |
115 | USE_I18N = True
116 |
117 | USE_L10N = True
118 |
119 | USE_TZ = True
120 |
121 |
122 | # Static files (CSS, JavaScript, Images)
123 | # https://docs.djangoproject.com/en/3.1/howto/static-files/
124 |
125 | STATIC_URL = '/static/'
126 |
127 | LOGIN_URL = 'login'
128 | LOGIN_REDIRECT_URL = 'core:index'
129 | LOGOUT_REDIRECT_URL = 'core:index'
130 |
131 | # Default primary key field type
132 | # https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
133 |
134 | DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
135 |
--------------------------------------------------------------------------------
/myproject/accounts/views.py:
--------------------------------------------------------------------------------
1 | from django.contrib.auth import authenticate
2 | from django.contrib.auth import login as auth_login
3 | from django.contrib.auth.views import (
4 | PasswordChangeDoneView,
5 | PasswordChangeView,
6 | PasswordResetCompleteView,
7 | PasswordResetConfirmView,
8 | PasswordResetDoneView,
9 | PasswordResetView
10 | )
11 | from django.contrib.sites.shortcuts import get_current_site
12 | from django.shortcuts import redirect, render
13 | from django.template.loader import render_to_string
14 | from django.urls import reverse_lazy
15 | from django.utils.encoding import force_bytes
16 | from django.utils.http import urlsafe_base64_encode
17 | from django.views.generic import CreateView
18 |
19 | from myproject.accounts.forms import SignupEmailForm, SignupForm
20 | from myproject.accounts.tokens import account_activation_token
21 |
22 |
23 | def signup(request):
24 | form = SignupForm(request.POST or None)
25 | context = {'form': form}
26 | if request.method == 'POST':
27 | if form.is_valid():
28 | user = form.save(commit=False)
29 | user.is_active = True
30 | user.save() # precisa salvar para rodar o signal.
31 | # carrega a instância do perfil criada pelo signal.
32 | user.refresh_from_db()
33 | user.profile.cpf = form.cleaned_data.get('cpf')
34 | user.profile.rg = form.cleaned_data.get('rg')
35 | user.save()
36 |
37 | username = form.cleaned_data.get('username')
38 | raw_password = form.cleaned_data.get('password1')
39 |
40 | # Autentica usuário
41 | user_auth = authenticate(username=username, password=raw_password)
42 |
43 | # Faz login
44 | auth_login(request, user_auth)
45 | return redirect(reverse_lazy('core:index'))
46 |
47 | return render(request, 'accounts/signup.html', context)
48 |
49 |
50 | class SignUpView(CreateView):
51 | form_class = SignupForm
52 | success_url = reverse_lazy('login')
53 | template_name = 'accounts/signup.html'
54 |
55 |
56 | def send_mail_to_user(request, user):
57 | current_site = get_current_site(request)
58 | use_https = request.is_secure()
59 | subject = 'Ative sua conta.'
60 | message = render_to_string('email/account_activation_email.html', {
61 | 'user': user,
62 | 'protocol': 'https' if use_https else 'http',
63 | 'domain': current_site.domain,
64 | 'uid': urlsafe_base64_encode(force_bytes(user.pk)),
65 | 'token': account_activation_token.make_token(user),
66 | })
67 | user.email_user(subject, message)
68 |
69 |
70 | def signup_email(request):
71 | form = SignupEmailForm(request.POST or None)
72 | context = {'form': form}
73 | if request.method == 'POST':
74 | if form.is_valid():
75 | user = form.save(commit=False)
76 | user.is_active = False
77 | user.save() # precisa salvar para rodar o signal.
78 | # carrega a instância do perfil criada pelo signal.
79 | user.refresh_from_db()
80 | user.profile.cpf = form.cleaned_data.get('cpf')
81 | user.profile.rg = form.cleaned_data.get('rg')
82 | user.save()
83 | send_mail_to_user(request, user)
84 | return redirect('account_activation_done')
85 |
86 | return render(request, 'accounts/signup_email_form.html', context)
87 |
88 |
89 | def account_activation_done(request):
90 | return render(request, 'accounts/account_activation_done.html')
91 |
92 |
93 | class MyPasswordChange(PasswordChangeView):
94 | ...
95 |
96 |
97 | class MyPasswordChangeDone(PasswordChangeDoneView):
98 |
99 | def get(self, request, *args, **kwargs):
100 | return redirect(reverse_lazy('login'))
101 |
102 |
103 | # Requer
104 | # registration/password_reset_email.html
105 | # registration/password_reset_subject.txt
106 | class MyPasswordReset(PasswordResetView):
107 | ...
108 |
109 |
110 | class MyPasswordResetDone(PasswordResetDoneView):
111 | ...
112 |
113 |
114 | class MyPasswordResetConfirm(PasswordResetConfirmView):
115 |
116 | def form_valid(self, form):
117 | self.user.is_active = True
118 | self.user.save()
119 | return super(MyPasswordResetConfirm, self).form_valid(form)
120 |
121 |
122 | class MyPasswordResetComplete(PasswordResetCompleteView):
123 | ...
124 |
--------------------------------------------------------------------------------
/myproject/core/static/css/icons/simple-line-icons.min.css:
--------------------------------------------------------------------------------
1 | @font-face{font-family:simple-line-icons;src:url(../../fonts/Simple-Line-Icons.eot);src:url(../../fonts/Simple-Line-Icons.eot) format('embedded-opentype'),url(../../fonts/Simple-Line-Icons.woff2) format('woff2'),url(../../fonts/Simple-Line-Icons.ttf) format('truetype'),url(../../fonts/Simple-Line-Icons.woff) format('woff'),url(../../fonts/Simple-Line-Icons.svg#simple-line-icons) format('svg');font-weight:400;font-style:normal}.icon-action-redo,.icon-action-undo,.icon-anchor,.icon-arrow-down,.icon-arrow-down-circle,.icon-arrow-left,.icon-arrow-left-circle,.icon-arrow-right,.icon-arrow-right-circle,.icon-arrow-up,.icon-arrow-up-circle,.icon-badge,.icon-bag,.icon-ban,.icon-basket,.icon-basket-loaded,.icon-bell,.icon-book-open,.icon-briefcase,.icon-bubble,.icon-bubbles,.icon-bulb,.icon-calculator,.icon-calendar,.icon-call-end,.icon-call-in,.icon-call-out,.icon-camera,.icon-camrecorder,.icon-chart,.icon-check,.icon-chemistry,.icon-clock,.icon-close,.icon-cloud-download,.icon-cloud-upload,.icon-compass,.icon-control-end,.icon-control-forward,.icon-control-pause,.icon-control-play,.icon-control-rewind,.icon-control-start,.icon-credit-card,.icon-crop,.icon-cup,.icon-cursor,.icon-cursor-move,.icon-diamond,.icon-direction,.icon-directions,.icon-disc,.icon-dislike,.icon-doc,.icon-docs,.icon-drawer,.icon-drop,.icon-earphones,.icon-earphones-alt,.icon-emotsmile,.icon-energy,.icon-envelope,.icon-envelope-letter,.icon-envelope-open,.icon-equalizer,.icon-event,.icon-exclamation,.icon-eye,.icon-eyeglass,.icon-feed,.icon-film,.icon-fire,.icon-flag,.icon-folder,.icon-folder-alt,.icon-frame,.icon-game-controller,.icon-ghost,.icon-globe,.icon-globe-alt,.icon-graduation,.icon-graph,.icon-grid,.icon-handbag,.icon-heart,.icon-home,.icon-hourglass,.icon-info,.icon-key,.icon-layers,.icon-like,.icon-link,.icon-list,.icon-location-pin,.icon-lock,.icon-lock-open,.icon-login,.icon-logout,.icon-loop,.icon-magic-wand,.icon-magnet,.icon-magnifier,.icon-magnifier-add,.icon-magnifier-remove,.icon-map,.icon-menu,.icon-microphone,.icon-minus,.icon-mouse,.icon-music-tone,.icon-music-tone-alt,.icon-mustache,.icon-note,.icon-notebook,.icon-options,.icon-options-vertical,.icon-organization,.icon-paper-clip,.icon-paper-plane,.icon-paypal,.icon-pencil,.icon-people,.icon-phone,.icon-picture,.icon-pie-chart,.icon-pin,.icon-plane,.icon-playlist,.icon-plus,.icon-power,.icon-present,.icon-printer,.icon-puzzle,.icon-question,.icon-refresh,.icon-reload,.icon-rocket,.icon-screen-desktop,.icon-screen-smartphone,.icon-screen-tablet,.icon-settings,.icon-share,.icon-share-alt,.icon-shield,.icon-shuffle,.icon-size-actual,.icon-size-fullscreen,.icon-social-behance,.icon-social-dribbble,.icon-social-dropbox,.icon-social-facebook,.icon-social-foursqare,.icon-social-github,.icon-social-google,.icon-social-instagram,.icon-social-linkedin,.icon-social-pinterest,.icon-social-reddit,.icon-social-skype,.icon-social-soundcloud,.icon-social-spotify,.icon-social-steam,.icon-social-stumbleupon,.icon-social-tumblr,.icon-social-twitter,.icon-social-vkontakte,.icon-social-youtube,.icon-speech,.icon-speedometer,.icon-star,.icon-support,.icon-symbol-female,.icon-symbol-male,.icon-tag,.icon-target,.icon-trash,.icon-trophy,.icon-umbrella,.icon-user,.icon-user-female,.icon-user-follow,.icon-user-following,.icon-user-unfollow,.icon-vector,.icon-volume-1,.icon-volume-2,.icon-volume-off,.icon-wallet,.icon-wrench{font-family:simple-line-icons;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-user:before{content:"\e005"}.icon-people:before{content:"\e001"}.icon-user-female:before{content:"\e000"}.icon-user-follow:before{content:"\e002"}.icon-user-following:before{content:"\e003"}.icon-user-unfollow:before{content:"\e004"}.icon-login:before{content:"\e066"}.icon-logout:before{content:"\e065"}.icon-emotsmile:before{content:"\e021"}.icon-phone:before{content:"\e600"}.icon-call-end:before{content:"\e048"}.icon-call-in:before{content:"\e047"}.icon-call-out:before{content:"\e046"}.icon-map:before{content:"\e033"}.icon-location-pin:before{content:"\e096"}.icon-direction:before{content:"\e042"}.icon-directions:before{content:"\e041"}.icon-compass:before{content:"\e045"}.icon-layers:before{content:"\e034"}.icon-menu:before{content:"\e601"}.icon-list:before{content:"\e067"}.icon-options-vertical:before{content:"\e602"}.icon-options:before{content:"\e603"}.icon-arrow-down:before{content:"\e604"}.icon-arrow-left:before{content:"\e605"}.icon-arrow-right:before{content:"\e606"}.icon-arrow-up:before{content:"\e607"}.icon-arrow-up-circle:before{content:"\e078"}.icon-arrow-left-circle:before{content:"\e07a"}.icon-arrow-right-circle:before{content:"\e079"}.icon-arrow-down-circle:before{content:"\e07b"}.icon-check:before{content:"\e080"}.icon-clock:before{content:"\e081"}.icon-plus:before{content:"\e095"}.icon-minus:before{content:"\e615"}.icon-close:before{content:"\e082"}.icon-event:before{content:"\e619"}.icon-exclamation:before{content:"\e617"}.icon-organization:before{content:"\e616"}.icon-trophy:before{content:"\e006"}.icon-screen-smartphone:before{content:"\e010"}.icon-screen-desktop:before{content:"\e011"}.icon-plane:before{content:"\e012"}.icon-notebook:before{content:"\e013"}.icon-mustache:before{content:"\e014"}.icon-mouse:before{content:"\e015"}.icon-magnet:before{content:"\e016"}.icon-energy:before{content:"\e020"}.icon-disc:before{content:"\e022"}.icon-cursor:before{content:"\e06e"}.icon-cursor-move:before{content:"\e023"}.icon-crop:before{content:"\e024"}.icon-chemistry:before{content:"\e026"}.icon-speedometer:before{content:"\e007"}.icon-shield:before{content:"\e00e"}.icon-screen-tablet:before{content:"\e00f"}.icon-magic-wand:before{content:"\e017"}.icon-hourglass:before{content:"\e018"}.icon-graduation:before{content:"\e019"}.icon-ghost:before{content:"\e01a"}.icon-game-controller:before{content:"\e01b"}.icon-fire:before{content:"\e01c"}.icon-eyeglass:before{content:"\e01d"}.icon-envelope-open:before{content:"\e01e"}.icon-envelope-letter:before{content:"\e01f"}.icon-bell:before{content:"\e027"}.icon-badge:before{content:"\e028"}.icon-anchor:before{content:"\e029"}.icon-wallet:before{content:"\e02a"}.icon-vector:before{content:"\e02b"}.icon-speech:before{content:"\e02c"}.icon-puzzle:before{content:"\e02d"}.icon-printer:before{content:"\e02e"}.icon-present:before{content:"\e02f"}.icon-playlist:before{content:"\e030"}.icon-pin:before{content:"\e031"}.icon-picture:before{content:"\e032"}.icon-handbag:before{content:"\e035"}.icon-globe-alt:before{content:"\e036"}.icon-globe:before{content:"\e037"}.icon-folder-alt:before{content:"\e039"}.icon-folder:before{content:"\e089"}.icon-film:before{content:"\e03a"}.icon-feed:before{content:"\e03b"}.icon-drop:before{content:"\e03e"}.icon-drawer:before{content:"\e03f"}.icon-docs:before{content:"\e040"}.icon-doc:before{content:"\e085"}.icon-diamond:before{content:"\e043"}.icon-cup:before{content:"\e044"}.icon-calculator:before{content:"\e049"}.icon-bubbles:before{content:"\e04a"}.icon-briefcase:before{content:"\e04b"}.icon-book-open:before{content:"\e04c"}.icon-basket-loaded:before{content:"\e04d"}.icon-basket:before{content:"\e04e"}.icon-bag:before{content:"\e04f"}.icon-action-undo:before{content:"\e050"}.icon-action-redo:before{content:"\e051"}.icon-wrench:before{content:"\e052"}.icon-umbrella:before{content:"\e053"}.icon-trash:before{content:"\e054"}.icon-tag:before{content:"\e055"}.icon-support:before{content:"\e056"}.icon-frame:before{content:"\e038"}.icon-size-fullscreen:before{content:"\e057"}.icon-size-actual:before{content:"\e058"}.icon-shuffle:before{content:"\e059"}.icon-share-alt:before{content:"\e05a"}.icon-share:before{content:"\e05b"}.icon-rocket:before{content:"\e05c"}.icon-question:before{content:"\e05d"}.icon-pie-chart:before{content:"\e05e"}.icon-pencil:before{content:"\e05f"}.icon-note:before{content:"\e060"}.icon-loop:before{content:"\e064"}.icon-home:before{content:"\e069"}.icon-grid:before{content:"\e06a"}.icon-graph:before{content:"\e06b"}.icon-microphone:before{content:"\e063"}.icon-music-tone-alt:before{content:"\e061"}.icon-music-tone:before{content:"\e062"}.icon-earphones-alt:before{content:"\e03c"}.icon-earphones:before{content:"\e03d"}.icon-equalizer:before{content:"\e06c"}.icon-like:before{content:"\e068"}.icon-dislike:before{content:"\e06d"}.icon-control-start:before{content:"\e06f"}.icon-control-rewind:before{content:"\e070"}.icon-control-play:before{content:"\e071"}.icon-control-pause:before{content:"\e072"}.icon-control-forward:before{content:"\e073"}.icon-control-end:before{content:"\e074"}.icon-volume-1:before{content:"\e09f"}.icon-volume-2:before{content:"\e0a0"}.icon-volume-off:before{content:"\e0a1"}.icon-calendar:before{content:"\e075"}.icon-bulb:before{content:"\e076"}.icon-chart:before{content:"\e077"}.icon-ban:before{content:"\e07c"}.icon-bubble:before{content:"\e07d"}.icon-camrecorder:before{content:"\e07e"}.icon-camera:before{content:"\e07f"}.icon-cloud-download:before{content:"\e083"}.icon-cloud-upload:before{content:"\e084"}.icon-envelope:before{content:"\e086"}.icon-eye:before{content:"\e087"}.icon-flag:before{content:"\e088"}.icon-heart:before{content:"\e08a"}.icon-info:before{content:"\e08b"}.icon-key:before{content:"\e08c"}.icon-link:before{content:"\e08d"}.icon-lock:before{content:"\e08e"}.icon-lock-open:before{content:"\e08f"}.icon-magnifier:before{content:"\e090"}.icon-magnifier-add:before{content:"\e091"}.icon-magnifier-remove:before{content:"\e092"}.icon-paper-clip:before{content:"\e093"}.icon-paper-plane:before{content:"\e094"}.icon-power:before{content:"\e097"}.icon-refresh:before{content:"\e098"}.icon-reload:before{content:"\e099"}.icon-settings:before{content:"\e09a"}.icon-star:before{content:"\e09b"}.icon-symbol-female:before{content:"\e09c"}.icon-symbol-male:before{content:"\e09d"}.icon-target:before{content:"\e09e"}.icon-credit-card:before{content:"\e025"}.icon-paypal:before{content:"\e608"}.icon-social-tumblr:before{content:"\e00a"}.icon-social-twitter:before{content:"\e009"}.icon-social-facebook:before{content:"\e00b"}.icon-social-instagram:before{content:"\e609"}.icon-social-linkedin:before{content:"\e60a"}.icon-social-pinterest:before{content:"\e60b"}.icon-social-github:before{content:"\e60c"}.icon-social-google:before{content:"\e60d"}.icon-social-reddit:before{content:"\e60e"}.icon-social-skype:before{content:"\e60f"}.icon-social-dribbble:before{content:"\e00d"}.icon-social-behance:before{content:"\e610"}.icon-social-foursqare:before{content:"\e611"}.icon-social-soundcloud:before{content:"\e612"}.icon-social-spotify:before{content:"\e613"}.icon-social-stumbleupon:before{content:"\e614"}.icon-social-youtube:before{content:"\e008"}.icon-social-dropbox:before{content:"\e00c"}.icon-social-vkontakte:before{content:"\e618"}.icon-social-steam:before{content:"\e620"}/*# sourceMappingURL=simple-line-icons.min.css.map */
--------------------------------------------------------------------------------
/myproject/core/static/js/popper.min.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) Federico Zivolo 2018
3 | Distributed under the MIT License (license terms are at http://opensource.org/licenses/MIT).
4 | */(function(e,t){'object'==typeof exports&&'undefined'!=typeof module?module.exports=t():'function'==typeof define&&define.amd?define(t):e.Popper=t()})(this,function(){'use strict';function e(e){return e&&'[object Function]'==={}.toString.call(e)}function t(e,t){if(1!==e.nodeType)return[];var o=e.ownerDocument.defaultView,n=o.getComputedStyle(e,null);return t?n[t]:n}function o(e){return'HTML'===e.nodeName?e:e.parentNode||e.host}function n(e){if(!e)return document.body;switch(e.nodeName){case'HTML':case'BODY':return e.ownerDocument.body;case'#document':return e.body;}var i=t(e),r=i.overflow,p=i.overflowX,s=i.overflowY;return /(auto|scroll|overlay)/.test(r+s+p)?e:n(o(e))}function r(e){return 11===e?re:10===e?pe:re||pe}function p(e){if(!e)return document.documentElement;for(var o=r(10)?document.body:null,n=e.offsetParent||null;n===o&&e.nextElementSibling;)n=(e=e.nextElementSibling).offsetParent;var i=n&&n.nodeName;return i&&'BODY'!==i&&'HTML'!==i?-1!==['TH','TD','TABLE'].indexOf(n.nodeName)&&'static'===t(n,'position')?p(n):n:e?e.ownerDocument.documentElement:document.documentElement}function s(e){var t=e.nodeName;return'BODY'!==t&&('HTML'===t||p(e.firstElementChild)===e)}function d(e){return null===e.parentNode?e:d(e.parentNode)}function a(e,t){if(!e||!e.nodeType||!t||!t.nodeType)return document.documentElement;var o=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,n=o?e:t,i=o?t:e,r=document.createRange();r.setStart(n,0),r.setEnd(i,0);var l=r.commonAncestorContainer;if(e!==l&&t!==l||n.contains(i))return s(l)?l:p(l);var f=d(e);return f.host?a(f.host,t):a(e,d(t).host)}function l(e){var t=1