From 5d8796299c005d947466b125a6eef567a7997548 Mon Sep 17 00:00:00 2001 From: Daniel Balk <67603460+Daniel-Balk@users.noreply.github.com> Date: Mon, 3 Apr 2023 21:07:55 +0200 Subject: [PATCH] force password change after login --- Moonlight/App/Models/Forms/PasswordModel.cs | 10 +++ Moonlight/App/Models/Misc/UserStatus.cs | 3 +- .../Components/Auth/PasswordChangeView.razor | 64 +++++++++++++++++++ Moonlight/Shared/Layouts/MainLayout.razor | 4 ++ Moonlight/resources/lang/de_de.lang | 2 + Moonlight/resources/mail/passwordChange.html | 53 +++++++++++++++ 6 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 Moonlight/App/Models/Forms/PasswordModel.cs create mode 100644 Moonlight/Shared/Components/Auth/PasswordChangeView.razor create mode 100644 Moonlight/resources/mail/passwordChange.html diff --git a/Moonlight/App/Models/Forms/PasswordModel.cs b/Moonlight/App/Models/Forms/PasswordModel.cs new file mode 100644 index 00000000..237f6a43 --- /dev/null +++ b/Moonlight/App/Models/Forms/PasswordModel.cs @@ -0,0 +1,10 @@ +using System.ComponentModel.DataAnnotations; + +namespace Moonlight.App.Models.Forms; + +public class PasswordModel +{ + [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; } +} \ No newline at end of file diff --git a/Moonlight/App/Models/Misc/UserStatus.cs b/Moonlight/App/Models/Misc/UserStatus.cs index 22bf70c6..a270ead5 100644 --- a/Moonlight/App/Models/Misc/UserStatus.cs +++ b/Moonlight/App/Models/Misc/UserStatus.cs @@ -9,5 +9,6 @@ public enum UserStatus Warned, Banned, Disabled, - DataPending + DataPending, + PasswordPending } \ No newline at end of file diff --git a/Moonlight/Shared/Components/Auth/PasswordChangeView.razor b/Moonlight/Shared/Components/Auth/PasswordChangeView.razor new file mode 100644 index 00000000..f57d1aa7 --- /dev/null +++ b/Moonlight/Shared/Components/Auth/PasswordChangeView.razor @@ -0,0 +1,64 @@ +@using Moonlight.App.Services +@using Moonlight.App.Models.Forms +@using Moonlight.App.Services.Sessions +@using Moonlight.App.Database.Entities +@using Moonlight.App.Models.Misc +@using Moonlight.App.Repositories + +@inject SmartTranslateService SmartTranslateService +@inject IdentityService IdentityService +@inject UserService UserService +@inject UserRepository UserRepository +@inject NavigationManager NavigationManager + +
|
+
+
+
+
+
+
+
+
+
+ Open Moonlight
+
+ Hey {{FirstName}}, your password has been changed +If this was not you please contact us. Also here is the data we collected. +IP: {{Ip}} +Device: {{Device}} +Location: {{Location}} + |
+
|
+ You need help? +We are happy to help! +More information at + endelon.link/support. + + |
+
|
+ Copyright 2023 Endelon Hosting + |
+