Show email, company, stand in header, v1.0.5
This commit is contained in:
@@ -26,6 +26,23 @@ def _client_id(token):
|
||||
return ""
|
||||
|
||||
|
||||
def _token_info(token):
|
||||
import base64, json
|
||||
try:
|
||||
parts = token.split(".")
|
||||
if len(parts) >= 2:
|
||||
payload = base64.urlsafe_b64decode(parts[1] + "==")
|
||||
d = json.loads(payload)
|
||||
return {
|
||||
"email": d.get("email", ""),
|
||||
"company": d.get("company_name", ""),
|
||||
"client_id": d.get("ClientID", ""),
|
||||
}
|
||||
except Exception:
|
||||
pass
|
||||
return {}
|
||||
|
||||
|
||||
@bp.route("/", methods=["GET", "POST"])
|
||||
def index():
|
||||
env_token = current_app.config["NUBES_API_TOKEN"]
|
||||
@@ -88,6 +105,7 @@ def index():
|
||||
env_token_masked=_mask(env_token),
|
||||
has_user_token=bool(user_token),
|
||||
client_id=_client_id(active_token),
|
||||
token_info=_token_info(active_token),
|
||||
instance_groups=instance_groups)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user