Merge branch 'main' into CleanupFix
This commit is contained in:
@@ -23,4 +23,5 @@ public enum AuditLogType
|
||||
CleanupEnabled,
|
||||
CleanupDisabled,
|
||||
CleanupTriggered,
|
||||
PasswordChange,
|
||||
}
|
||||
14
Moonlight/App/Models/Misc/LoginDataModel.cs
Normal file
14
Moonlight/App/Models/Misc/LoginDataModel.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Moonlight.App.Models.Misc;
|
||||
|
||||
public class LoginDataModel
|
||||
{
|
||||
[Required(ErrorMessage = "You need to enter an email address")]
|
||||
[EmailAddress(ErrorMessage = "You need to enter a valid email address")]
|
||||
public string Email { get; set; }
|
||||
|
||||
[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; }
|
||||
}
|
||||
@@ -46,8 +46,7 @@ public class TotpService
|
||||
public async Task Enable()
|
||||
{
|
||||
var user = (await IdentityService.Get())!;
|
||||
|
||||
user.TotpEnabled = true;
|
||||
|
||||
user.TotpSecret = GenerateSecret();
|
||||
|
||||
UserRepository.Update(user);
|
||||
@@ -55,6 +54,14 @@ public class TotpService
|
||||
await AuditLogService.Log(AuditLogType.EnableTotp, user.Email);
|
||||
}
|
||||
|
||||
public async Task EnforceTotpLogin()
|
||||
{
|
||||
var user = (await IdentityService.Get())!;
|
||||
|
||||
user.TotpEnabled = true;
|
||||
UserRepository.Update(user);
|
||||
}
|
||||
|
||||
public async Task Disable()
|
||||
{
|
||||
var user = (await IdentityService.Get())!;
|
||||
|
||||
Reference in New Issue
Block a user