diff --git a/Moonlight/App/Database/Entities/User.cs b/Moonlight/App/Database/Entities/User.cs index 0196571..f99b8c6 100644 --- a/Moonlight/App/Database/Entities/User.cs +++ b/Moonlight/App/Database/Entities/User.cs @@ -9,7 +9,14 @@ public class User // Personal data + [Required] + [MinLength(3, ErrorMessage = "Invalid first name")] + [MaxLength(64, ErrorMessage = "Max lenght reached")] public string FirstName { get; set; } = ""; + + [Required] + [MinLength(3, ErrorMessage = "Invalid last name")] + [MaxLength(64, ErrorMessage = "Max lenght reached")] public string LastName { get; set; } = ""; [Required(ErrorMessage = "You need to enter an email address")] @@ -19,9 +26,26 @@ public class User [Required(ErrorMessage = "You need to enter a password")] [MinLength(8, ErrorMessage = "You need to enter a password with minimum 8 characters in lenght")] public string Password { get; set; } = ""; + + [Required] + [RegularExpression(@"^(?:[A-Z] \d|[^\W\d_]{2,}\.?)(?:[- '’][^\W\d_]+\.?)*\s+[1-9]\d{0,3} ?[a-zA-Z]?(?: ?[/-] ?[1-9]\d{0,3} ?[a-zA-Z]?)?$", + ErrorMessage = "Street and house number required")] + [MaxLength(128, ErrorMessage = "Max lenght reached")] public string Address { get; set; } = ""; + + [Required] + [MinLength(3, ErrorMessage = "Invalid city")] + [MaxLength(128, ErrorMessage = "Max lenght reached")] public string City { get; set; } = ""; + + [Required] + [MinLength(3, ErrorMessage = "Invalid state")] + [MaxLength(64, ErrorMessage = "Max lenght reached")] public string State { get; set; } = ""; + + [Required] + [MinLength(3, ErrorMessage = "Invalid country")] + [MaxLength(64, ErrorMessage = "Max lenght reached")] public string Country { get; set; } = ""; // States diff --git a/Moonlight/Shared/Views/Index.razor b/Moonlight/Shared/Views/Index.razor index c07a66b..44de796 100644 --- a/Moonlight/Shared/Views/Index.razor +++ b/Moonlight/Shared/Views/Index.razor @@ -96,11 +96,16 @@ -
-
- - Create something new - + +
+
+
+

+ Create something new +

+
+
+
@@ -115,6 +120,7 @@
+
@@ -128,6 +134,7 @@
+
@@ -141,6 +148,7 @@
+
@@ -157,11 +165,16 @@
-
-
- - Manage your services - + +
+
+
+

+ Manage your services +

+
+
+
@@ -176,6 +189,7 @@
+
@@ -189,6 +203,7 @@
+
@@ -202,6 +217,7 @@
+
diff --git a/Moonlight/Shared/Views/Profile/Index.razor b/Moonlight/Shared/Views/Profile/Index.razor index 5f0511c..81fd74d 100644 --- a/Moonlight/Shared/Views/Profile/Index.razor +++ b/Moonlight/Shared/Views/Profile/Index.razor @@ -1,4 +1,94 @@ @page "/profile" -@using Moonlight.Shared.Components.Navigations - \ No newline at end of file +@using Moonlight.Shared.Components.Navigations +@using Moonlight.App.Services.Sessions +@using Moonlight.App.Database.Entities +@using Moonlight.App.Repositories + +@inject IdentityService IdentityService +@inject UserRepository UserRepository + + + + + +
+
+
+

Persönliche Daten

+
+
+
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+
+ +@code +{ + private User User = new User(); + + + private async Task Load(LazyLoader loader) + { + User = await IdentityService.Get(); + } + + private void Save() + { + UserRepository.Update(User); + } +} diff --git a/Moonlight/resources/lang/de_de.lang b/Moonlight/resources/lang/de_de.lang index fa0b798..8f280da 100644 --- a/Moonlight/resources/lang/de_de.lang +++ b/Moonlight/resources/lang/de_de.lang @@ -399,3 +399,11 @@ You need to enter an email address;You need to enter an email address You need to enter a password;You need to enter a password You need to enter a password with minimum 8 characters in lenght;You need to enter a password with minimum 8 characters in lenght Proccessing;Proccessing +The FirstName field is required.;The FirstName field is required. +The LastName field is required.;The LastName field is required. +The Address field is required.;The Address field is required. +The City field is required.;The City field is required. +The State field is required.;The State field is required. +The Country field is required.;The Country field is required. +Street and house number requered;Street and house number requered +Max lenght reached;Max lenght reached \ No newline at end of file