Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
redl
redeleitsystem
Commits
e9d8166d
Commit
e9d8166d
authored
Nov 07, 2015
by
Robin Sonnabend
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed creating an admin user in a request
parent
69e9596c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
10 deletions
+3
-10
server.py
server.py
+3
-10
No files found.
server.py
View file @
e9d8166d
...
...
@@ -40,7 +40,7 @@ def addadmin():
admin_hashed_pw
=
pbkdf2_sha256
.
encrypt
(
admin_pass
,
rounds
=
200000
,
salt_size
=
16
)
u
=
User
(
admin_real_name
,
admin_login
,
admin_hashed_pw
,
[
"admin"
,
"user"
])
db
.
session
.
add
(
u
)
db
.
session
.
commit
(
u
)
db
.
session
.
commit
()
else
:
print
(
"The provided data was invalid."
)
...
...
@@ -55,20 +55,13 @@ def adduser():
admin_hashed_pw
=
pbkdf2_sha256
.
encrypt
(
admin_pass
,
rounds
=
200000
,
salt_size
=
16
)
u
=
User
(
admin_real_name
,
admin_login
,
admin_hashed_pw
,
[
"user"
])
db
.
session
.
add
(
u
)
db
.
session
.
commit
(
u
)
db
.
session
.
commit
()
else
:
print
(
"The provided data was invalid."
)
@
app
.
route
(
"/"
)
def
index
():
if
not
len
(
db
.
session
.
query
(
User
).
all
())
>
0
:
fullname
=
input
(
"Fullname for admin user:"
)
username
=
input
(
"Username for admin user:"
)
password
=
pbkdf2_sha256
.
encrypt
(
input
(
"Password for admin user:"
),
rounds
=
200000
,
salt_size
=
16
)
user
=
User
(
fullname
,
username
,
password
,
[
"admin"
,
"user"
])
db
.
session
.
add
(
user
)
db
.
session
.
commit
()
topics
=
Topic
.
query
.
all
()
topics
=
Topic
.
query
.
all
()
meta
=
[]
for
topic
in
topics
:
ls
=
speech
.
query_statements
(
topic
.
mode
,
topic
.
id
)
...
...
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