Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
La Quadrature du Net
piphone
piphone-sip
Commits
af368ed4
Commit
af368ed4
authored
Apr 19, 2017
by
okhin
Browse files
Fixing some auth code
parent
8d15804f
Pipeline
#952
passed with stage
in 2 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
piphone.py
View file @
af368ed4
...
@@ -490,15 +490,15 @@ def static_files(filepath):
...
@@ -490,15 +490,15 @@ def static_files(filepath):
def
login_admin
(
user
,
password
):
def
login_admin
(
user
,
password
):
db
=
sqlite3
.
connect
(
config
[
'piphone'
][
'db'
])
db
=
sqlite3
.
connect
(
config
[
'piphone'
][
'db'
])
user
=
db
.
execute
(
'SELECT
api,
token, admin FROM users where api = ?'
,
(
user
,))
sql_
user
=
db
.
execute
(
'SELECT token, admin FROM users where api = ?'
,
(
user
,))
user
=
user
.
fetchone
()
sql_
user
=
sql_
user
.
fetchone
()
if
user
is
None
:
if
sql_
user
is
None
:
# user does not exist
# user does not exist
return
False
return
False
if
password
!=
user
[
1
]:
if
password
!=
sql_
user
[
0
]:
# password does not match
# password does not match
return
False
return
False
if
user
[
2
]
==
0
:
if
sql_
user
[
1
]
==
0
:
# User is not admin
# User is not admin
return
False
return
False
return
True
return
True
...
...
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