From 3a4efebf954da533b3df1a7fca375ce68b47285e Mon Sep 17 00:00:00 2001 From: jbe-dw <50663045+jbe-dw@users.noreply.github.com> Date: Sun, 24 Jan 2021 09:43:51 +0100 Subject: [PATCH] enh: display b64 encoded apikey on creation through the API (#870) --- powerdnsadmin/routes/api.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/powerdnsadmin/routes/api.py b/powerdnsadmin/routes/api.py index 738c933..e33c946 100644 --- a/powerdnsadmin/routes/api.py +++ b/powerdnsadmin/routes/api.py @@ -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