Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions api_views/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,11 @@ def register_user():
try:
# validate the data are in the correct form
jsonschema.validate(request_data, register_user_schema)
if vuln and 'admin' in request_data: # User is possible to define if she/he wants to be an admin !!
if request_data['admin']:
admin = True
else:
admin = False
user = User(username=request_data['username'], password=request_data['password'],
email=request_data['email'], admin=admin)
else:
user = User(username=request_data['username'], password=request_data['password'],
email=request_data['email'])
# Privilege level is never taken from client input: newly self-registered
# accounts are always created as non-admin, no matter what extra fields
# (e.g. "admin") the caller stuffs into the request body.
user = User(username=request_data['username'], password=request_data['password'],
email=request_data['email'])
db.session.add(user)
db.session.commit()

Expand Down
Loading