summaryrefslogtreecommitdiff
path: root/Project-Unite/Controllers
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-04-10 18:44:29 -0400
committerMichael <[email protected]>2017-04-10 18:44:33 -0400
commit72feceb3690f6fc76fa7dd91002c814bf32565b8 (patch)
tree6d9b798ddaf8e5184e906069f2c450db0bf73e9f /Project-Unite/Controllers
parent147f266e68cf575daa3c29c51aba362d06544c71 (diff)
downloadproject-unite-72feceb3690f6fc76fa7dd91002c814bf32565b8.tar.gz
project-unite-72feceb3690f6fc76fa7dd91002c814bf32565b8.tar.bz2
project-unite-72feceb3690f6fc76fa7dd91002c814bf32565b8.zip
Fix massive security bug with display names
Diffstat (limited to 'Project-Unite/Controllers')
-rw-r--r--Project-Unite/Controllers/AccountController.cs10
1 files changed, 10 insertions, 0 deletions
diff --git a/Project-Unite/Controllers/AccountController.cs b/Project-Unite/Controllers/AccountController.cs
index e23572d..6ee32d0 100644
--- a/Project-Unite/Controllers/AccountController.cs
+++ b/Project-Unite/Controllers/AccountController.cs
@@ -179,6 +179,16 @@ The addressed used to send this message is not a no-reply address. In fact, my n
{
if (ModelState.IsValid)
{
+ using(var temp = new ApplicationDbContext())
+ {
+ if(temp.Users.FirstOrDefault(x=>x.UserName==model.Username) != null)
+ {
+ ModelState.AddModelError("Your display name is already taken.");
+ return View(model);
+ }
+ }
+
+
var user = new ApplicationUser { UserName = model.Email, Email = model.Email, DisplayName = model.Username, Codepoints = 0, JoinedAt = DateTime.Now, MutedAt = DateTime.Now, BannedAt = DateTime.Now, LastLogin = DateTime.Now };
var result = await UserManager.CreateAsync(user, model.Password);
if (result.Succeeded)