diff --git a/WebLedMatrix.Matrix/Logic/ServiceWrapper.cs b/WebLedMatrix.Matrix/Logic/ServiceWrapper.cs index edf1b0d..04df870 100644 --- a/WebLedMatrix.Matrix/Logic/ServiceWrapper.cs +++ b/WebLedMatrix.Matrix/Logic/ServiceWrapper.cs @@ -31,14 +31,13 @@ public void SetName(string name) try { _client.UnRegisterMatrix(_name); + _name = name; + _client.RegisterMatrix(_name); } catch (Exception ) { //Connection has been lost } - - _name = name; - _client.RegisterMatrix(_name); } } } \ No newline at end of file diff --git a/WebLedMatrix.Matrix/OutputWindow.xaml b/WebLedMatrix.Matrix/OutputWindow.xaml index ca596ae..6c8137c 100644 --- a/WebLedMatrix.Matrix/OutputWindow.xaml +++ b/WebLedMatrix.Matrix/OutputWindow.xaml @@ -1,4 +1,5 @@ -(); SetName = new RelayCommand(() => { + if (NodeName.Contains(" ")) + { + MessageBox.Show("Name cannot contain spaces", "Error!"); + return; + } _serviceWrapper.SetName(NodeName); Messenger.Default.Send(new NotificationMessage(MessageStrings.Show)); }); diff --git a/WebLedMatrix/Controllers/AccountController.cs b/WebLedMatrix/Controllers/AccountController.cs index faf8f0c..f1f3384 100644 --- a/WebLedMatrix/Controllers/AccountController.cs +++ b/WebLedMatrix/Controllers/AccountController.cs @@ -68,10 +68,8 @@ public PartialViewResult Login(LoginModel loginModel) { if (HttpContext.User.Identity.IsAuthenticated) return PartialView("Greetings", User.Identity.Name); - if (ModelState.IsValid && Manager.TryLogin(loginModel)) return PartialView("AccessGranted"); - ModelState.AddModelError(string.Empty,"Input incorrect data"); return PartialView(loginModel); diff --git a/WebLedMatrix/Controllers/Authentication/Abstract/ITwinUser.cs b/WebLedMatrix/Controllers/Authentication/Abstract/ITwinUser.cs index 35519df..8f95f65 100644 --- a/WebLedMatrix/Controllers/Authentication/Abstract/ITwinUser.cs +++ b/WebLedMatrix/Controllers/Authentication/Abstract/ITwinUser.cs @@ -1,4 +1,5 @@ using System.ComponentModel.DataAnnotations; +using WebLedMatrix.Logic.Authentication.Models.Roles; namespace WebLedMatrix.Logic.Authentication.Abstract { @@ -12,5 +13,8 @@ public interface ITwinUser [Required] string TelephoneNumber { get; set; } + + [Required] + string About { get; set; } } } \ No newline at end of file diff --git a/WebLedMatrix/Controllers/Authentication/Infrastructure/UserIdentityDbContext.cs b/WebLedMatrix/Controllers/Authentication/Infrastructure/UserIdentityDbContext.cs index efff9f7..921d104 100644 --- a/WebLedMatrix/Controllers/Authentication/Infrastructure/UserIdentityDbContext.cs +++ b/WebLedMatrix/Controllers/Authentication/Infrastructure/UserIdentityDbContext.cs @@ -5,8 +5,10 @@ namespace WebLedMatrix.Logic.Authentication.Infrastructure { public class UserIdentityDbContext : IdentityDbContext { - public UserIdentityDbContext() : base("Server=tcp:data11admin.database.windows.net,1433;Database=TestDatabase;User ID=admin1@data11admin;Password=Data123456!;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;") {} - + public UserIdentityDbContext(): base("Server=tcp:data11admin.database.windows.net,1433;Initial Catalog=TestDatabase;Persist Security Info=False;User ID=admin1@data11admin;Password=Data123456!;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;") + { + + } static UserIdentityDbContext() { System.Data.Entity.Database.SetInitializer(new UserIdentityDbInitialize()); diff --git a/WebLedMatrix/Controllers/Authentication/Infrastructure/UserIdentityDbInitialize.cs b/WebLedMatrix/Controllers/Authentication/Infrastructure/UserIdentityDbInitialize.cs index d8b46c5..4fb3de2 100644 --- a/WebLedMatrix/Controllers/Authentication/Infrastructure/UserIdentityDbInitialize.cs +++ b/WebLedMatrix/Controllers/Authentication/Infrastructure/UserIdentityDbInitialize.cs @@ -16,8 +16,8 @@ protected override void Seed(UserIdentityDbContext context) base.Seed(context); } - private string userName = "Admin"; - private string password = "ChangeThisPassword1"; + private string userName = "Administrator"; + private string password = "Admin1"; private string email = "admin@admin.admin"; private string firstName = "TWIN"; private string lastName= "TWIN"; diff --git a/WebLedMatrix/Controllers/Authentication/Models/CreationModel.cs b/WebLedMatrix/Controllers/Authentication/Models/CreationModel.cs index efe4d46..30db366 100644 --- a/WebLedMatrix/Controllers/Authentication/Models/CreationModel.cs +++ b/WebLedMatrix/Controllers/Authentication/Models/CreationModel.cs @@ -17,5 +17,7 @@ public class CreationModel : ITwinUser public string LastName { get; set; } [Required] public string TelephoneNumber { get; set; } + [Required] + public string About { get; set; } } } \ No newline at end of file diff --git a/WebLedMatrix/Controllers/Authentication/Models/Roles/TypicalRoles.cs b/WebLedMatrix/Controllers/Authentication/Models/Roles/TypicalRoles.cs index 4fd493a..dc07fbd 100644 --- a/WebLedMatrix/Controllers/Authentication/Models/Roles/TypicalRoles.cs +++ b/WebLedMatrix/Controllers/Authentication/Models/Roles/TypicalRoles.cs @@ -1,6 +1,6 @@ namespace WebLedMatrix.Logic.Authentication.Models.Roles { - enum TypicalRoles + public enum TypicalRoles { User, Speaker, diff --git a/WebLedMatrix/Migrations/Configuration.cs b/WebLedMatrix/Migrations/Configuration.cs new file mode 100644 index 0000000..46f5738 --- /dev/null +++ b/WebLedMatrix/Migrations/Configuration.cs @@ -0,0 +1,31 @@ +namespace WebLedMatrix.Migrations +{ + using System; + using System.Data.Entity; + using System.Data.Entity.Migrations; + using System.Linq; + + internal sealed class Configuration : DbMigrationsConfiguration + { + public Configuration() + { + AutomaticMigrationsEnabled = true; + } + + protected override void Seed(WebLedMatrix.Logic.Authentication.Infrastructure.UserIdentityDbContext context) + { + // This method will be called after migrating to the latest version. + + // You can use the DbSet.AddOrUpdate() helper extension method + // to avoid creating duplicate seed data. E.g. + // + // context.People.AddOrUpdate( + // p => p.FullName, + // new Person { FullName = "Andrew Peters" }, + // new Person { FullName = "Brice Lambson" }, + // new Person { FullName = "Rowan Miller" } + // ); + // + } + } +} diff --git a/WebLedMatrix/Models/AdministrationModel.cs b/WebLedMatrix/Models/AdministrationModel.cs index cda99f1..eb0b599 100644 --- a/WebLedMatrix/Models/AdministrationModel.cs +++ b/WebLedMatrix/Models/AdministrationModel.cs @@ -7,5 +7,6 @@ public class AdministrationModel { public string Id { get; set; } public string Name { get; set; } + public int Value { get; set; } } } \ No newline at end of file diff --git a/WebLedMatrix/WebLedMatrix.Server.csproj b/WebLedMatrix/WebLedMatrix.Server.csproj index a36f694..b5f2f76 100644 --- a/WebLedMatrix/WebLedMatrix.Server.csproj +++ b/WebLedMatrix/WebLedMatrix.Server.csproj @@ -269,6 +269,7 @@ +