mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-08 22:50:26 +00:00
enh: display b64 encoded apikey on creation through the API (#870)
This commit is contained in:
parent
7f86730909
commit
3a4efebf95
@ -1,5 +1,6 @@
|
|||||||
import json
|
import json
|
||||||
from urllib.parse import urljoin
|
from urllib.parse import urljoin
|
||||||
|
from base64 import b64encode
|
||||||
from flask import (
|
from flask import (
|
||||||
Blueprint, g, request, abort, current_app, make_response, jsonify,
|
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))
|
current_app.logger.error('Error: {0}'.format(e))
|
||||||
raise ApiKeyCreateFail(message='Api key create failed')
|
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
|
return jsonify(apikey_plain_schema.dump([apikey])[0]), 201
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user