Toggle navigation
Toggle navigation
This project
Loading...
Sign in
신은섭(Shin Eun Seop)
/
2018-1-d.cloud
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
10
Merge Requests
0
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
신은섭(Shin Eun Seop)
2018-05-22 12:56:54 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
aadadf7aeab0693f1ce5acf5d02a21435fd10ce3
aadadf7a
1 parent
dea99873
add account delete
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
14 deletions
dcloud/website/auth_views.py
dcloud/website/templates/registration/delete_account.html
dcloud/website/templates/registration/delete_account_success.html
dcloud/website/templates/registration/signup.html
dcloud/website/urls.py
dcloud/website/auth_views.py
View file @
aadadf7
from
django.contrib.auth
import
login
,
authenticate
from
django.contrib.auth.forms
import
UserCreationForm
from
django.shortcuts
import
render
,
redirect
from
django.contrib.auth.decorators
import
login_required
def
signup
(
request
):
if
request
.
method
==
'POST'
:
...
...
@@ -15,3 +16,21 @@ def signup(request):
else
:
form
=
UserCreationForm
()
return
render
(
request
,
'registration/signup.html'
,
{
'form'
:
form
})
@login_required
def
delete_account
(
request
):
if
request
.
method
==
'GET'
:
return
render
(
request
,
'registration/delete_account.html'
)
elif
request
.
method
==
'POST'
:
if
request
.
POST
.
get
(
'yes'
):
return
redirect
(
'delete_account_success'
)
else
:
return
redirect
(
'/'
)
@login_required
def
delete_account_success
(
request
):
if
request
.
method
==
'GET'
:
# TODO Add delete account
return
render
(
request
,
'registration/delete_account_success.html'
)
...
...
dcloud/website/templates/registration/delete_account.html
0 → 100644
View file @
aadadf7
{% extends "website/baseline.html" %}
{% block content %}
{% if user.is_authenticated %}
<h1>
{{user.username}} really want to delete your account?
</h1>
<form
action=
'#'
method=
"POST"
>
{% csrf_token %}
<input
type=
"submit"
value=
"yes"
name=
"yes"
>
<input
type=
"submit"
value=
"no"
name=
"no"
>
</form>
{% endif %}
{% endblock %}
\ No newline at end of file
dcloud/website/templates/registration/delete_account_success.html
0 → 100644
View file @
aadadf7
{% extends "website/baseline.html" %}
{% block content %}
<h1>
DELTED
</h1>
<!--TODO logout -->
{% endblock %}
\ No newline at end of file
dcloud/website/templates/registration/signup.html
View file @
aadadf7
{% extends 'website/baseline.html' %}
{% block content %}
<h2>
Sign up
</h2>
<form
method=
"post"
>
{% csrf_token %}
{% for field in form %}
{% extends 'website/baseline.html' %} {% block content %}
<h2>
Sign up
</h2>
<form
method=
"post"
>
{% csrf_token %} {% for field in form %}
<p>
{{ field.label_tag }}
<br>
{{ field }}
{% if field.help_text %}
{{ field.label_tag }}
<br>
{{ field }} {% if field.help_text %}
<small
style=
"color: grey"
>
{% autoescape off %}{{ field.help_text }}{% endautoescape %}
</small>
{% endif %}
{% for error in field.errors %}
{% endif %} {% for error in field.errors %}
<p
style=
"color: red"
>
{{ error }}
</p>
{% endfor %}
</p>
{% endfor %}
<button
type=
"submit"
>
Sign up
</button>
</form>
</form>
{% endblock %}
\ No newline at end of file
...
...
dcloud/website/urls.py
View file @
aadadf7
...
...
@@ -11,5 +11,7 @@ urlpatterns = [
url
(
r'^post/(?P<pk>\d+)/publish/$'
,
views
.
post_publish
,
name
=
'post_publish'
),
url
(
r'^files/'
,
views
.
file_list
,
name
=
'file_list'
),
url
(
r'^signup/$'
,
auth_views
.
signup
,
name
=
'signup'
),
url
(
r'^accounts/signup/$'
,
auth_views
.
signup
,
name
=
'signup'
),
url
(
r'^accounts/delete_account/$'
,
auth_views
.
delete_account
,
name
=
'delete_account'
),
url
(
r'^accounts/delete_account_success/$'
,
auth_views
.
delete_account_success
,
name
=
'delete_account_success'
),
]
\ No newline at end of file
...
...
Please
register
or
login
to post a comment