diff --git a/Project-Unite/Controllers/AccountController.cs b/Project-Unite/Controllers/AccountController.cs index 2eb5806..9dd86aa 100644 --- a/Project-Unite/Controllers/AccountController.cs +++ b/Project-Unite/Controllers/AccountController.cs @@ -200,7 +200,7 @@ public async Task Register(RegisterViewModel 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 user = new ApplicationUser { SystemName = model.SystemName, 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) { diff --git a/Project-Unite/Models/AccountViewModels.cs b/Project-Unite/Models/AccountViewModels.cs index 30f24f1..4850c7c 100644 --- a/Project-Unite/Models/AccountViewModels.cs +++ b/Project-Unite/Models/AccountViewModels.cs @@ -69,6 +69,11 @@ public class RegisterViewModel [Display(Name = "Email")] public string Email { get; set; } + [Required(ErrorMessage = "You require a system name. This is the hostname you will use when inside ShiftOS.")] + [MinLength(5, ErrorMessage ="Your System Name must have at least 5 characters in it.")] + [Display(Name ="System Name")] + public string SystemName { get; set; } + [Required] [MaxLength(25, ErrorMessage ="Your username must be less than 25 characters long.")] [MinLength(3, ErrorMessage ="Your username must have a minimum of 3 characters.")] diff --git a/Project-Unite/Views/Account/Register.cshtml b/Project-Unite/Views/Account/Register.cshtml index e8f43a4..b708b5c 100644 --- a/Project-Unite/Views/Account/Register.cshtml +++ b/Project-Unite/Views/Account/Register.cshtml @@ -27,6 +27,14 @@ @Html.TextBoxFor(m => m.Username, new { @class = "form-control" }) +
+ @Html.LabelFor(m => m.SystemName, new { @class = "col-md-2 control-label" }) +
+ @Html.TextBoxFor(m => m.SystemName, new { @class = "form-control" }) +
+
+ +
@Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" })