aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
Diffstat (limited to 'backend')
-rw-r--r--backend/api/api/Controllers/UserController.cs11
1 files changed, 10 insertions, 1 deletions
diff --git a/backend/api/api/Controllers/UserController.cs b/backend/api/api/Controllers/UserController.cs
index 9f736679..9796afc2 100644
--- a/backend/api/api/Controllers/UserController.cs
+++ b/backend/api/api/Controllers/UserController.cs
@@ -125,7 +125,16 @@ namespace api.Controllers
if (username == null)
return BadRequest();
- return Ok(userService.Update(username, user));
+ if (user.Username != username)
+ {
+ User user2 = userService.GetUserByUsername(user.Username);
+ if (user2 == null)
+ return Ok(userService.Update(username, user));
+ else
+ return BadRequest("Username already exists!");
+ }
+ else
+ return Ok(userService.Update(username, user));
}
// DELETE api/<UserController>/5