apidoc updates
This commit is contained in:
@@ -4,21 +4,19 @@ from flask_apispec import use_kwargs, marshal_with, doc
|
||||
from marshmallow import fields
|
||||
|
||||
from api.exceptions import BadRequestException
|
||||
from api.utils import docwrap
|
||||
import api.constants as constants
|
||||
|
||||
from .serializers import token_response_schema
|
||||
from .serializers import token_response_schema, login_schema
|
||||
blueprint = Blueprint('login', __name__)
|
||||
|
||||
|
||||
@doc(tags=['login'])
|
||||
@docwrap('Login', None)
|
||||
@blueprint.route('', methods=['POST'])
|
||||
@jwt_required(optional=True)
|
||||
@use_kwargs({
|
||||
'username': fields.Str(required=True),
|
||||
'password': fields.Str(required=True)
|
||||
})
|
||||
@use_kwargs(login_schema)
|
||||
@marshal_with(token_response_schema)
|
||||
def login_user(username, password, **kwargs):
|
||||
def login_user(username, password):
|
||||
if username == constants.API_USER and password == current_app.config[constants.API_PASS]:
|
||||
return {'token': create_access_token(identity=username, fresh=True, expires_delta=False)}
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user