mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-17 22:14:25 +01:00
Fix potential api glitches and fix team creation error rendering
This commit is contained in:
@@ -211,7 +211,9 @@ class TeamSchema(ma.ModelSchema):
|
||||
else:
|
||||
target_team = current_team
|
||||
|
||||
if self.view == "admin":
|
||||
# We are editting an existing
|
||||
if self.view == "admin" and self.instance:
|
||||
target_team = self.instance
|
||||
provided_ids = []
|
||||
for f in fields:
|
||||
f.pop("id", None)
|
||||
|
||||
@@ -205,7 +205,9 @@ class UserSchema(ma.ModelSchema):
|
||||
else:
|
||||
target_user = current_user
|
||||
|
||||
if self.view == "admin":
|
||||
# We are editting an existing user
|
||||
if self.view == "admin" and self.instance:
|
||||
target_user = self.instance
|
||||
provided_ids = []
|
||||
for f in fields:
|
||||
f.pop("id", None)
|
||||
|
||||
@@ -41,15 +41,15 @@ function createTeam(event) {
|
||||
const team_id = response.data.id;
|
||||
window.location = CTFd.config.urlRoot + "/admin/teams/" + team_id;
|
||||
} else {
|
||||
$("#team-info-form > #results").empty();
|
||||
$("#team-info-create-form > #results").empty();
|
||||
Object.keys(response.errors).forEach(function(key, _index) {
|
||||
$("#team-info-form > #results").append(
|
||||
$("#team-info-create-form > #results").append(
|
||||
ezBadge({
|
||||
type: "error",
|
||||
body: response.errors[key]
|
||||
})
|
||||
);
|
||||
const i = $("#team-info-form").find("input[name={0}]".format(key));
|
||||
const i = $("#team-info-create-form").find("input[name={0}]".format(key));
|
||||
const input = $(i);
|
||||
input.addClass("input-filled-invalid");
|
||||
input.removeClass("input-filled-valid");
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user