Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -1368,25 +1368,6 @@ def admin_list_stories():
|
|
| 1368 |
except Exception as e:
|
| 1369 |
return jsonify({'error': str(e)}), 500
|
| 1370 |
|
| 1371 |
-
@app.route('/api/admin/reset-password', methods=['PUT'])
|
| 1372 |
-
def admin_reset_own_password():
|
| 1373 |
-
try:
|
| 1374 |
-
auth_header = request.headers.get('Authorization', '')
|
| 1375 |
-
admin_uid = verify_admin(auth_header) # Ensure caller is an admin
|
| 1376 |
-
if not admin_uid:
|
| 1377 |
-
return jsonify({'error': 'Unauthorized: Admin access required'}), 401
|
| 1378 |
-
|
| 1379 |
-
data = request.get_json()
|
| 1380 |
-
new_password = data.get('new_password')
|
| 1381 |
-
if not new_password:
|
| 1382 |
-
return jsonify({'error': 'new_password is required'}), 400
|
| 1383 |
-
|
| 1384 |
-
# Use Firebase Admin SDK to update admin password
|
| 1385 |
-
auth.update_user(admin_uid, password=new_password)
|
| 1386 |
-
|
| 1387 |
-
return jsonify({'success': True, 'message': 'Password updated successfully.'})
|
| 1388 |
-
except Exception as e:
|
| 1389 |
-
return jsonify({'error': str(e)}), 500
|
| 1390 |
|
| 1391 |
# ---------- Admin Endpoint to Directly Update Credits ----------
|
| 1392 |
@app.route('/api/admin/users/<string:uid>/credits', methods=['PUT'])
|
|
|
|
| 1368 |
except Exception as e:
|
| 1369 |
return jsonify({'error': str(e)}), 500
|
| 1370 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1371 |
|
| 1372 |
# ---------- Admin Endpoint to Directly Update Credits ----------
|
| 1373 |
@app.route('/api/admin/users/<string:uid>/credits', methods=['PUT'])
|