fix: stabilize admin social redirect
This commit is contained in:
@@ -341,6 +341,21 @@ def admin_auth_social_callback():
|
||||
)
|
||||
|
||||
|
||||
@api_social_bp.route("/yuyx/api/admin-auth/social/session", methods=["GET"])
|
||||
def admin_auth_social_session():
|
||||
admin_id = int(session.get("admin_id") or 0)
|
||||
if not admin_id:
|
||||
return jsonify({"authenticated": False}), 401
|
||||
admin = database.get_admin_by_id(admin_id)
|
||||
if not admin:
|
||||
session.pop("admin_id", None)
|
||||
session.pop("admin_username", None)
|
||||
session.pop("admin_reauth_until", None)
|
||||
session.modified = True
|
||||
return jsonify({"authenticated": False}), 401
|
||||
return jsonify({"authenticated": True, "username": admin.get("username") or ""})
|
||||
|
||||
|
||||
@api_social_bp.route("/yuyx/api/admin-auth/social/qr", methods=["GET"])
|
||||
def admin_auth_social_qr():
|
||||
value = str(request.args.get("data") or "").strip()
|
||||
|
||||
Reference in New Issue
Block a user