[Doc] pdoc route documentation test

This commit is contained in:
Ferdinand Thiessen 2020-10-30 02:28:15 +01:00
parent 6dfdffebf9
commit 56fff76bc2
1 changed files with 10 additions and 9 deletions

View File

@ -29,12 +29,14 @@ class AuthRoutePlugin(Plugin):
@auth_bp.route("/auth", methods=["POST"]) @auth_bp.route("/auth", methods=["POST"])
def _login(): 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: 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.") logger.debug("Start log in.")
data = request.get_json() data = request.get_json()
@ -48,7 +50,6 @@ def _login():
user = userController.login_user(userid, password) user = userController.login_user(userid, password)
if not user: if not user:
raise Unauthorized raise Unauthorized
logger.debug("user is {{ {} }}".format(user))
session = sessionController.create(user, user_agent=request.user_agent) session = sessionController.create(user, user_agent=request.user_agent)
logger.debug("token is {{ {} }}".format(session.token)) logger.debug("token is {{ {} }}".format(session.token))
logger.info("User {{ {} }} success login.".format(userid)) logger.info("User {{ {} }} success login.".format(userid))