mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-29 10:55:42 +00:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
942269099c | ||
|
|
cd345c63be |
@@ -1712,12 +1712,20 @@ func handleSetUserDisplayName(w http.ResponseWriter, r *http.Request, userID str
|
||||
return
|
||||
}
|
||||
|
||||
if err := r.ParseForm(); err != nil {
|
||||
http.Error(w, "Invalid form data", http.StatusBadRequest)
|
||||
return
|
||||
// Debug: log content type and try both parsing methods
|
||||
contentType := r.Header.Get("Content-Type")
|
||||
log.Printf("[Debug] SetDisplayName Content-Type: %s", contentType)
|
||||
|
||||
if err := r.ParseMultipartForm(32 << 20); err != nil {
|
||||
log.Printf("[Debug] ParseMultipartForm error: %v, trying ParseForm", err)
|
||||
if err := r.ParseForm(); err != nil {
|
||||
http.Error(w, "Invalid form data", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
displayName := r.FormValue("display_name")
|
||||
log.Printf("[Debug] Parsed display_name: %q, Form: %v, PostForm: %v", displayName, r.Form, r.PostForm)
|
||||
|
||||
ctx, cancel := createAdminContext(r)
|
||||
defer cancel()
|
||||
@@ -1753,12 +1761,18 @@ func handleSetUserAdmin(w http.ResponseWriter, r *http.Request, userID string) {
|
||||
return
|
||||
}
|
||||
|
||||
if err := r.ParseForm(); err != nil {
|
||||
http.Error(w, "Invalid form data", http.StatusBadRequest)
|
||||
return
|
||||
// Parse multipart form (FormData from JavaScript sends multipart/form-data)
|
||||
if err := r.ParseMultipartForm(32 << 20); err != nil {
|
||||
// Fall back to regular form parsing for application/x-www-form-urlencoded
|
||||
if err := r.ParseForm(); err != nil {
|
||||
http.Error(w, "Invalid form data", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
isAdmin := r.FormValue("is_admin") == "true"
|
||||
isAdminStr := r.FormValue("is_admin")
|
||||
isAdmin := isAdminStr == "true"
|
||||
log.Printf("[Debug] SetUserAdmin: is_admin=%q, parsed=%v", isAdminStr, isAdmin)
|
||||
|
||||
ctx, cancel := createAdminContext(r)
|
||||
defer cancel()
|
||||
|
||||
@@ -100,8 +100,8 @@
|
||||
<div id="edit-feedback"></div>
|
||||
</form>
|
||||
<footer>
|
||||
<button class="secondary" onclick="document.getElementById('edit-modal').close()">Cancel</button>
|
||||
<button onclick="saveUserChanges()">Save Changes</button>
|
||||
<button type="button" class="secondary" onclick="document.getElementById('edit-modal').close()">Cancel</button>
|
||||
<button type="button" onclick="saveUserChanges()">Save Changes</button>
|
||||
</footer>
|
||||
</article>
|
||||
</dialog>
|
||||
@@ -124,6 +124,7 @@ function saveUserChanges() {
|
||||
const isAdmin = document.getElementById('edit-is-admin').checked;
|
||||
const feedback = document.getElementById('edit-feedback');
|
||||
|
||||
console.log('saveUserChanges called:', {userId, displayName, isAdmin, originalIsAdmin});
|
||||
feedback.innerHTML = '<p>Saving...</p>';
|
||||
|
||||
// Update display name
|
||||
|
||||
Reference in New Issue
Block a user