Fakultas Ilmu Komputer UI
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
PMPL
Class Project
DIGIPUS
Commits
ae4df14a
Commit
ae4df14a
authored
Oct 16, 2020
by
Yaumi
Browse files
merge request
parents
2d43f764
4885ec3b
Pipeline
#58928
failed with stages
in 13 minutes and 47 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/templates/app/includes/sidebar_profile.html
View file @
ae4df14a
<ul
class=
"navbar-nav bg-gradient-primary sidebar sidebar-dark accordion"
id=
"accordionSidebar"
>
<!-- Sidebar - Brand -->
<a
class=
"sidebar-brand d-flex align-items-center justify-content-center"
href=
"{% url 'daftar_katalog' %}"
>
<ul
class=
"navbar-nav bg-gradient-primary sidebar sidebar-dark accordion"
id=
"accordionSidebar"
>
<!-- Sidebar - Brand -->
<a
class=
"sidebar-brand d-flex align-items-center justify-content-center"
href=
"{% url 'daftar_katalog' %}"
>
<div
class=
"sidebar-brand-icon rotate-n-15"
></div>
<div
class=
"sidebar-brand-text mx-3"
>
Digipus
</div>
</a>
...
...
@@ -10,12 +10,16 @@
<!-- Nav Item - Dashboard -->
<li
class=
"nav-item"
>
<a
class=
"nav-link"
href=
"/profil/"
>
<span>
Halaman Profil
</span></a>
<a
class=
"nav-link"
href=
"/profil/"
>
<span>
Halaman Profil
</span></a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link"
href=
"/sunting/"
>
<span>
Sunting Profil
</span></a>
<a
class=
"nav-link"
href=
"/sunting/"
>
<span>
Sunting Profil
</span></a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link"
href=
"/change-password/"
>
<span>
Change Password
</span></a>
</li>
</ul>
\ No newline at end of file
app/templates/change-password.html
0 → 100644
View file @
ae4df14a
{% extends 'app/base_profile.html' %}
{% block title %}Change Password{% endblock%}
{% block content %}
<h1>
Change Password
</h1>
<br/><br/>
<div
class =
"from-group"
>
<form
method=
"POST"
>
{% csrf_token %}
{{ form.as_p }}
<button
class=
"btn btn-secondary"
>
Change Password
</button>
</form>
</div>
{% endblock %}
\ No newline at end of file
app/templates/password_success.html
0 → 100644
View file @
ae4df14a
{% extends 'app/base_profile.html' %}
{% block title %}Change Password{% endblock%}
{% block content %}
<h1>
Password was Changed Successfully!
</h1>
<br/><br/>
{% endblock %}
\ No newline at end of file
app/tests.py
View file @
ae4df14a
...
...
@@ -56,6 +56,8 @@ from .views import (
KatalogPerKontributorView
,
UploadMateriView
,
UploadMateriExcelView
,
PasswordChangeView
,
password_success
,
)
from
app.forms
import
SuntingProfilForm
,
year_choices
from
app.utils.fileManagementUtil
import
get_random_filename
,
remove_image_exifdata
...
...
@@ -2354,4 +2356,49 @@ class YearChoicesTest(TestCase):
def
test_min_release_year_is_2000
(
self
):
choices
=
year_choices
()
self
.
assertEqual
((
2000
,
2000
),
choices
[
0
])
\ No newline at end of file
self
.
assertEqual
((
2000
,
2000
),
choices
[
0
])
class
ChangePasswordTest
(
TestCase
):
def
setUp
(
self
):
self
.
client
=
Client
()
self
.
kontributor
=
User
.
objects
.
create_contributor
(
email
=
"kontributor@gov.id"
,
password
=
"kontributor"
)
self
.
admin
=
User
.
objects
.
create_admin
(
email
=
"admin@gov.id"
,
password
=
"admin"
)
self
.
url
=
"/change-password/"
self
.
view
=
PasswordChangeView
self
.
template_name
=
"change-password.html"
def
test_change_password_view
(
self
):
found
=
resolve
(
self
.
url
)
self
.
assertEqual
(
found
.
func
.
__name__
,
self
.
view
.
as_view
().
__name__
)
def
test_change_password_template
(
self
):
# Login
self
.
client
.
login
(
email
=
"kontributor@gov.id"
,
password
=
"kontributor"
)
# Test
response
=
self
.
client
.
get
(
self
.
url
)
self
.
assertTemplateUsed
(
response
,
self
.
template_name
)
# Logout
self
.
client
.
logout
()
def
test_change_password_url
(
self
):
# Login
self
.
client
.
login
(
email
=
"kontributor@gov.id"
,
password
=
"kontributor"
)
# Test
response
=
self
.
client
.
get
(
self
.
url
)
self
.
assertEqual
(
response
.
status_code
,
200
)
# Logout
self
.
client
.
logout
()
def
test_change_password_access
(
self
):
# Kontributor
# Login
self
.
client
.
login
(
email
=
"kontributor@gov.id"
,
password
=
"kontributor"
)
# Test
response
=
self
.
client
.
get
(
self
.
url
)
self
.
assertEqual
(
response
.
status_code
,
200
)
# Logout
self
.
client
.
logout
()
def
test_change_password_anonymous
(
self
):
# Test
response
=
self
.
client
.
get
(
self
.
url
)
self
.
assertEqual
(
response
.
status_code
,
403
)
\ No newline at end of file
app/urls.py
View file @
ae4df14a
...
...
@@ -5,8 +5,8 @@ from app.views import (DashboardKontributorView, ProfilKontributorView,
SuksesLoginAdminView
,
SuksesLoginKontributorView
,
DownloadHistoryView
,
SuntingProfilView
,
UploadMateriHTML
,
UploadMateriView
,
UploadMateriExcelView
,
ProfilAdminView
,
PostsView
,
SuntingProfilAdminView
,
ReqMateriView
,
KatalogPerKontributorView
)
ReqMateriView
,
KatalogPerKontributorView
,
PasswordChangeView
,
password_success
)
from
django.contrib.auth
import
views
as
auth_views
urlpatterns
=
[
path
(
""
,
views
.
DaftarKatalog
.
as_view
(),
name
=
"daftar_katalog"
),
path
(
"materi/<int:pk>/"
,
views
.
DetailMateri
.
as_view
(),
name
=
"detail-materi"
),
...
...
@@ -37,4 +37,6 @@ urlpatterns = [
name
=
"katalog-per-kontributor"
),
path
(
"materi/rate/"
,
views
.
add_rating_materi
,
name
=
"rate-materi"
),
path
(
"materi/<int:pk>/save-to-gdrive/"
,
views
.
save_to_gdrive
,
name
=
"save-to-gdrive"
),
path
(
"change-password/"
,
PasswordChangeView
.
as_view
(
template_name
=
'change-password.html'
)),
path
(
"password_success/"
,
views
.
password_success
,
name
=
"password_success"
),
]
app/views.py
View file @
ae4df14a
...
...
@@ -29,6 +29,10 @@ from authentication.models import User
from
.services
import
DafterKatalogService
,
DetailMateriService
,
LikeDislikeService
,
MateriFieldValidationHelperService
,
\
DownloadViewMateriHelperService
,
UploadMateriService
,
EditProfileService
,
RevisiMateriService
,
\
DownloadHistoryService
,
GoogleDriveUploadService
from
django.contrib.auth.views
import
PasswordChangeForm
from
django.urls
import
reverse_lazy
from
django.contrib.auth.views
import
PasswordChangeView
from
django.shortcuts
import
render
def
permission_denied
(
request
,
exception
,
template_name
=
"error_403.html"
):
...
...
@@ -695,4 +699,12 @@ def save_to_gdrive(request, pk):
else
:
raise
Http404
(
"File tidak dapat ditemukan."
)
return
HttpResponseRedirect
(
reverse
(
'detail-materi'
,
kwargs
=
{
'pk'
:
pk
}))
\ No newline at end of file
return
HttpResponseRedirect
(
reverse
(
'detail-materi'
,
kwargs
=
{
'pk'
:
pk
}))
class
PasswordChangeView
(
PasswordChangeView
):
from_class
=
PasswordChangeForm
success_url
=
reverse_lazy
(
'password_success'
)
def
password_success
(
request
):
return
render
(
request
,
'password_success.html'
,
{})
\ No newline at end of file
digipus/__pycache__/settings.cpython-36.pyc
View file @
ae4df14a
No preview for this file type
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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