Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
redeleitsystem
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
redl
redeleitsystem
Commits
e9d8166d
Commit
e9d8166d
authored
9 years ago
by
Robin Sonnabend
Browse files
Options
Downloads
Patches
Plain Diff
Removed creating an admin user in a request
parent
69e9596c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
server.py
+3
-10
3 additions, 10 deletions
server.py
with
3 additions
and
10 deletions
server.py
+
3
−
10
View file @
e9d8166d
...
@@ -40,7 +40,7 @@ def addadmin():
...
@@ -40,7 +40,7 @@ def addadmin():
admin_hashed_pw
=
pbkdf2_sha256
.
encrypt
(
admin_pass
,
rounds
=
200000
,
salt_size
=
16
)
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
"
])
u
=
User
(
admin_real_name
,
admin_login
,
admin_hashed_pw
,
[
"
admin
"
,
"
user
"
])
db
.
session
.
add
(
u
)
db
.
session
.
add
(
u
)
db
.
session
.
commit
(
u
)
db
.
session
.
commit
()
else
:
else
:
print
(
"
The provided data was invalid.
"
)
print
(
"
The provided data was invalid.
"
)
...
@@ -55,19 +55,12 @@ def adduser():
...
@@ -55,19 +55,12 @@ def adduser():
admin_hashed_pw
=
pbkdf2_sha256
.
encrypt
(
admin_pass
,
rounds
=
200000
,
salt_size
=
16
)
admin_hashed_pw
=
pbkdf2_sha256
.
encrypt
(
admin_pass
,
rounds
=
200000
,
salt_size
=
16
)
u
=
User
(
admin_real_name
,
admin_login
,
admin_hashed_pw
,
[
"
user
"
])
u
=
User
(
admin_real_name
,
admin_login
,
admin_hashed_pw
,
[
"
user
"
])
db
.
session
.
add
(
u
)
db
.
session
.
add
(
u
)
db
.
session
.
commit
(
u
)
db
.
session
.
commit
()
else
:
else
:
print
(
"
The provided data was invalid.
"
)
print
(
"
The provided data was invalid.
"
)
@app.route
(
"
/
"
)
@app.route
(
"
/
"
)
def
index
():
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
=
[]
meta
=
[]
for
topic
in
topics
:
for
topic
in
topics
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment