From c9d1f4bac574b5585bb983c552f490ef2b1ec2ea Mon Sep 17 00:00:00 2001 From: VyacheslavDzhus Date: Wed, 14 Apr 2021 00:35:28 +0300 Subject: [PATCH 1/9] add js code and fix Register view --- .../Views/Auth/Register.cshtml | 201 +++++++++--------- .../wwwroot/js/site.js | 48 +++++ 2 files changed, 152 insertions(+), 97 deletions(-) create mode 100644 OutOfSchool/OutOfSchool.IdentityServer/wwwroot/js/site.js diff --git a/OutOfSchool/OutOfSchool.IdentityServer/Views/Auth/Register.cshtml b/OutOfSchool/OutOfSchool.IdentityServer/Views/Auth/Register.cshtml index 43e7e31692..b3d601779c 100644 --- a/OutOfSchool/OutOfSchool.IdentityServer/Views/Auth/Register.cshtml +++ b/OutOfSchool/OutOfSchool.IdentityServer/Views/Auth/Register.cshtml @@ -4,103 +4,110 @@ Layout = "_Layout"; }
-
-

ЗАРЕЄСТРУВАТИСЯ

-
Щоб мати змогу подавати заявки у гуртки або стати надавачем послуг
-
- - -
-
або заповніть форму
-
-
    -
  • - -
    - - -
    +
    +

    ЗАРЕЄСТРУВАТИСЯ

    +
    Щоб мати змогу подавати заявки у гуртки або стати надавачем послуг
    +
    + + +
    +
    або заповніть форму
    + + +
      +
    • + +
      +
      +
      + + + +
      + Користувач +
      +
      +
      + + + +
      + Надавач послуг +
      +
      + +
      +
    • +
    • + + +
    • +
    • + + +
    • +
    • + + +
    • +
    • + +
      +
      +38
      + + +
      +
    • +
    • + + +
    • +
    • + + + +
      + eye +
      +
    • +
    • +
      + Пароль має містити мінімум 6 символів +
      +
    • +
    • + + + +
      + eye +
      +
    • +
    • + + +
    • +
    • + Реєструючись я погоджуюсь з + Правилами користування + та надаю згоду на обробку персональних даних +
    • + +
    • + +
    • +
    + + -
  • -
  • - - -
  • -
  • - - -
  • -
  • - - -
  • -
  • - -
    -
    +38
    - -
    -
  • -
  • - - -
  • -
  • - - - -
  • -
  • -
    - Пароль має містити мінімум 6 символів -
    -
  • -
  • - - - -
  • -
  • - - -
  • -
  • - Реєструючись я погоджуюсь з - Правилами користування - та надаю згоду на обробку персональних даних -
  • -
  • - -
  • -
- - -
+ \ No newline at end of file diff --git a/OutOfSchool/OutOfSchool.IdentityServer/wwwroot/js/site.js b/OutOfSchool/OutOfSchool.IdentityServer/wwwroot/js/site.js new file mode 100644 index 0000000000..989f043c3c --- /dev/null +++ b/OutOfSchool/OutOfSchool.IdentityServer/wwwroot/js/site.js @@ -0,0 +1,48 @@ +let btn_parent = document.getElementById('btn_parent'); +let btn_provider = document.getElementById('btn_provider'); +let btn_register = document.getElementById('btn_register'); + +let passwordEye = document.getElementById('password_eye'); +let confirmPasswordEye = document.getElementById('confirm_password_eye'); + +let check_passwordEye = false; +let check_confirmPasswordEye = false; + +let password = document.getElementById('password'); +let repeatPassword = document.getElementById('repeat_password'); + +btn_parent.addEventListener('click', function () { + btn_parent.className = "registration_type registration_type-active"; + btn_provider.className = "registration_type"; + btn_register.setAttribute("name", "Parent"); +}) + +btn_provider.addEventListener('click', function () { + btn_provider.className = "registration_type registration_type-active"; + btn_parent.className = "registration_type"; + btn_register.setAttribute("name", "Provider"); +}) + +passwordEye.addEventListener('click', function () { + if (check_passwordEye) { + passwordEye.src = "/icons/ic_eye.svg"; + check_passwordEye = false; + password.setAttribute("type", "Password"); + } else { + passwordEye.src = "/icons/eye.svg"; + check_passwordEye = true; + password.setAttribute("type", "Text"); + } +}) + +confirmPasswordEye.addEventListener('click', function () { + if (check_confirmPasswordEye) { + confirmPasswordEye.src = "/icons/ic_eye.svg"; + check_confirmPasswordEye = false; + repeatPassword.setAttribute("type", "Password"); + } else { + confirmPasswordEye.src = "/icons/eye.svg"; + check_confirmPasswordEye = true; + repeatPassword.setAttribute("type", "Text"); + } +}) \ No newline at end of file From 170aef604b8643c939db5226d653e545732907c3 Mon Sep 17 00:00:00 2001 From: VyacheslavDzhus Date: Wed, 14 Apr 2021 00:50:48 +0300 Subject: [PATCH 2/9] update User and RegisterViewModel --- OutOfSchool/OutOfSchool.DataAccess/Models/User.cs | 4 ++++ .../Controllers/AuthController.cs | 9 ++++++--- .../ViewModels/RegisterViewModel.cs | 11 ++++++++--- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/OutOfSchool/OutOfSchool.DataAccess/Models/User.cs b/OutOfSchool/OutOfSchool.DataAccess/Models/User.cs index 6b6707ab5b..26488c100b 100644 --- a/OutOfSchool/OutOfSchool.DataAccess/Models/User.cs +++ b/OutOfSchool/OutOfSchool.DataAccess/Models/User.cs @@ -11,5 +11,9 @@ public class User : IdentityUser [DataType(DataType.DateTime)] public DateTime LastLogin { get; set; } + + public string LastName { get; set; } + + public string MiddleName { get; set; } } } \ No newline at end of file diff --git a/OutOfSchool/OutOfSchool.IdentityServer/Controllers/AuthController.cs b/OutOfSchool/OutOfSchool.IdentityServer/Controllers/AuthController.cs index 25249dd57b..c2a815d24e 100644 --- a/OutOfSchool/OutOfSchool.IdentityServer/Controllers/AuthController.cs +++ b/OutOfSchool/OutOfSchool.IdentityServer/Controllers/AuthController.cs @@ -138,9 +138,12 @@ public async Task Register(RegisterViewModel model) var user = new User() { - UserName = model.Username, - PhoneNumber = model.PhoneNumber, - CreatingTime = DateTime.Now, + UserName = model.Name, + LastName = model.LastName, + MiddleName = model.MiddleName, + Email = model.Email, + PhoneNumber = model.PhoneNumber, + CreatingTime = DateTime.Now, }; var result = await userManager.CreateAsync(user, model.Password); diff --git a/OutOfSchool/OutOfSchool.IdentityServer/ViewModels/RegisterViewModel.cs b/OutOfSchool/OutOfSchool.IdentityServer/ViewModels/RegisterViewModel.cs index 7e81226f24..136b3ffc52 100644 --- a/OutOfSchool/OutOfSchool.IdentityServer/ViewModels/RegisterViewModel.cs +++ b/OutOfSchool/OutOfSchool.IdentityServer/ViewModels/RegisterViewModel.cs @@ -5,9 +5,14 @@ namespace OutOfSchool.IdentityServer.ViewModels { public class RegisterViewModel { - [Required] - [MinLength(5)] - public string Username { get; set; } + [Required(ErrorMessage = "Name is required")] + public string Name { get; set; } + + [Required(ErrorMessage = "LastName is required")] + public string LastName { get; set; } + + [Required(ErrorMessage = "MiddleName is required")] + public string MiddleName { get; set; } [Required(ErrorMessage = "Password is required")] [RegularExpression( From cc33b6fc4819ff70daece3a8256426f30ed40943 Mon Sep 17 00:00:00 2001 From: VyacheslavDzhus Date: Wed, 14 Apr 2021 01:02:07 +0300 Subject: [PATCH 3/9] add migration updatedUser --- .../20210413215419_updatedUser.Designer.cs | 851 ++++++++++++++++++ .../20210413215419_updatedUser.cs | 167 ++++ .../OutOfSchoolDbContextModelSnapshot.cs | 23 +- 3 files changed, 1031 insertions(+), 10 deletions(-) create mode 100644 OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210413215419_updatedUser.Designer.cs create mode 100644 OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210413215419_updatedUser.cs diff --git a/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210413215419_updatedUser.Designer.cs b/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210413215419_updatedUser.Designer.cs new file mode 100644 index 0000000000..99d333fed0 --- /dev/null +++ b/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210413215419_updatedUser.Designer.cs @@ -0,0 +1,851 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using OutOfSchool.Services; + +namespace OutOfSchool.IdentityServer.Data.Migrations.OutOfSchoolMigrations +{ + [DbContext(typeof(OutOfSchoolDbContext))] + [Migration("20210413215419_updatedUser")] + partial class updatedUser + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseIdentityColumns() + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.2"); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex") + .HasFilter("[NormalizedName] IS NOT NULL"); + + b.ToTable("AspNetRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("nvarchar(450)"); + + b.Property("ProviderKey") + .HasColumnType("nvarchar(450)"); + + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("RoleId") + .HasColumnType("nvarchar(450)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("LoginProvider") + .HasColumnType("nvarchar(450)"); + + b.Property("Name") + .HasColumnType("nvarchar(450)"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens"); + }); + + modelBuilder.Entity("OutOfSchool.Services.Models.Address", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .UseIdentityColumn(); + + b.Property("BuildingNumber") + .IsRequired() + .HasMaxLength(15) + .HasColumnType("nvarchar(15)"); + + b.Property("City") + .IsRequired() + .HasMaxLength(15) + .HasColumnType("nvarchar(15)"); + + b.Property("District") + .HasColumnType("nvarchar(max)"); + + b.Property("Latitude") + .HasColumnType("float"); + + b.Property("Longitude") + .HasColumnType("float"); + + b.Property("Region") + .HasColumnType("nvarchar(max)"); + + b.Property("Street") + .IsRequired() + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.HasKey("Id"); + + b.ToTable("Addresses"); + }); + + modelBuilder.Entity("OutOfSchool.Services.Models.BirthCertificate", b => + { + b.Property("Id") + .HasColumnType("bigint"); + + b.Property("SvidDate") + .HasColumnType("datetime2"); + + b.Property("SvidNum") + .HasColumnType("nvarchar(max)"); + + b.Property("SvidNumMD5") + .HasColumnType("nvarchar(max)"); + + b.Property("SvidSer") + .HasColumnType("nvarchar(max)"); + + b.Property("SvidWho") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("BirthCertificates"); + }); + + modelBuilder.Entity("OutOfSchool.Services.Models.Category", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .UseIdentityColumn(); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Categories"); + }); + + modelBuilder.Entity("OutOfSchool.Services.Models.Child", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .UseIdentityColumn(); + + b.Property("AddressId") + .HasColumnType("bigint"); + + b.Property("DateOfBirth") + .HasColumnType("datetime2"); + + b.Property("FirstName") + .HasMaxLength(40) + .HasColumnType("nvarchar(40)"); + + b.Property("Gender") + .HasColumnType("int"); + + b.Property("LastName") + .HasMaxLength(40) + .HasColumnType("nvarchar(40)"); + + b.Property("ParentId") + .HasColumnType("bigint"); + + b.Property("Patronymic") + .HasMaxLength(40) + .HasColumnType("nvarchar(40)"); + + b.Property("SocialGroupId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("AddressId"); + + b.HasIndex("ParentId"); + + b.HasIndex("SocialGroupId"); + + b.ToTable("Children"); + }); + + modelBuilder.Entity("OutOfSchool.Services.Models.Parent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .UseIdentityColumn(); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)"); + + b.Property("MiddleName") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Parents"); + }); + + modelBuilder.Entity("OutOfSchool.Services.Models.Provider", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .UseIdentityColumn(); + + b.Property("AddressId") + .HasColumnType("bigint"); + + b.Property("AttachedDocuments") + .HasColumnType("nvarchar(max)"); + + b.Property("AuthorityHolder") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("Director") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("DirectorBirthDay") + .HasColumnType("datetime2"); + + b.Property("DirectorPhone") + .HasColumnType("nvarchar(max)"); + + b.Property("DirectorPosition") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("EDRPOU") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Facebook") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Form") + .HasColumnType("nvarchar(max)"); + + b.Property("INPP") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Index") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("Instagram") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("IsSubmitPZ1") + .HasColumnType("bit"); + + b.Property("KOATUU") + .HasColumnType("nvarchar(max)"); + + b.Property("MFO") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ManagerialBody") + .HasColumnType("nvarchar(max)"); + + b.Property("Ownership") + .HasColumnType("int"); + + b.Property("Profile") + .HasColumnType("int"); + + b.Property("ShortTitle") + .IsRequired() + .HasMaxLength(60) + .HasColumnType("nvarchar(60)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(60) + .HasColumnType("nvarchar(60)"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("Website") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.HasIndex("AddressId"); + + b.HasIndex("UserId"); + + b.ToTable("Providers"); + }); + + modelBuilder.Entity("OutOfSchool.Services.Models.SocialGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .UseIdentityColumn(); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("SocialGroups"); + }); + + modelBuilder.Entity("OutOfSchool.Services.Models.Subcategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .UseIdentityColumn(); + + b.Property("CategoryId") + .HasColumnType("bigint"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("CategoryId"); + + b.ToTable("Subcategories"); + }); + + modelBuilder.Entity("OutOfSchool.Services.Models.Teacher", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .UseIdentityColumn(); + + b.Property("BirthDay") + .HasColumnType("datetime2"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("Image") + .HasColumnType("nvarchar(max)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("MiddleName") + .IsRequired() + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("WorkshopId"); + + b.ToTable("Teachers"); + }); + + modelBuilder.Entity("OutOfSchool.Services.Models.User", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("CreatingTime") + .HasColumnType("datetime2"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("bit"); + + b.Property("LastLogin") + .HasColumnType("datetime2"); + + b.Property("LastName") + .HasColumnType("nvarchar(max)"); + + b.Property("LockoutEnabled") + .HasColumnType("bit"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("MiddleName") + .HasColumnType("nvarchar(max)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("bit"); + + b.Property("SecurityStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("TwoFactorEnabled") + .HasColumnType("bit"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex") + .HasFilter("[NormalizedUserName] IS NOT NULL"); + + b.ToTable("AspNetUsers"); + }); + + modelBuilder.Entity("OutOfSchool.Services.Models.Workshop", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .UseIdentityColumn(); + + b.Property("AddressId") + .HasColumnType("bigint"); + + b.Property("CategoryId") + .HasColumnType("bigint"); + + b.Property("DaysPerWeek") + .HasColumnType("int"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("DisabilityOptionsDesc") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Facebook") + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("Head") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("HeadBirthDate") + .HasColumnType("datetime2"); + + b.Property("Image") + .HasColumnType("nvarchar(max)"); + + b.Property("Instagram") + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("MaxAge") + .HasColumnType("int"); + + b.Property("MinAge") + .HasColumnType("int"); + + b.Property("Phone") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Price") + .HasColumnType("decimal(18,2)"); + + b.Property("ProviderId") + .HasColumnType("bigint"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(60) + .HasColumnType("nvarchar(60)"); + + b.Property("Website") + .HasColumnType("nvarchar(max)"); + + b.Property("WithDisabilityOptions") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.HasIndex("AddressId"); + + b.HasIndex("CategoryId"); + + b.HasIndex("ProviderId"); + + b.ToTable("Workshops"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("OutOfSchool.Services.Models.User", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("OutOfSchool.Services.Models.User", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("OutOfSchool.Services.Models.User", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("OutOfSchool.Services.Models.User", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("OutOfSchool.Services.Models.BirthCertificate", b => + { + b.HasOne("OutOfSchool.Services.Models.Child", "Child") + .WithOne("BirthCertificate") + .HasForeignKey("OutOfSchool.Services.Models.BirthCertificate", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Child"); + }); + + modelBuilder.Entity("OutOfSchool.Services.Models.Child", b => + { + b.HasOne("OutOfSchool.Services.Models.Address", "Address") + .WithMany() + .HasForeignKey("AddressId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("OutOfSchool.Services.Models.Parent", "Parent") + .WithMany("Children") + .HasForeignKey("ParentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("OutOfSchool.Services.Models.SocialGroup", "SocialGroup") + .WithMany("Children") + .HasForeignKey("SocialGroupId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Address"); + + b.Navigation("Parent"); + + b.Navigation("SocialGroup"); + }); + + modelBuilder.Entity("OutOfSchool.Services.Models.Parent", b => + { + b.HasOne("OutOfSchool.Services.Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("OutOfSchool.Services.Models.Provider", b => + { + b.HasOne("OutOfSchool.Services.Models.Address", "Address") + .WithMany() + .HasForeignKey("AddressId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("OutOfSchool.Services.Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Address"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("OutOfSchool.Services.Models.Subcategory", b => + { + b.HasOne("OutOfSchool.Services.Models.Category", "Category") + .WithMany("Subcategories") + .HasForeignKey("CategoryId"); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("OutOfSchool.Services.Models.Teacher", b => + { + b.HasOne("OutOfSchool.Services.Models.Workshop", "Workshop") + .WithMany("Teachers") + .HasForeignKey("WorkshopId"); + + b.Navigation("Workshop"); + }); + + modelBuilder.Entity("OutOfSchool.Services.Models.Workshop", b => + { + b.HasOne("OutOfSchool.Services.Models.Address", "Address") + .WithMany() + .HasForeignKey("AddressId"); + + b.HasOne("OutOfSchool.Services.Models.Category", "Category") + .WithMany() + .HasForeignKey("CategoryId"); + + b.HasOne("OutOfSchool.Services.Models.Provider", "Provider") + .WithMany("Workshops") + .HasForeignKey("ProviderId"); + + b.Navigation("Address"); + + b.Navigation("Category"); + + b.Navigation("Provider"); + }); + + modelBuilder.Entity("OutOfSchool.Services.Models.Category", b => + { + b.Navigation("Subcategories"); + }); + + modelBuilder.Entity("OutOfSchool.Services.Models.Child", b => + { + b.Navigation("BirthCertificate"); + }); + + modelBuilder.Entity("OutOfSchool.Services.Models.Parent", b => + { + b.Navigation("Children"); + }); + + modelBuilder.Entity("OutOfSchool.Services.Models.Provider", b => + { + b.Navigation("Workshops"); + }); + + modelBuilder.Entity("OutOfSchool.Services.Models.SocialGroup", b => + { + b.Navigation("Children"); + }); + + modelBuilder.Entity("OutOfSchool.Services.Models.Workshop", b => + { + b.Navigation("Teachers"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210413215419_updatedUser.cs b/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210413215419_updatedUser.cs new file mode 100644 index 0000000000..ae42ca1dfb --- /dev/null +++ b/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210413215419_updatedUser.cs @@ -0,0 +1,167 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace OutOfSchool.IdentityServer.Data.Migrations.OutOfSchoolMigrations +{ + public partial class updatedUser : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Parents_AspNetUsers_UserId1", + table: "Parents"); + + migrationBuilder.DropIndex( + name: "IX_Parents_UserId1", + table: "Parents"); + + migrationBuilder.DropColumn( + name: "UserId1", + table: "Parents"); + + migrationBuilder.AlterColumn( + name: "UserId", + table: "Parents", + type: "nvarchar(450)", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint"); + + migrationBuilder.AlterColumn( + name: "Patronymic", + table: "Children", + type: "nvarchar(40)", + maxLength: 40, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(40)", + oldMaxLength: 40); + + migrationBuilder.AlterColumn( + name: "LastName", + table: "Children", + type: "nvarchar(40)", + maxLength: 40, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(40)", + oldMaxLength: 40); + + migrationBuilder.AlterColumn( + name: "FirstName", + table: "Children", + type: "nvarchar(40)", + maxLength: 40, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(40)", + oldMaxLength: 40); + + migrationBuilder.AddColumn( + name: "LastName", + table: "AspNetUsers", + type: "nvarchar(max)", + nullable: true); + + migrationBuilder.AddColumn( + name: "MiddleName", + table: "AspNetUsers", + type: "nvarchar(max)", + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_Parents_UserId", + table: "Parents", + column: "UserId"); + + migrationBuilder.AddForeignKey( + name: "FK_Parents_AspNetUsers_UserId", + table: "Parents", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Parents_AspNetUsers_UserId", + table: "Parents"); + + migrationBuilder.DropIndex( + name: "IX_Parents_UserId", + table: "Parents"); + + migrationBuilder.DropColumn( + name: "LastName", + table: "AspNetUsers"); + + migrationBuilder.DropColumn( + name: "MiddleName", + table: "AspNetUsers"); + + migrationBuilder.AlterColumn( + name: "UserId", + table: "Parents", + type: "bigint", + nullable: false, + oldClrType: typeof(string), + oldType: "nvarchar(450)"); + + migrationBuilder.AddColumn( + name: "UserId1", + table: "Parents", + type: "nvarchar(450)", + nullable: true); + + migrationBuilder.AlterColumn( + name: "Patronymic", + table: "Children", + type: "nvarchar(40)", + maxLength: 40, + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(40)", + oldMaxLength: 40, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "LastName", + table: "Children", + type: "nvarchar(40)", + maxLength: 40, + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(40)", + oldMaxLength: 40, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "FirstName", + table: "Children", + type: "nvarchar(40)", + maxLength: 40, + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(40)", + oldMaxLength: 40, + oldNullable: true); + + migrationBuilder.CreateIndex( + name: "IX_Parents_UserId1", + table: "Parents", + column: "UserId1"); + + migrationBuilder.AddForeignKey( + name: "FK_Parents_AspNetUsers_UserId1", + table: "Parents", + column: "UserId1", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + } + } +} diff --git a/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/OutOfSchoolDbContextModelSnapshot.cs b/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/OutOfSchoolDbContextModelSnapshot.cs index 3df8b7e7f8..e7eb84b51d 100644 --- a/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/OutOfSchoolDbContextModelSnapshot.cs +++ b/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/OutOfSchoolDbContextModelSnapshot.cs @@ -157,7 +157,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("bigint") .UseIdentityColumn(); - b.Property("BuildingNumb") + b.Property("BuildingNumber") .IsRequired() .HasMaxLength(15) .HasColumnType("nvarchar(15)"); @@ -243,7 +243,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("datetime2"); b.Property("FirstName") - .IsRequired() .HasMaxLength(40) .HasColumnType("nvarchar(40)"); @@ -251,7 +250,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("int"); b.Property("LastName") - .IsRequired() .HasMaxLength(40) .HasColumnType("nvarchar(40)"); @@ -259,7 +257,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("bigint"); b.Property("Patronymic") - .IsRequired() .HasMaxLength(40) .HasColumnType("nvarchar(40)"); @@ -299,15 +296,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(40) .HasColumnType("nvarchar(40)"); - b.Property("UserId") - .HasColumnType("bigint"); - - b.Property("UserId1") + b.Property("UserId") + .IsRequired() .HasColumnType("nvarchar(450)"); b.HasKey("Id"); - b.HasIndex("UserId1"); + b.HasIndex("UserId"); b.ToTable("Parents"); }); @@ -523,12 +518,18 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("LastLogin") .HasColumnType("datetime2"); + b.Property("LastName") + .HasColumnType("nvarchar(max)"); + b.Property("LockoutEnabled") .HasColumnType("bit"); b.Property("LockoutEnd") .HasColumnType("datetimeoffset"); + b.Property("MiddleName") + .HasColumnType("nvarchar(max)"); + b.Property("NormalizedEmail") .HasMaxLength(256) .HasColumnType("nvarchar(256)"); @@ -748,7 +749,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.HasOne("OutOfSchool.Services.Models.User", "User") .WithMany() - .HasForeignKey("UserId1"); + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); b.Navigation("User"); }); From d61d4969795a6a805362b6bf11ddde3aed28819b Mon Sep 17 00:00:00 2001 From: VyacheslavDzhus Date: Wed, 14 Apr 2021 01:43:58 +0300 Subject: [PATCH 4/9] add property Name and change migration 'updatedUser' --- OutOfSchool/OutOfSchool.DataAccess/Models/User.cs | 2 ++ .../Controllers/AuthController.cs | 5 +++-- .../20210413215419_updatedUser.cs | 10 ++++++++++ .../OutOfSchoolDbContextModelSnapshot.cs | 3 +++ .../Views/Auth/Register.cshtml | 6 +++--- 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/OutOfSchool/OutOfSchool.DataAccess/Models/User.cs b/OutOfSchool/OutOfSchool.DataAccess/Models/User.cs index 26488c100b..ce23ededc7 100644 --- a/OutOfSchool/OutOfSchool.DataAccess/Models/User.cs +++ b/OutOfSchool/OutOfSchool.DataAccess/Models/User.cs @@ -15,5 +15,7 @@ public class User : IdentityUser public string LastName { get; set; } public string MiddleName { get; set; } + + public string Name { get; set; } } } \ No newline at end of file diff --git a/OutOfSchool/OutOfSchool.IdentityServer/Controllers/AuthController.cs b/OutOfSchool/OutOfSchool.IdentityServer/Controllers/AuthController.cs index c2a815d24e..8438098864 100644 --- a/OutOfSchool/OutOfSchool.IdentityServer/Controllers/AuthController.cs +++ b/OutOfSchool/OutOfSchool.IdentityServer/Controllers/AuthController.cs @@ -138,15 +138,16 @@ public async Task Register(RegisterViewModel model) var user = new User() { - UserName = model.Name, + UserName = model.Email, + Name = model.Name, LastName = model.LastName, MiddleName = model.MiddleName, Email = model.Email, PhoneNumber = model.PhoneNumber, CreatingTime = DateTime.Now, }; - var result = await userManager.CreateAsync(user, model.Password); + var result = await userManager.CreateAsync(user, model.Password); if (result.Succeeded) { IdentityResult roleAssignResult = IdentityResult.Failed(); diff --git a/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210413215419_updatedUser.cs b/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210413215419_updatedUser.cs index ae42ca1dfb..d981329d91 100644 --- a/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210413215419_updatedUser.cs +++ b/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210413215419_updatedUser.cs @@ -62,6 +62,12 @@ protected override void Up(MigrationBuilder migrationBuilder) type: "nvarchar(max)", nullable: true); + migrationBuilder.AddColumn( + name: "Name", + table: "AspNetUsers", + type: "nvarchar(max)", + nullable: true); + migrationBuilder.AddColumn( name: "MiddleName", table: "AspNetUsers", @@ -96,6 +102,10 @@ protected override void Down(MigrationBuilder migrationBuilder) name: "LastName", table: "AspNetUsers"); + migrationBuilder.DropColumn( + name: "Name", + table: "AspNetUsers"); + migrationBuilder.DropColumn( name: "MiddleName", table: "AspNetUsers"); diff --git a/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/OutOfSchoolDbContextModelSnapshot.cs b/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/OutOfSchoolDbContextModelSnapshot.cs index e7eb84b51d..09cdfb86fb 100644 --- a/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/OutOfSchoolDbContextModelSnapshot.cs +++ b/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/OutOfSchoolDbContextModelSnapshot.cs @@ -530,6 +530,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("MiddleName") .HasColumnType("nvarchar(max)"); + b.Property("Name") + .HasColumnType("nvarchar(max)"); + b.Property("NormalizedEmail") .HasMaxLength(256) .HasColumnType("nvarchar(256)"); diff --git a/OutOfSchool/OutOfSchool.IdentityServer/Views/Auth/Register.cshtml b/OutOfSchool/OutOfSchool.IdentityServer/Views/Auth/Register.cshtml index b3d601779c..eeb2f66360 100644 --- a/OutOfSchool/OutOfSchool.IdentityServer/Views/Auth/Register.cshtml +++ b/OutOfSchool/OutOfSchool.IdentityServer/Views/Auth/Register.cshtml @@ -46,15 +46,15 @@
  • - +
  • - +
  • - +
  • From 0275ba8039ed3e99d44e885afe1a2f3a1db3d1f4 Mon Sep 17 00:00:00 2001 From: VyacheslavDzhus Date: Fri, 16 Apr 2021 19:07:36 +0300 Subject: [PATCH 5/9] added validation to the properties --- .../Controllers/AuthController.cs | 7 +- .../Views/Auth/Register.cshtml | 82 +- .../wwwroot/css/site.css | 714 +++++++++--------- .../wwwroot/js/site.js | 36 +- 4 files changed, 472 insertions(+), 367 deletions(-) diff --git a/OutOfSchool/OutOfSchool.IdentityServer/Controllers/AuthController.cs b/OutOfSchool/OutOfSchool.IdentityServer/Controllers/AuthController.cs index 8438098864..b1d3f72ca9 100644 --- a/OutOfSchool/OutOfSchool.IdentityServer/Controllers/AuthController.cs +++ b/OutOfSchool/OutOfSchool.IdentityServer/Controllers/AuthController.cs @@ -182,7 +182,12 @@ public async Task Register(RegisterViewModel model) else { foreach (var error in result.Errors) - { + { + if (error.Code == "DuplicateUserName") + { + error.Description = $"Email {error.Description.Substring(10).Split('\'')[0]} is alredy taken"; + } + ModelState.AddModelError(string.Empty, error.Description); } } diff --git a/OutOfSchool/OutOfSchool.IdentityServer/Views/Auth/Register.cshtml b/OutOfSchool/OutOfSchool.IdentityServer/Views/Auth/Register.cshtml index eeb2f66360..6f82b71872 100644 --- a/OutOfSchool/OutOfSchool.IdentityServer/Views/Auth/Register.cshtml +++ b/OutOfSchool/OutOfSchool.IdentityServer/Views/Auth/Register.cshtml @@ -16,8 +16,9 @@
    або заповніть форму
    -
    + +
    • + +
    • + + +
      + +
      + +
    • +
    • + + +
      + +
      +
    • - - -
    • -
    • - - -
    • -
    • - - -
    • + + +
      + +
      +
    • - +
      +38
      - + +
      +
    • - - + + +
      + +
    • - - - -
      - eye +
      + + +
      + eye +
      +
      +
      +
    • @@ -82,16 +103,23 @@
    • - - - -
      - eye +
      + + +
      + eye +
      +
      +
      +
    • - + +
      + You must be over 18 to register! +
    • Реєструючись я погоджуюсь з diff --git a/OutOfSchool/OutOfSchool.IdentityServer/wwwroot/css/site.css b/OutOfSchool/OutOfSchool.IdentityServer/wwwroot/css/site.css index 4d4bc2d39c..5d62eca720 100644 --- a/OutOfSchool/OutOfSchool.IdentityServer/wwwroot/css/site.css +++ b/OutOfSchool/OutOfSchool.IdentityServer/wwwroot/css/site.css @@ -1,16 +1,22 @@ -html, body { - height: 100%; +html, +body { + height: 100%; } -body { +body { margin: 0; font-family: "Open Sans", sans-serif; font-size: 0.8125rem; line-height: 1.125rem; - background-color: #F8F8F8; + background-color: #f8f8f8; color: #333333; } -h1, h2, h3, h4, h5, h6 { +h1, +h2, +h3, +h4, +h5, +h6 { font-family: "Innerspace"; color: #000000; margin: 0; @@ -39,68 +45,76 @@ h6 { font-size: 0.6875rem; line-height: 0.9375rem; } - +.validation-summary-errors li { + list-style-type: none !important; + text-align: center !important; +} a { text-decoration: none; color: inherit; } -.login__wrapper{ - display: flex; - flex-direction: column; - align-items: center; - margin: 0; - padding: 10px; -} -.login__text, .login__label, .login__link{ - font-weight: 400; - font-family: Roboto,Helvetica Neue,sans-serif; - letter-spacing: normal; -} - .login__label{ - margin-top: 10px; - font-size: 1.2rem; -} -.login__input{ - max-width: 800px; - width: 100%; - height: 2rem; - border: none; - outline: none; - font-size: 2rem; - border-bottom: 1px solid silver; - cursor: text; +.login__wrapper { + display: flex; + flex-direction: column; + align-items: center; + margin: 0; + padding: 10px; +} +.login__text, +.login__label, +.login__link { + font-weight: 400; + font-family: Roboto, Helvetica Neue, sans-serif; + letter-spacing: normal; +} +.login__label { + margin-top: 10px; + font-size: 1.2rem; } -.login__input:focus{ - border-bottom: 1px solid #4158d0; +.login__input { + max-width: 800px; + width: 100%; + height: 2rem; + border: none; + outline: none; + font-size: 2rem; + border-bottom: 1px solid silver; + cursor: text; +} +.login__input:focus { + border-bottom: 1px solid #4158d0; } .login__button { - text-align: center; - outline: none; - border: none; - margin: 20px; - padding: 10px; - font-size: 1.5rem; - border-radius: 4px; - color: rgba(0, 0, 0, 0.87); - background-color: #fff; - box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.5), 0 2px 2px 0 rgba(0, 0, 0, 0.5), 0 1px 5px 0 rgba(0, 0, 0, 0.5); - cursor: pointer; -} -.login__button:hover{ - box-shadow: 0 3px 1px -2px #4158d0, 0 2px 2px 0 #4158d0, 0 1px 5px 0 #4158d0; + text-align: center; + outline: none; + border: none; + margin: 20px; + padding: 10px; + font-size: 1.5rem; + border-radius: 4px; + color: rgba(0, 0, 0, 0.87); + background-color: #fff; + box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.5), 0 2px 2px 0 rgba(0, 0, 0, 0.5), + 0 1px 5px 0 rgba(0, 0, 0, 0.5); + cursor: pointer; +} +.login__button:hover { + box-shadow: 0 3px 1px -2px #4158d0, 0 2px 2px 0 #4158d0, 0 1px 5px 0 #4158d0; } .login .login__link { - border-bottom: 1px solid silver; - text-decoration: none; - cursor: pointer; - color: rgba(0, 0, 0, 0.87); + border-bottom: 1px solid silver; + text-decoration: none; + cursor: pointer; + color: rgba(0, 0, 0, 0.87); } -.login__link{ - font-size: 1.5rem; +.login__link { + font-size: 1.5rem; } -.login__link:hover, .login__input:focus, .login__button:hover{ - color: #4158d0; +.login__link:hover, +.login__input:focus, +.login__button:hover { + color: #4158d0; } .registration { @@ -110,288 +124,316 @@ a { } .registration_wrapper { - background: #FFFFFF; - box-shadow: 0px 6px 16px rgba(0, 0, 0, 0.08); - border-radius: 5px; - padding: 3rem 4.3125rem; - display: flex; - justify-content: center; - align-items: center; - flex-direction: column; - width: 640px; - } - .registration_title { - line-height: 20px; - text-align: center; - color: #444444; - margin: 0; - } - .registration_subtitle { - line-height: 18px; - text-align: center; - color: #AAAAAA; - margin: 16px 0 0 0; - } - .registration_social { - margin-top: 24px; - } - .registration_button { - border: none; - outline: none; - background: inherit; - margin: 0 0.3rem; - cursor: pointer; - } - .registration_option { - font-size: 0.8125rem; - line-height: 18px; - text-align: center; - color: #333333; - position: relative; - margin-top: 24px; - } - .registration_option:after { - content: ''; - display: block; - position: absolute; - height: 1px; - width: 7rem; - background-color: #E3E3E3; - left: 0%; - top: 50%; - transform: translate(-120%, -50%); - } - .registration_option:before { - content: ''; - display: block; - position: absolute; - height: 1px; - width: 7rem; - background-color: #E3E3E3; - right: 0%; - top: 50%; - transform: translate(120%, -50%); - } - .registration_form { - margin-top: 24px; - width: 80%; - } - .registration_star { - color: red; - display: inline; - } - .registration_list { - list-style: none; - padding: 0; - margin: 0; - width: 100%; - } - .registration_item { - display: flex; - flex-direction: column; - position: relative; + background: #ffffff; + box-shadow: 0px 6px 16px rgba(0, 0, 0, 0.08); + border-radius: 5px; + padding: 3rem 4.3125rem; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + width: 640px; +} +.registration_title { + line-height: 20px; + text-align: center; + color: #444444; + margin: 0; +} +.registration_subtitle { + line-height: 18px; + text-align: center; + color: #aaaaaa; + margin: 16px 0 0 0; +} +.registration_social { + margin-top: 24px; +} +.registration_button { + border: none; + outline: none; + background: inherit; + margin: 0 0.3rem; + cursor: pointer; +} +.registration_option { + font-size: 0.8125rem; + line-height: 18px; + text-align: center; + color: #333333; + position: relative; + margin-top: 24px; +} +.registration_option:after { + content: ""; + display: block; + position: absolute; + height: 1px; + width: 7rem; + background-color: #e3e3e3; + left: 0%; + top: 50%; + transform: translate(-120%, -50%); +} +.registration_option:before { + content: ""; + display: block; + position: absolute; + height: 1px; + width: 7rem; + background-color: #e3e3e3; + right: 0%; + top: 50%; + transform: translate(120%, -50%); +} +.registration_form { + margin-top: 24px; + width: 80%; +} +.registration_star { + color: red; + display: inline; +} +.registration_list { + list-style: none; + padding: 0; + margin: 0; + width: 100%; +} +.registration_item { + display: flex; + flex-direction: column; + position: relative; + width: 100%; + margin: 16px 0; + box-sizing: border-box; +} +.registration_item-maturity { + flex-direction: row; + gap: 8px; + font-family: Open Sans; + font-style: normal; + font-weight: normal; + font-size: 13px; + line-height: 18px; + color: #444444; + margin-top: 24px; +} +.registration_item-accept { + margin: 24px auto 0 auto; + text-align: center; + display: block; + font-family: Open Sans; + font-style: normal; + font-weight: normal; + font-size: 13px; + line-height: 18px; + color: #333333; + width: 95%; +} +.registration_item-tip { + margin: 0; + font-family: Open Sans; + font-style: normal; + font-weight: normal; + font-size: 13px; + line-height: 18px; + color: #aaaaaa; +} +.registration_item-password { + margin-bottom: 8px; +} +.registration_link { + color: #3849f9; + font-weight: bold; + text-decoration: underline; +} +.registration_as { + display: flex; + align-items: center; + position: relative; + margin-top: 8px; +} +.registration_type { + width: 50%; + display: flex; + align-items: center; + justify-content: center; + gap: 0.3rem; + height: 34px; + padding: 0; + font-family: Open Sans; + font-style: normal; + font-weight: bold; + font-size: 0.8125rem; + line-height: 100%; + color: #272425; + background: inherit; + outline: none; + cursor: pointer; + border: 1px solid #e3e3e3; + transition: 0.5s ease all; +} +.registration_type:nth-child(1) { + border-radius: 20px 0 0 20px; + border-right: none; +} +.registration_type:nth-child(2) { + border-radius: 0 20px 20px 0; + border-left: none; +} +.registration_type:hover { + border-color: #3849f9; +} +.registration_type:hover ~ .registration_divider { + background: #3849f9; +} +.registration_type-active { + border-color: #3849f9; + color: #3849f9; + background: rgba(56, 73, 249, 0.07); +} +.registration_type-active ~ .registration_divider { + background: #3849f9; +} +.registration_type-active svg path { + fill: #3849f9; +} +.registration_divider { + transition: 0.5s ease all; + position: absolute; + height: 100%; + width: 1px; + background: #e3e3e3; + left: 50%; + transform: translateX(-50%); +} +.registration_icon-person { + height: 13px; + width: 11px; +} +.registration_icon-provider { + width: 13px; + height: 17px; +} +.registration_input { + box-sizing: border-box; + border: 1px solid #e3e3e3; + border-radius: 20px; + height: 30px; + width: 100%; + margin-top: 8px !important; + padding: 0 0 0 16px !important; + outline: none; + font-family: Open Sans; + font-style: normal; + font-weight: normal; + font-size: 13px; + line-height: 30px; + color: #333333; +} +.registration_input-password { + font-size: 30px; + padding-right: 30px !important; +} +.registration_label { + font-family: Innerspace; + font-style: normal; + font-weight: bold; + font-size: 13px; + line-height: 15px; + color: #333333; +} +.registration_phone { + display: flex; + align-items: center; + justify-content: space-between; + gap: 8px; + width: 100%; +} +.registration_phone-code { + margin-top: 8px; + border: 1px solid #e3e3e3; + border-radius: 21px; + height: 30px; + width: 59px; + text-align: center; + font-family: Open Sans; + font-style: normal; + font-weight: normal; + font-size: 13px; + line-height: 26px; + color: #333333; +} +.registration_submit { + border: none; + outline: none; + height: 34px; + width: 12rem; + margin: 16px auto; + background: #3849f9; + border-radius: 20px; + font-family: Innerspace; + font-style: normal; + font-weight: bold; + font-size: 13px; + line-height: 34px; + color: #ffffff; + cursor: pointer; +} +.registration_privacy { + border: none; + outline: none; + background: inherit; + position: absolute; + bottom: 0; + right: 8px; + width: 30px; + height: 30px; + display: flex !important; + align-items: center !important; + justify-content: center !important; +} +.registration_privacy img { + height: 16px; + width: auto; +} + +.field-validation-error { + color: #ff0000; + font-family: Arial; + font-size: 12px; +} + +.field-validation-valid { + display: none; +} + +.input-validation-error { + border: 1px solid #ff0000 !important; + background-color: #ffeeee !important; +} + +.validation-summary-errors { + font-weight: bold !important; + color: #ff0000 !important; +} + +.validation-summary-valid { + display: none; +} + +.maturity { + color: #ff0000; + visibility: hidden; +} + +@media screen and (max-width: 750px) { + .registration_wrapper { width: 100%; - margin: 16px 0; - box-sizing: border-box; - } - .registration_item-maturity { - flex-direction: row; - gap: 8px; - font-family: Open Sans; - font-style: normal; - font-weight: normal; - font-size: 13px; - line-height: 18px; - color: #444444; - margin-top: 24px; + padding: 3rem 0.4rem; } - .registration_item-accept { - margin: 24px auto 0 auto; - text-align: center; - display: block; - font-family: Open Sans; - font-style: normal; - font-weight: normal; - font-size: 13px; - line-height: 18px; - color: #333333; + .registration_form { width: 95%; } - .registration_item-tip { - margin: 0; - font-family: Open Sans; - font-style: normal; - font-weight: normal; - font-size: 13px; - line-height: 18px; - color: #AAAAAA; - } - .registration_item-password { - margin-bottom: 8px; - } - .registration_link { - color: #3849F9; - font-weight: bold; - text-decoration: underline; - } - .registration_as { - display: flex; - align-items: center; - position: relative; - margin-top: 8px; - } - .registration_type { - width: 50%; - display: flex; - align-items: center; - justify-content: center; - gap: 0.3rem; - height: 34px; - padding: 0; - font-family: Open Sans; - font-style: normal; - font-weight: bold; - font-size: 0.8125rem; - line-height: 100%; - color: #272425; - background: inherit; - outline: none; - cursor: pointer; - border: 1px solid #E3E3E3; - transition: 0.5s ease all; - } - .registration_type:nth-child(1) { - border-radius: 20px 0 0 20px; - border-right: none; - } - .registration_type:nth-child(2) { - border-radius: 0 20px 20px 0; - border-left: none; - } - .registration_type:hover { - border-color: #3849F9; - } - .registration_type:hover ~ .registration_divider { - background: #3849F9; - } - .registration_type-active { - border-color: #3849F9; - color: #3849F9; - background: rgba(56, 73, 249, 0.07); - } - .registration_type-active ~ .registration_divider { - background: #3849F9; - } - .registration_type-active svg path { - fill: #3849F9; - } - .registration_divider { - transition: 0.5s ease all; - position: absolute; - height: 100%; - width: 1px; - background: #E3E3E3; - left: 50%; - transform: translateX(-50%); - } - .registration_icon-person { - height: 13px; - width: 11px; - } - .registration_icon-provider { - width: 13px; - height: 17px; - } - .registration_input { - box-sizing: border-box; - border: 1px solid #E3E3E3; - border-radius: 20px; - height: 30px; - width: 100%; - margin-top: 8px; - padding: 0 0 0 16px; - outline: none; - font-family: Open Sans; - font-style: normal; - font-weight: normal; - font-size: 13px; - line-height: 30px; - color: #333333; - } - .registration_input-password { - font-size: 30px; - padding-right: 30px; - } - .registration_label { - font-family: Innerspace; - font-style: normal; - font-weight: bold; - font-size: 13px; - line-height: 15px; - color: #333333; - } - .registration_phone { - display: flex; - align-items: center; - justify-content: space-between; - gap: 8px; - width: 100%; - } - .registration_phone-code { - margin-top: 8px; - border: 1px solid #E3E3E3; - border-radius: 21px; - height: 30px; - width: 59px; - text-align: center; - font-family: Open Sans; - font-style: normal; - font-weight: normal; - font-size: 13px; - line-height: 26px; - color: #333333; - } - .registration_submit { - border: none; - outline: none; - height: 34px; - width: 12rem; - margin: 16px auto; - background: #3849F9; - border-radius: 20px; - font-family: Innerspace; - font-style: normal; - font-weight: bold; - font-size: 13px; - line-height: 34px; - color: #FFFFFF; - cursor: pointer; - } - .registration_privacy { - border: none; - outline: none; - background: inherit; - position: absolute; - bottom: 0; - right: 8px; - width: 30px; - height: 30px; - padding: 0; - display: flex; - align-items: center; - justify-content: center; - } - .registration_privacy img { - height: 16px; - width: auto; - } - - @media screen and (max-width: 750px) { - .registration_wrapper { - width: 100%; - padding: 3rem 0.4rem; - } - .registration_form { - width: 95%; - } - } \ No newline at end of file +} diff --git a/OutOfSchool/OutOfSchool.IdentityServer/wwwroot/js/site.js b/OutOfSchool/OutOfSchool.IdentityServer/wwwroot/js/site.js index 989f043c3c..451bef34c7 100644 --- a/OutOfSchool/OutOfSchool.IdentityServer/wwwroot/js/site.js +++ b/OutOfSchool/OutOfSchool.IdentityServer/wwwroot/js/site.js @@ -11,6 +11,17 @@ let check_confirmPasswordEye = false; let password = document.getElementById('password'); let repeatPassword = document.getElementById('repeat_password'); +if (password.className.includes('input-validation-error')) { + let elements = document.getElementsByClassName('registration_privacy'); + for (var i = 0; i < elements.length; i++) { + elements[i].style.height = "65px"; + } +} + +if (document.getElementsByClassName('validation-summary-errors').length > 0) { + document.getElementById("user_mail").className += ' input-validation-error'; +} + btn_parent.addEventListener('click', function () { btn_parent.className = "registration_type registration_type-active"; btn_provider.className = "registration_type"; @@ -20,17 +31,20 @@ btn_parent.addEventListener('click', function () { btn_provider.addEventListener('click', function () { btn_provider.className = "registration_type registration_type-active"; btn_parent.className = "registration_type"; - btn_register.setAttribute("name", "Provider"); + btn_register.setAttribute("name", "Provider"); }) passwordEye.addEventListener('click', function () { if (check_passwordEye) { passwordEye.src = "/icons/ic_eye.svg"; check_passwordEye = false; - password.setAttribute("type", "Password"); + password.style.fontSize = "30px"; + password.setAttribute("type", "Password"); + } else { passwordEye.src = "/icons/eye.svg"; check_passwordEye = true; + password.style.fontSize = "20px"; password.setAttribute("type", "Text"); } }) @@ -39,10 +53,26 @@ confirmPasswordEye.addEventListener('click', function () { if (check_confirmPasswordEye) { confirmPasswordEye.src = "/icons/ic_eye.svg"; check_confirmPasswordEye = false; + repeatPassword.style.fontSize = "30px"; repeatPassword.setAttribute("type", "Password"); } else { confirmPasswordEye.src = "/icons/eye.svg"; check_confirmPasswordEye = true; + repeatPassword.style.fontSize = "20px"; repeatPassword.setAttribute("type", "Text"); } -}) \ No newline at end of file +}) + +function validateForm(form) { + if (!form.maturity.checked) { + document.getElementById('maturity').style.visibility = 'visible'; + return false; + } + else { + document.getElementById('maturity').style.visibility = 'hidden'; + return true; + } +} + + + From d4e9929382ad865d176ac576d943376a349b10a7 Mon Sep 17 00:00:00 2001 From: VyacheslavDzhus Date: Fri, 16 Apr 2021 19:12:40 +0300 Subject: [PATCH 6/9] edit migration 'Init' and Login view --- .../20210322100037_init.cs | 532 +----------------- .../Views/Auth/Login.cshtml | 2 +- 2 files changed, 2 insertions(+), 532 deletions(-) diff --git a/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210322100037_init.cs b/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210322100037_init.cs index 25f4c59f10..5474a2e827 100644 --- a/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210322100037_init.cs +++ b/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210322100037_init.cs @@ -24,543 +24,13 @@ protected override void Up(MigrationBuilder migrationBuilder) constraints: table => { table.PrimaryKey("PK_Address", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AspNetRoles", - columns: table => new - { - Id = table.Column(type: "nvarchar(450)", nullable: false), - Name = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - NormalizedName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - ConcurrencyStamp = table.Column(type: "nvarchar(max)", nullable: true), - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetRoles", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AspNetUsers", - columns: table => new - { - Id = table.Column(type: "nvarchar(450)", nullable: false), - CreatingTime = table.Column(type: "datetime2", nullable: false), - LastLogin = table.Column(type: "datetime2", nullable: false), - UserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - NormalizedUserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - Email = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - NormalizedEmail = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - EmailConfirmed = table.Column(type: "bit", nullable: false), - PasswordHash = table.Column(type: "nvarchar(max)", nullable: true), - SecurityStamp = table.Column(type: "nvarchar(max)", nullable: true), - ConcurrencyStamp = table.Column(type: "nvarchar(max)", nullable: true), - PhoneNumber = table.Column(type: "nvarchar(max)", nullable: true), - PhoneNumberConfirmed = table.Column(type: "bit", nullable: false), - TwoFactorEnabled = table.Column(type: "bit", nullable: false), - LockoutEnd = table.Column(type: "datetimeoffset", nullable: true), - LockoutEnabled = table.Column(type: "bit", nullable: false), - AccessFailedCount = table.Column(type: "int", nullable: false), - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUsers", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Categories", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Title = table.Column(type: "nvarchar(max)", nullable: true), - }, - constraints: table => - { - table.PrimaryKey("PK_Categories", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "SocialGroups", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Name = table.Column(type: "nvarchar(max)", nullable: true), - }, - constraints: table => - { - table.PrimaryKey("PK_SocialGroups", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AspNetRoleClaims", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - RoleId = table.Column(type: "nvarchar(450)", nullable: false), - ClaimType = table.Column(type: "nvarchar(max)", nullable: true), - ClaimValue = table.Column(type: "nvarchar(max)", nullable: true), - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); - table.ForeignKey( - name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", - column: x => x.RoleId, - principalTable: "AspNetRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserClaims", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - UserId = table.Column(type: "nvarchar(450)", nullable: false), - ClaimType = table.Column(type: "nvarchar(max)", nullable: true), - ClaimValue = table.Column(type: "nvarchar(max)", nullable: true), - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); - table.ForeignKey( - name: "FK_AspNetUserClaims_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserLogins", - columns: table => new - { - LoginProvider = table.Column(type: "nvarchar(450)", nullable: false), - ProviderKey = table.Column(type: "nvarchar(450)", nullable: false), - ProviderDisplayName = table.Column(type: "nvarchar(max)", nullable: true), - UserId = table.Column(type: "nvarchar(450)", nullable: false), - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey }); - table.ForeignKey( - name: "FK_AspNetUserLogins_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserRoles", - columns: table => new - { - UserId = table.Column(type: "nvarchar(450)", nullable: false), - RoleId = table.Column(type: "nvarchar(450)", nullable: false), - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); - table.ForeignKey( - name: "FK_AspNetUserRoles_AspNetRoles_RoleId", - column: x => x.RoleId, - principalTable: "AspNetRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_AspNetUserRoles_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserTokens", - columns: table => new - { - UserId = table.Column(type: "nvarchar(450)", nullable: false), - LoginProvider = table.Column(type: "nvarchar(450)", nullable: false), - Name = table.Column(type: "nvarchar(450)", nullable: false), - Value = table.Column(type: "nvarchar(max)", nullable: true), - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); - table.ForeignKey( - name: "FK_AspNetUserTokens_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Parents", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - FirstName = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), - MiddleName = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), - LastName = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), - UserId = table.Column(type: "bigint", nullable: false), - UserId1 = table.Column(type: "nvarchar(450)", nullable: true), - }, - constraints: table => - { - table.PrimaryKey("PK_Parents", x => x.Id); - table.ForeignKey( - name: "FK_Parents_AspNetUsers_UserId1", - column: x => x.UserId1, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "Providers", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Title = table.Column(type: "nvarchar(60)", maxLength: 60, nullable: false), - ShortTitle = table.Column(type: "nvarchar(60)", maxLength: 60, nullable: false), - Website = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), - Facebook = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), - Instagram = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), - Description = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: false), - MFO = table.Column(type: "nvarchar(max)", nullable: false), - EDRPOU = table.Column(type: "nvarchar(max)", nullable: false), - KOATUU = table.Column(type: "nvarchar(max)", nullable: true), - INPP = table.Column(type: "nvarchar(max)", nullable: false), - Director = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), - DirectorPosition = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true), - AuthorityHolder = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), - DirectorBirthDay = table.Column(type: "datetime2", nullable: false), - DirectorPhonenumber = table.Column(type: "nvarchar(max)", nullable: true), - ManagerialBody = table.Column(type: "nvarchar(max)", nullable: true), - Ownership = table.Column(type: "int", nullable: false), - Type = table.Column(type: "int", nullable: false), - Form = table.Column(type: "nvarchar(max)", nullable: true), - Profile = table.Column(type: "int", nullable: false), - Index = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true), - IsSubmitPZ1 = table.Column(type: "bit", nullable: false), - AttachedDocuments = table.Column(type: "nvarchar(max)", nullable: true), - AddressId = table.Column(type: "bigint", nullable: false), - UserId = table.Column(type: "nvarchar(450)", nullable: false), - }, - constraints: table => - { - table.PrimaryKey("PK_Providers", x => x.Id); - table.ForeignKey( - name: "FK_Providers_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Subcategories", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Title = table.Column(type: "nvarchar(max)", nullable: true), - CategoryId = table.Column(type: "bigint", nullable: true), - }, - constraints: table => - { - table.PrimaryKey("PK_Subcategories", x => x.Id); - table.ForeignKey( - name: "FK_Subcategories_Categories_CategoryId", - column: x => x.CategoryId, - principalTable: "Categories", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "Children", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - FirstName = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), - LastName = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), - Patronymic = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), - DateOfBirth = table.Column(type: "datetime2", nullable: false), - Gender = table.Column(type: "int", nullable: false), - AddressId = table.Column(type: "bigint", nullable: false), - ParentId = table.Column(type: "bigint", nullable: false), - SocialGroupId = table.Column(type: "bigint", nullable: false), - }, - constraints: table => - { - table.PrimaryKey("PK_Children", x => x.Id); - table.ForeignKey( - name: "FK_Children_Address_AddressId", - column: x => x.AddressId, - principalTable: "Address", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_Children_Parents_ParentId", - column: x => x.ParentId, - principalTable: "Parents", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_Children_SocialGroups_SocialGroupId", - column: x => x.SocialGroupId, - principalTable: "SocialGroups", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Workshops", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Title = table.Column(type: "nvarchar(60)", maxLength: 60, nullable: false), - Phone = table.Column(type: "nvarchar(max)", nullable: false), - Email = table.Column(type: "nvarchar(max)", nullable: false), - Website = table.Column(type: "nvarchar(max)", nullable: true), - Facebook = table.Column(type: "nvarchar(30)", maxLength: 30, nullable: true), - Instagram = table.Column(type: "nvarchar(30)", maxLength: 30, nullable: true), - MinAge = table.Column(type: "int", nullable: false), - MaxAge = table.Column(type: "int", nullable: false), - DaysPerWeek = table.Column(type: "int", nullable: false), - Price = table.Column(type: "decimal(18,2)", nullable: false), - Description = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: false), - WithDisabilityOptions = table.Column(type: "bit", nullable: false), - DisabilityOptionsDesc = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), - Image = table.Column(type: "nvarchar(max)", nullable: true), - Head = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), - HeadBirthDate = table.Column(type: "datetime2", nullable: false), - ProviderId = table.Column(type: "bigint", nullable: true), - AddressId = table.Column(type: "bigint", nullable: true), - CategoryId = table.Column(type: "bigint", nullable: true), - }, - constraints: table => - { - table.PrimaryKey("PK_Workshops", x => x.Id); - table.ForeignKey( - name: "FK_Workshops_Address_AddressId", - column: x => x.AddressId, - principalTable: "Address", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_Workshops_Categories_CategoryId", - column: x => x.CategoryId, - principalTable: "Categories", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_Workshops_Providers_ProviderId", - column: x => x.ProviderId, - principalTable: "Providers", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "BirthCertificates", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false), - SvidSer = table.Column(type: "nvarchar(max)", nullable: true), - SvidNum = table.Column(type: "nvarchar(max)", nullable: true), - SvidNumMD5 = table.Column(type: "nvarchar(max)", nullable: true), - SvidWho = table.Column(type: "nvarchar(max)", nullable: true), - SvidDate = table.Column(type: "datetime2", nullable: false), - }, - constraints: table => - { - table.PrimaryKey("PK_BirthCertificates", x => x.Id); - table.ForeignKey( - name: "FK_BirthCertificates_Children_Id", - column: x => x.Id, - principalTable: "Children", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Teachers", - columns: table => new - { - TeacherId = table.Column(type: "bigint", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - FirstName = table.Column(type: "nvarchar(30)", maxLength: 30, nullable: false), - LastName = table.Column(type: "nvarchar(30)", maxLength: 30, nullable: false), - MiddleName = table.Column(type: "nvarchar(30)", maxLength: 30, nullable: false), - BirthDay = table.Column(type: "datetime2", nullable: false), - Description = table.Column(type: "nvarchar(300)", maxLength: 300, nullable: true), - Image = table.Column(type: "nvarchar(max)", nullable: true), - WorkshopId = table.Column(type: "bigint", nullable: true), - }, - constraints: table => - { - table.PrimaryKey("PK_Teachers", x => x.TeacherId); - table.ForeignKey( - name: "FK_Teachers_Workshops_WorkshopId", - column: x => x.WorkshopId, - principalTable: "Workshops", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateIndex( - name: "IX_AspNetRoleClaims_RoleId", - table: "AspNetRoleClaims", - column: "RoleId"); - - migrationBuilder.CreateIndex( - name: "RoleNameIndex", - table: "AspNetRoles", - column: "NormalizedName", - unique: true, - filter: "[NormalizedName] IS NOT NULL"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserClaims_UserId", - table: "AspNetUserClaims", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserLogins_UserId", - table: "AspNetUserLogins", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserRoles_RoleId", - table: "AspNetUserRoles", - column: "RoleId"); - - migrationBuilder.CreateIndex( - name: "EmailIndex", - table: "AspNetUsers", - column: "NormalizedEmail"); - - migrationBuilder.CreateIndex( - name: "UserNameIndex", - table: "AspNetUsers", - column: "NormalizedUserName", - unique: true, - filter: "[NormalizedUserName] IS NOT NULL"); - - migrationBuilder.CreateIndex( - name: "IX_Children_AddressId", - table: "Children", - column: "AddressId"); - - migrationBuilder.CreateIndex( - name: "IX_Children_ParentId", - table: "Children", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_Children_SocialGroupId", - table: "Children", - column: "SocialGroupId"); - - migrationBuilder.CreateIndex( - name: "IX_Parents_UserId1", - table: "Parents", - column: "UserId1"); - - migrationBuilder.CreateIndex( - name: "IX_Providers_UserId", - table: "Providers", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_Subcategories_CategoryId", - table: "Subcategories", - column: "CategoryId"); - - migrationBuilder.CreateIndex( - name: "IX_Teachers_WorkshopId", - table: "Teachers", - column: "WorkshopId"); - - migrationBuilder.CreateIndex( - name: "IX_Workshops_AddressId", - table: "Workshops", - column: "AddressId"); - - migrationBuilder.CreateIndex( - name: "IX_Workshops_CategoryId", - table: "Workshops", - column: "CategoryId"); - - migrationBuilder.CreateIndex( - name: "IX_Workshops_ProviderId", - table: "Workshops", - column: "ProviderId"); + }); } protected override void Down(MigrationBuilder migrationBuilder) { - migrationBuilder.DropTable( - name: "AspNetRoleClaims"); - - migrationBuilder.DropTable( - name: "AspNetUserClaims"); - - migrationBuilder.DropTable( - name: "AspNetUserLogins"); - - migrationBuilder.DropTable( - name: "AspNetUserRoles"); - - migrationBuilder.DropTable( - name: "AspNetUserTokens"); - - migrationBuilder.DropTable( - name: "BirthCertificates"); - - migrationBuilder.DropTable( - name: "Subcategories"); - - migrationBuilder.DropTable( - name: "Teachers"); - - migrationBuilder.DropTable( - name: "AspNetRoles"); - - migrationBuilder.DropTable( - name: "Children"); - - migrationBuilder.DropTable( - name: "Workshops"); - - migrationBuilder.DropTable( - name: "Parents"); - - migrationBuilder.DropTable( - name: "SocialGroups"); - migrationBuilder.DropTable( name: "Address"); - - migrationBuilder.DropTable( - name: "Categories"); - - migrationBuilder.DropTable( - name: "Providers"); - - migrationBuilder.DropTable( - name: "AspNetUsers"); } } } diff --git a/OutOfSchool/OutOfSchool.IdentityServer/Views/Auth/Login.cshtml b/OutOfSchool/OutOfSchool.IdentityServer/Views/Auth/Login.cshtml index e2d7254857..9cddb5f0c4 100644 --- a/OutOfSchool/OutOfSchool.IdentityServer/Views/Auth/Login.cshtml +++ b/OutOfSchool/OutOfSchool.IdentityServer/Views/Auth/Login.cshtml @@ -20,7 +20,7 @@
      - +
      From e7ccf31da77aa4e6271383d1c18731403a4c5df3 Mon Sep 17 00:00:00 2001 From: VyacheslavDzhus Date: Fri, 16 Apr 2021 19:39:51 +0300 Subject: [PATCH 7/9] fix codesmells --- .../OutOfSchoolMigrations/20210413215419_updatedUser.cs | 6 +++--- OutOfSchool/OutOfSchool.IdentityServer/wwwroot/css/site.css | 6 +++--- OutOfSchool/OutOfSchool.IdentityServer/wwwroot/js/site.js | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210413215419_updatedUser.cs b/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210413215419_updatedUser.cs index d981329d91..aba86df529 100644 --- a/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210413215419_updatedUser.cs +++ b/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210413215419_updatedUser.cs @@ -130,7 +130,7 @@ protected override void Down(MigrationBuilder migrationBuilder) type: "nvarchar(40)", maxLength: 40, nullable: false, - defaultValue: "", + defaultValue: string.Empty, oldClrType: typeof(string), oldType: "nvarchar(40)", oldMaxLength: 40, @@ -142,7 +142,7 @@ protected override void Down(MigrationBuilder migrationBuilder) type: "nvarchar(40)", maxLength: 40, nullable: false, - defaultValue: "", + defaultValue: string.Empty, oldClrType: typeof(string), oldType: "nvarchar(40)", oldMaxLength: 40, @@ -154,7 +154,7 @@ protected override void Down(MigrationBuilder migrationBuilder) type: "nvarchar(40)", maxLength: 40, nullable: false, - defaultValue: "", + defaultValue: string.Empty, oldClrType: typeof(string), oldType: "nvarchar(40)", oldMaxLength: 40, diff --git a/OutOfSchool/OutOfSchool.IdentityServer/wwwroot/css/site.css b/OutOfSchool/OutOfSchool.IdentityServer/wwwroot/css/site.css index 5d62eca720..5532c56766 100644 --- a/OutOfSchool/OutOfSchool.IdentityServer/wwwroot/css/site.css +++ b/OutOfSchool/OutOfSchool.IdentityServer/wwwroot/css/site.css @@ -400,9 +400,9 @@ a { } .field-validation-error { - color: #ff0000; - font-family: Arial; - font-size: 12px; + color: #ff0000; + font-family: Open Sans; + font-size: 12px; } .field-validation-valid { diff --git a/OutOfSchool/OutOfSchool.IdentityServer/wwwroot/js/site.js b/OutOfSchool/OutOfSchool.IdentityServer/wwwroot/js/site.js index 451bef34c7..5bfc8bbca8 100644 --- a/OutOfSchool/OutOfSchool.IdentityServer/wwwroot/js/site.js +++ b/OutOfSchool/OutOfSchool.IdentityServer/wwwroot/js/site.js @@ -13,9 +13,9 @@ let repeatPassword = document.getElementById('repeat_password'); if (password.className.includes('input-validation-error')) { let elements = document.getElementsByClassName('registration_privacy'); - for (var i = 0; i < elements.length; i++) { - elements[i].style.height = "65px"; - } + for (let element of elements) { + element.style.height = "65px"; + } } if (document.getElementsByClassName('validation-summary-errors').length > 0) { From 9691443d7af4b0318a1e409a52dfc48328267924 Mon Sep 17 00:00:00 2001 From: VyacheslavDzhus Date: Fri, 16 Apr 2021 19:50:18 +0300 Subject: [PATCH 8/9] fix issues --- .../Controllers/AuthControllerTests.cs | 4 ++-- OutOfSchool/OutOfSchool.IdentityServer/wwwroot/css/site.css | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/OutOfSchool/OutOfSchool.IdentityServer.Tests/Controllers/AuthControllerTests.cs b/OutOfSchool/OutOfSchool.IdentityServer.Tests/Controllers/AuthControllerTests.cs index 43b09f51d3..91e238af88 100644 --- a/OutOfSchool/OutOfSchool.IdentityServer.Tests/Controllers/AuthControllerTests.cs +++ b/OutOfSchool/OutOfSchool.IdentityServer.Tests/Controllers/AuthControllerTests.cs @@ -223,13 +223,13 @@ public async Task ExternalLogin_ReturnsNotImplementedEx() { new TestCaseData(new RegisterViewModel() { - Username = "Baron", + Email = "test123@gmail.com", PhoneNumber = "0502391222", ReturnUrl = "Return url", }), new TestCaseData(new RegisterViewModel() { - Username = "Baron", + Email = "test123@gmail.com", PhoneNumber = "0502391222", ReturnUrl = "Return url2", }), diff --git a/OutOfSchool/OutOfSchool.IdentityServer/wwwroot/css/site.css b/OutOfSchool/OutOfSchool.IdentityServer/wwwroot/css/site.css index 5532c56766..38bf57334b 100644 --- a/OutOfSchool/OutOfSchool.IdentityServer/wwwroot/css/site.css +++ b/OutOfSchool/OutOfSchool.IdentityServer/wwwroot/css/site.css @@ -401,7 +401,7 @@ a { .field-validation-error { color: #ff0000; - font-family: Open Sans; + font-family: Helvetica, Arial, Verdana, Tahoma, sans-serif; font-size: 12px; } From 0dad30ffaf39c7747b13ceb0340101543b9b96d2 Mon Sep 17 00:00:00 2001 From: VyacheslavDzhus Date: Mon, 19 Apr 2021 16:56:11 +0300 Subject: [PATCH 9/9] changed Name to FirstName and fix migrations --- .../OutOfSchool.DataAccess/Models/User.cs | 2 +- .../Controllers/AuthController.cs | 2 +- .../20210413215419_updatedUser.cs | 144 +----------------- .../OutOfSchoolDbContextModelSnapshot.cs | 6 +- .../ViewModels/RegisterViewModel.cs | 5 +- .../Views/Auth/Register.cshtml | 8 +- 6 files changed, 16 insertions(+), 151 deletions(-) diff --git a/OutOfSchool/OutOfSchool.DataAccess/Models/User.cs b/OutOfSchool/OutOfSchool.DataAccess/Models/User.cs index ce23ededc7..00e7a04513 100644 --- a/OutOfSchool/OutOfSchool.DataAccess/Models/User.cs +++ b/OutOfSchool/OutOfSchool.DataAccess/Models/User.cs @@ -16,6 +16,6 @@ public class User : IdentityUser public string MiddleName { get; set; } - public string Name { get; set; } + public string FirstName { get; set; } } } \ No newline at end of file diff --git a/OutOfSchool/OutOfSchool.IdentityServer/Controllers/AuthController.cs b/OutOfSchool/OutOfSchool.IdentityServer/Controllers/AuthController.cs index b1d3f72ca9..5df72f744e 100644 --- a/OutOfSchool/OutOfSchool.IdentityServer/Controllers/AuthController.cs +++ b/OutOfSchool/OutOfSchool.IdentityServer/Controllers/AuthController.cs @@ -139,7 +139,7 @@ public async Task Register(RegisterViewModel model) var user = new User() { UserName = model.Email, - Name = model.Name, + FirstName = model.FirstName, LastName = model.LastName, MiddleName = model.MiddleName, Email = model.Email, diff --git a/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210413215419_updatedUser.cs b/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210413215419_updatedUser.cs index aba86df529..7e0c3e6f35 100644 --- a/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210413215419_updatedUser.cs +++ b/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210413215419_updatedUser.cs @@ -6,56 +6,6 @@ public partial class updatedUser : Migration { protected override void Up(MigrationBuilder migrationBuilder) { - migrationBuilder.DropForeignKey( - name: "FK_Parents_AspNetUsers_UserId1", - table: "Parents"); - - migrationBuilder.DropIndex( - name: "IX_Parents_UserId1", - table: "Parents"); - - migrationBuilder.DropColumn( - name: "UserId1", - table: "Parents"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "Parents", - type: "nvarchar(450)", - nullable: false, - oldClrType: typeof(long), - oldType: "bigint"); - - migrationBuilder.AlterColumn( - name: "Patronymic", - table: "Children", - type: "nvarchar(40)", - maxLength: 40, - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(40)", - oldMaxLength: 40); - - migrationBuilder.AlterColumn( - name: "LastName", - table: "Children", - type: "nvarchar(40)", - maxLength: 40, - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(40)", - oldMaxLength: 40); - - migrationBuilder.AlterColumn( - name: "FirstName", - table: "Children", - type: "nvarchar(40)", - maxLength: 40, - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(40)", - oldMaxLength: 40); - migrationBuilder.AddColumn( name: "LastName", table: "AspNetUsers", @@ -63,7 +13,7 @@ protected override void Up(MigrationBuilder migrationBuilder) nullable: true); migrationBuilder.AddColumn( - name: "Name", + name: "FirstName", table: "AspNetUsers", type: "nvarchar(max)", nullable: true); @@ -72,106 +22,22 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "MiddleName", table: "AspNetUsers", type: "nvarchar(max)", - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_Parents_UserId", - table: "Parents", - column: "UserId"); - - migrationBuilder.AddForeignKey( - name: "FK_Parents_AspNetUsers_UserId", - table: "Parents", - column: "UserId", - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); + nullable: true); } protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Parents_AspNetUsers_UserId", - table: "Parents"); - - migrationBuilder.DropIndex( - name: "IX_Parents_UserId", - table: "Parents"); - + { migrationBuilder.DropColumn( name: "LastName", table: "AspNetUsers"); migrationBuilder.DropColumn( - name: "Name", + name: "FirstName", table: "AspNetUsers"); migrationBuilder.DropColumn( name: "MiddleName", - table: "AspNetUsers"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "Parents", - type: "bigint", - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(450)"); - - migrationBuilder.AddColumn( - name: "UserId1", - table: "Parents", - type: "nvarchar(450)", - nullable: true); - - migrationBuilder.AlterColumn( - name: "Patronymic", - table: "Children", - type: "nvarchar(40)", - maxLength: 40, - nullable: false, - defaultValue: string.Empty, - oldClrType: typeof(string), - oldType: "nvarchar(40)", - oldMaxLength: 40, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "LastName", - table: "Children", - type: "nvarchar(40)", - maxLength: 40, - nullable: false, - defaultValue: string.Empty, - oldClrType: typeof(string), - oldType: "nvarchar(40)", - oldMaxLength: 40, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "FirstName", - table: "Children", - type: "nvarchar(40)", - maxLength: 40, - nullable: false, - defaultValue: string.Empty, - oldClrType: typeof(string), - oldType: "nvarchar(40)", - oldMaxLength: 40, - oldNullable: true); - - migrationBuilder.CreateIndex( - name: "IX_Parents_UserId1", - table: "Parents", - column: "UserId1"); - - migrationBuilder.AddForeignKey( - name: "FK_Parents_AspNetUsers_UserId1", - table: "Parents", - column: "UserId1", - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); + table: "AspNetUsers"); } } } diff --git a/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/OutOfSchoolDbContextModelSnapshot.cs b/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/OutOfSchoolDbContextModelSnapshot.cs index 09cdfb86fb..550fab50af 100644 --- a/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/OutOfSchoolDbContextModelSnapshot.cs +++ b/OutOfSchool/OutOfSchool.IdentityServer/Data/Migrations/OutOfSchoolMigrations/OutOfSchoolDbContextModelSnapshot.cs @@ -515,6 +515,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("EmailConfirmed") .HasColumnType("bit"); + b.Property("FirstName") + .HasColumnType("nvarchar(max)"); + b.Property("LastLogin") .HasColumnType("datetime2"); @@ -530,9 +533,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("MiddleName") .HasColumnType("nvarchar(max)"); - b.Property("Name") - .HasColumnType("nvarchar(max)"); - b.Property("NormalizedEmail") .HasMaxLength(256) .HasColumnType("nvarchar(256)"); diff --git a/OutOfSchool/OutOfSchool.IdentityServer/ViewModels/RegisterViewModel.cs b/OutOfSchool/OutOfSchool.IdentityServer/ViewModels/RegisterViewModel.cs index 136b3ffc52..402961caad 100644 --- a/OutOfSchool/OutOfSchool.IdentityServer/ViewModels/RegisterViewModel.cs +++ b/OutOfSchool/OutOfSchool.IdentityServer/ViewModels/RegisterViewModel.cs @@ -5,13 +5,12 @@ namespace OutOfSchool.IdentityServer.ViewModels { public class RegisterViewModel { - [Required(ErrorMessage = "Name is required")] - public string Name { get; set; } + [Required(ErrorMessage = "FirstName is required")] + public string FirstName { get; set; } [Required(ErrorMessage = "LastName is required")] public string LastName { get; set; } - [Required(ErrorMessage = "MiddleName is required")] public string MiddleName { get; set; } [Required(ErrorMessage = "Password is required")] diff --git a/OutOfSchool/OutOfSchool.IdentityServer/Views/Auth/Register.cshtml b/OutOfSchool/OutOfSchool.IdentityServer/Views/Auth/Register.cshtml index 6f82b71872..34bac1b7d0 100644 --- a/OutOfSchool/OutOfSchool.IdentityServer/Views/Auth/Register.cshtml +++ b/OutOfSchool/OutOfSchool.IdentityServer/Views/Auth/Register.cshtml @@ -55,14 +55,14 @@
    • - - + +
      - +
    • - +