Commit fcf35d94 authored by Lysander Trischler's avatar Lysander Trischler

Use API password auth also on POST

parent 041e6941
......@@ -813,6 +813,7 @@ if __name__ == "__main__":
user = tornadyse.isobeef_ldap_auth(self, username, password)
if user is not None:
return user
logging.debug("IsoBeef LDAP auth failed, trying API password auth!")
user = self.db.get("""SELECT username, display_name
FROM users
WHERE username = %s AND api_password = %s
......@@ -821,6 +822,7 @@ if __name__ == "__main__":
kraftwerk_api_password_hash(username, password))
if user is not None:
return tornadyse.DummyIsoBeefLDAPUser(**user)
logging.warn("Both IsoBeef LDAP auth and API password auth failed for user %r!" % username)
return None
@route(r'/api/exercises')
......@@ -879,7 +881,7 @@ if __name__ == "__main__":
csv_encode(exercise.end.strftime("%Y-%m-%dT%H:%M:%SZ")),
))
@tornadyse.basic_auth(tornadyse.isobeef_ldap_auth)
@tornadyse.basic_auth(isobeef_ldap_or_kraftwerk_api_password_auth)
def post(self):
data = self.get_json()
try:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment