Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
mediatek
Base de données Mediatek
Commits
be96a61f
Verified
Commit
be96a61f
authored
Aug 09, 2019
by
erdnaxe
🦋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CI passing!
parent
d6e7a2b6
Pipeline
#1405
passed with stage
in 3 minutes and 20 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
11 deletions
+12
-11
logs/views.py
logs/views.py
+2
-2
med/login.py
med/login.py
+4
-4
media/admin.py
media/admin.py
+1
-1
media/views.py
media/views.py
+3
-2
tox.ini
tox.ini
+2
-2
No files found.
logs/views.py
View file @
be96a61f
...
...
@@ -10,7 +10,7 @@ from django.shortcuts import render
from
django.template.context_processors
import
csrf
from
reversion.models
import
Revision
from
med.settings
import
PAGINATION_NUMBER
as
pagination_number
from
med.settings
import
PAGINATION_NUMBER
from
users.models
import
User
...
...
@@ -26,7 +26,7 @@ def index(request):
revisions
=
Revision
.
objects
.
all
().
order_by
(
'date_created'
).
reverse
().
select_related
(
'user'
).
prefetch_related
(
'version_set__object'
)
paginator
=
Paginator
(
revisions
,
pagination_number
)
paginator
=
Paginator
(
revisions
,
PAGINATION_NUMBER
)
page
=
request
.
GET
.
get
(
'page'
)
try
:
revisions
=
paginator
.
page
(
page
)
...
...
med/login.py
View file @
be96a61f
...
...
@@ -17,14 +17,14 @@ ALGO_LEN = len(ALGO_NAME + "$")
DIGEST_LEN
=
20
def
make
S
ecret
(
password
):
def
make
_s
ecret
(
password
):
salt
=
os
.
urandom
(
4
)
h
=
hashlib
.
sha1
(
password
.
encode
())
h
.
update
(
salt
)
return
ALGO_NAME
+
"$"
+
encodestring
(
h
.
digest
()
+
salt
).
decode
()[:
-
1
]
def
check
P
assword
(
challenge_password
,
password
):
def
check
_p
assword
(
challenge_password
,
password
):
challenge_bytes
=
decodestring
(
challenge_password
[
ALGO_LEN
:].
encode
())
digest
=
challenge_bytes
[:
DIGEST_LEN
]
salt
=
challenge_bytes
[
DIGEST_LEN
:]
...
...
@@ -52,14 +52,14 @@ class SSHAPasswordHasher(hashers.BasePasswordHasher):
salt is overridden
"""
assert
password
is
not
None
return
make
S
ecret
(
password
)
return
make
_s
ecret
(
password
)
def
verify
(
self
,
password
,
encoded
):
"""
Check password against encoded using SSHA algorithm
"""
assert
encoded
.
startswith
(
self
.
algorithm
)
return
check
P
assword
(
encoded
,
password
)
return
check
_p
assword
(
encoded
,
password
)
def
safe_summary
(
self
,
encoded
):
"""
...
...
media/admin.py
View file @
be96a61f
...
...
@@ -5,7 +5,7 @@
from
django.contrib
import
admin
from
reversion.admin
import
VersionAdmin
from
.models
import
Auteur
,
Emprunt
,
Media
,
Jeu
from
.models
import
Auteur
,
Emprunt
,
Jeu
,
Media
class
AuteurAdmin
(
VersionAdmin
):
...
...
media/views.py
View file @
be96a61f
...
...
@@ -5,7 +5,7 @@
from
django.contrib
import
messages
from
django.contrib.auth.decorators
import
login_required
,
permission_required
from
django.db
import
transaction
from
django.shortcuts
import
re
nder
,
redirect
from
django.shortcuts
import
re
direct
,
render
from
django.template.context_processors
import
csrf
from
django.utils
import
timezone
from
reversion
import
revisions
as
reversion
...
...
@@ -33,7 +33,8 @@ def add_emprunt(request, userid):
user
=
user
).
count
()
if
emprunts_en_cours
>=
user
.
maxemprunt
:
messages
.
error
(
request
,
"Maximum d'emprunts atteint de l'user %s"
%
user
.
maxemprunt
)
"Maximum d'emprunts atteint de "
"l'user %s"
%
user
.
maxemprunt
)
return
redirect
(
"/"
)
emprunt
=
EmpruntForm
(
request
.
POST
or
None
)
if
emprunt
.
is_valid
():
...
...
tox.ini
View file @
be96a61f
...
...
@@ -28,11 +28,11 @@ deps =
pyflakes
pylint
commands
=
flake8
logs
med
media
search
users
flake8
logs
media
search
users
pylint
.
[flake8]
ignore
=
D203, W503, E203
ignore
=
D203, W503, E203
, I100, I201, I202
exclude
=
.tox,
.git,
...
...
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