enh: display b64 encoded apikey on creation through the API (#870)

This commit is contained in:
jbe-dw 2021-01-24 09:43:51 +01:00 committed by GitHub
parent 7f86730909
commit 3a4efebf95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,6 @@
import json
from urllib.parse import urljoin
from base64 import b64encode
from flask import (
Blueprint, g, request, abort, current_app, make_response, jsonify,
)
@ -357,6 +358,7 @@ def api_generate_apikey():
current_app.logger.error('Error: {0}'.format(e))
raise ApiKeyCreateFail(message='Api key create failed')
apikey.plain_key = b64encode(apikey.plain_key.encode('utf-8')).decode('utf-8')
return jsonify(apikey_plain_schema.dump([apikey])[0]), 201