fix: repair firefly reset handler
This commit is contained in:
parent
f08ec8310e
commit
f97a6f6322
@ -442,29 +442,29 @@ def register(app) -> None:
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
email = mailu_email or keycloak_email or f\"{username}@{settings.MAILU_DOMAIN}\"
|
email = mailu_email or keycloak_email or f"{username}@{settings.MAILU_DOMAIN}"
|
||||||
password = random_password(24)
|
password = random_password(24)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = trigger_firefly_user_sync(username, email, password, wait=True)
|
result = trigger_firefly_user_sync(username, email, password, wait=True)
|
||||||
status_val = result.get(\"status\") if isinstance(result, dict) else \"error\"
|
status_val = result.get("status") if isinstance(result, dict) else "error"
|
||||||
if status_val != \"ok\":
|
if status_val != "ok":
|
||||||
raise RuntimeError(f\"firefly sync {status_val}\")
|
raise RuntimeError(f"firefly sync {status_val}")
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
message = str(exc).strip() or \"firefly sync failed\"
|
message = str(exc).strip() or "firefly sync failed"
|
||||||
return jsonify({\"error\": message}), 502
|
return jsonify({"error": message}), 502
|
||||||
|
|
||||||
try:
|
try:
|
||||||
admin_client().set_user_attribute(username, \"firefly_password\", password)
|
admin_client().set_user_attribute(username, "firefly_password", password)
|
||||||
admin_client().set_user_attribute(
|
admin_client().set_user_attribute(
|
||||||
username,
|
username,
|
||||||
\"firefly_password_updated_at\",
|
"firefly_password_updated_at",
|
||||||
time.strftime(\"%Y-%m-%dT%H:%M:%SZ\", time.gmtime()),
|
time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
|
||||||
)
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
return jsonify({\"error\": \"failed to store firefly password\"}), 502
|
return jsonify({"error": "failed to store firefly password"}), 502
|
||||||
|
|
||||||
return jsonify({\"status\": \"ok\", \"password\": password})
|
return jsonify({"status": "ok", "password": password})
|
||||||
|
|
||||||
@app.route("/api/account/nextcloud/mail/sync", methods=["POST"])
|
@app.route("/api/account/nextcloud/mail/sync", methods=["POST"])
|
||||||
@require_auth
|
@require_auth
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user