Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
Academe
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nathan Kibanoff
Academe
Commits
c1363a8a
Commit
c1363a8a
authored
Nov 04, 2017
by
JayCay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Confirmation email works!
parent
01829092
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
43 additions
and
13 deletions
+43
-13
urls.cpython-36.pyc
academe/__pycache__/urls.cpython-36.pyc
+0
-0
urls.py
academe/urls.py
+2
-1
views.cpython-36.pyc
accounts/__pycache__/views.cpython-36.pyc
+0
-0
0001_initial.py
accounts/migrations/0001_initial.py
+27
-0
0001_initial.cpython-36.pyc
accounts/migrations/__pycache__/0001_initial.cpython-36.pyc
+0
-0
views.py
accounts/views.py
+12
-10
db.sqlite3
db.sqlite3
+0
-0
account_activation_invalid.html
templates/account_activation_invalid.html
+1
-1
account_activation_sent.html
templates/account_activation_sent.html
+1
-1
No files found.
academe/__pycache__/urls.cpython-36.pyc
View file @
c1363a8a
No preview for this file type
academe/urls.py
View file @
c1363a8a
...
...
@@ -26,7 +26,8 @@ from profs import views as profs_views
urlpatterns
=
[
url
(
r'^signup/$'
,
accounts_views
.
signup
,
name
=
'signup'
),
url
(
r'^account_activation_sent/$'
,
accounts_views
.
account_activation_sent
,
name
=
'account_activation_sent'
),
url
(
r'^activate/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$'
,
accounts_views
.
activate
,
name
=
'activate'
),
url
(
r'^activate/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$'
,
accounts_views
.
activate
,
name
=
'activate'
),
url
(
r'^login/$'
,
auth_views
.
LoginView
.
as_view
(
template_name
=
'templates/login.html'
),
name
=
'login'
),
url
(
r'^logout/$'
,
auth_views
.
LogoutView
.
as_view
(),
name
=
'logout'
),
url
(
r'^admin/'
,
admin
.
site
.
urls
),
...
...
accounts/__pycache__/views.cpython-36.pyc
View file @
c1363a8a
No preview for this file type
accounts/migrations/0001_initial.py
0 → 100644
View file @
c1363a8a
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-11-04 09:28
from
__future__
import
unicode_literals
from
django.conf
import
settings
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
initial
=
True
dependencies
=
[
migrations
.
swappable_dependency
(
settings
.
AUTH_USER_MODEL
),
]
operations
=
[
migrations
.
CreateModel
(
name
=
'Profile'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'email_confirmed'
,
models
.
BooleanField
(
default
=
False
)),
(
'user'
,
models
.
OneToOneField
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
settings
.
AUTH_USER_MODEL
)),
],
),
]
accounts/migrations/__pycache__/0001_initial.cpython-36.pyc
0 → 100644
View file @
c1363a8a
File added
accounts/views.py
View file @
c1363a8a
from
django.contrib.sites.shortcuts
import
get_current_site
from
django.contrib.auth
import
login
as
auth_login
from
django.contrib.auth.decorators
import
login_required
from
django.contrib.auth.models
import
User
from
django.contrib.sites.shortcuts
import
get_current_site
from
django.shortcuts
import
render
,
redirect
from
django.utils.encoding
import
force_bytes
from
django.utils.http
import
urlsafe_base64_encode
from
django.utils.encoding
import
force_bytes
,
force_text
from
django.utils.http
import
urlsafe_base64_encode
,
urlsafe_base64_decode
from
django.template.loader
import
render_to_string
from
accounts.forms
import
SignUpForm
from
accounts.tokens
import
account_activation_token
#
@login_required
#
def home(request):
#
return render(request, 'reviews_index')
@
login_required
def
home
(
request
):
return
render
(
request
,
'reviews_index'
)
def
signup
(
request
):
if
request
.
method
==
'POST'
:
...
...
@@ -21,7 +23,7 @@ def signup(request):
user
.
save
()
current_site
=
get_current_site
(
request
)
subject
=
'Activate your Academe Account'
message
=
render_to_string
(
'account_activation_email.html'
,
{
message
=
render_to_string
(
'
templates/
account_activation_email.html'
,
{
'user'
:
user
,
'domain'
:
current_site
.
domain
,
'uid'
:
urlsafe_base64_encode
(
force_bytes
(
user
.
pk
)),
...
...
@@ -34,7 +36,7 @@ def signup(request):
return
render
(
request
,
'templates/signup.html'
,
{
'form'
:
form
})
def
account_activation_sent
(
request
):
return
render
(
request
,
'account_activation_sent.html'
)
return
render
(
request
,
'
templates/
account_activation_sent.html'
)
def
activate
(
request
,
uidb64
,
token
):
try
:
...
...
@@ -47,7 +49,7 @@ def activate(request, uidb64, token):
user
.
is_active
=
True
user
.
profile
.
email_confirmed
=
True
user
.
save
()
login
(
request
,
user
)
auth_
login
(
request
,
user
)
return
redirect
(
'reviews_index'
)
else
:
return
render
(
request
,
'account_activation_invalid.html'
)
return
render
(
request
,
'
templates/
account_activation_invalid.html'
)
db.sqlite3
View file @
c1363a8a
No preview for this file type
templates/account_activation_invalid.html
View file @
c1363a8a
{% extends
templates/base.html
%}
{% extends
'templates/base.html'
%}
{% block content %}
<p>
The confirmation link was invalid, possibly because it has already been used.
</p>
...
...
templates/account_activation_sent.html
View file @
c1363a8a
{% extends
templates/base.html
%}
{% extends
'templates/base.html'
%}
{% block content %}
<p>
Please confirm your email address to complete the registration.
</p>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment