[Doc] pdoc route documentation test
This commit is contained in:
parent
6dfdffebf9
commit
56fff76bc2
|
@ -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/<token> GET: get lifetime of token
|
||||
/auth/<token> 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))
|
||||
|
|
Loading…
Reference in New Issue