From 56fff76bc2ddd8f5e5418b620fca1e47a11319a8 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Fri, 30 Oct 2020 02:28:15 +0100 Subject: [PATCH] [Doc] pdoc route documentation test --- flaschengeist/modules/auth/__init__.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/flaschengeist/modules/auth/__init__.py b/flaschengeist/modules/auth/__init__.py index c19e4a9..5c279b3 100644 --- a/flaschengeist/modules/auth/__init__.py +++ b/flaschengeist/modules/auth/__init__.py @@ -2,13 +2,13 @@ Allow management of authentication, login, logout, etc. - Routes + Routes -/auth POST: login (new token) + /auth POST: login (new token) GET: get all tokens for user -/auth/ GET: get lifetime of token + /auth/ GET: get lifetime of token PUT: set new lifetime - DELETE: logout / delete token + DELETE: logout / delete token """ from flask import Blueprint, request, jsonify @@ -29,12 +29,14 @@ class AuthRoutePlugin(Plugin): @auth_bp.route("/auth", methods=["POST"]) def _login(): - """Login User + """Login in an user and create a `flaschengeist.system.models.Session` for the user. + + Route: /auth + POST-data: {'userid': string, 'password': string} - Login in User and create a Session for the User. - Requires POST data {'userid': string, 'password': string} Returns: - A JSON-File with user information and created token or errors + A JSON object with `flaschengeist.system.models.user.User` and created + `flaschengeist.system.models.session.Session` or HTTP error """ logger.debug("Start log in.") data = request.get_json() @@ -48,7 +50,6 @@ def _login(): user = userController.login_user(userid, password) if not user: raise Unauthorized - logger.debug("user is {{ {} }}".format(user)) session = sessionController.create(user, user_agent=request.user_agent) logger.debug("token is {{ {} }}".format(session.token)) logger.info("User {{ {} }} success login.".format(userid))