Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
Coursework_64
Project
Project
Details
Activity
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
Volkov Gherman
Coursework_64
Commits
c4a9a323
Commit
c4a9a323
authored
Nov 08, 2021
by
Volkov Gherman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
исправил ошибки смены пароля
parent
e15d7152
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
10 additions
and
4 deletions
+10
-4
urls.cpython-38.pyc
source/accounts/__pycache__/urls.cpython-38.pyc
+0
-0
views.cpython-38.pyc
source/accounts/__pycache__/views.cpython-38.pyc
+0
-0
password_change.html
source/accounts/templates/registration/password_change.html
+1
-1
urls.py
source/accounts/urls.py
+2
-2
views.py
source/accounts/views.py
+6
-0
db.sqlite3
source/db.sqlite3
+0
-0
base.html
source/webapp/templates/base.html
+1
-1
No files found.
source/accounts/__pycache__/urls.cpython-38.pyc
View file @
c4a9a323
No preview for this file type
source/accounts/__pycache__/views.cpython-38.pyc
View file @
c4a9a323
No preview for this file type
source/accounts/templates/registration/password_change
_form
.html
→
source/accounts/templates/registration/password_change.html
View file @
c4a9a323
...
...
@@ -3,7 +3,7 @@
{% block content %}
<div
class=
"log"
>
<form
action=
"{% url 'accounts:
password_change_done
' request.user.pk %}"
method=
"post"
>
<form
action=
"{% url 'accounts:
change_password
' request.user.pk %}"
method=
"post"
>
{% csrf_token %}
{{ form|crispy }}
<button
class=
"btn btn-outline-dark log_btn"
type=
"submit"
>
Change
</button>
...
...
source/accounts/urls.py
View file @
c4a9a323
from
django.contrib.auth.views
import
LoginView
,
LogoutView
,
PasswordChangeView
from
django.urls
import
path
,
reverse_lazy
from
accounts.views
import
RegisterView
from
accounts.views
import
RegisterView
,
ChangePasswordView
app_name
=
"accounts"
...
...
@@ -9,5 +9,5 @@ urlpatterns = [
path
(
"account/login/"
,
LoginView
.
as_view
(),
name
=
"login"
),
path
(
"account/logout/"
,
LogoutView
.
as_view
(),
name
=
"logout"
),
path
(
"account/registration/"
,
RegisterView
.
as_view
(),
name
=
"register"
),
path
(
"account/<int:pk>/change_password
"
,
PasswordChangeView
.
as_view
(
success_url
=
reverse_lazy
(
'accounts:password_change_done'
)),
name
=
"password_change_done
"
),
path
(
"account/<int:pk>/change_password
/"
,
ChangePasswordView
.
as_view
(),
name
=
"change_password
"
),
]
source/accounts/views.py
View file @
c4a9a323
from
django.contrib.auth
import
get_user_model
,
login
from
django.contrib.auth.views
import
PasswordChangeView
from
django.shortcuts
import
redirect
from
django.urls
import
reverse_lazy
from
django.views.generic
import
CreateView
...
...
@@ -17,3 +18,8 @@ class RegisterView(CreateView):
login
(
self
.
request
,
user
)
return
redirect
(
"webapp:index"
)
class
ChangePasswordView
(
PasswordChangeView
):
template_name
=
'registration/password_change.html'
success_url
=
reverse_lazy
(
'webapp:index'
)
source/db.sqlite3
View file @
c4a9a323
No preview for this file type
source/webapp/templates/base.html
View file @
c4a9a323
...
...
@@ -33,7 +33,7 @@
{% if request.user.is_superuser %}
<a
style=
"margin-right: 10px;"
href=
"{% url "
webapp:post_create
"
%}"
class=
"text-dark"
title=
"Add post"
><i
class=
"bi bi-file-plus icon"
></i></a>
{% endif %}
<a
style=
"margin-right: 10px;"
href=
"{% url "
accounts:
password_change_done
"
request
.
user
.
pk
%}"
class=
"text-dark"
title=
"Change password"
><i
class=
"bi bi-pencil icon"
></i></a>
<a
style=
"margin-right: 10px;"
href=
"{% url "
accounts:
change_password
"
request
.
user
.
pk
%}"
class=
"text-dark"
title=
"Change password"
><i
class=
"bi bi-pencil icon"
></i></a>
</div>
{% else %}
<div
class=
"link_anon d-flex justify-content-between reg_cont"
>
...
...
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