管理页面
This commit is contained in:
1 parent
4ef6f6c90d
commit
2fbc8c9285
37 files changed
+1793
-13
No files matched your search
@@ -5,6 +5,7 @@ using ElectionSystem.Api.Modules.Organization;
|
||||
using ElectionSystem.Api.Modules.Organization.Domain;
|
||||
using ElectionSystem.Api.Modules.Voters.Domain;
|
||||
using System.Text;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace ElectionSystem.Api.Tests;
|
||||
@@ -73,4 +74,16 @@ public sealed class PersistenceModelTests
|
||||
Assert.Equal(district.Id, township.ParentId);
|
||||
Assert.Equal(AdministrativeRegionLevel.Township, township.Level);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Local_identity_password_hash_cannot_be_reused_as_plaintext()
|
||||
{
|
||||
var user = new ApplicationUser { UserName = "local-admin", DisplayName = "Local administrator" };
|
||||
var hasher = new PasswordHasher<ApplicationUser>();
|
||||
var hash = hasher.HashPassword(user, "Correct-Horse-7!Battery");
|
||||
|
||||
Assert.NotEqual("Correct-Horse-7!Battery", hash);
|
||||
Assert.NotEqual(PasswordVerificationResult.Failed, hasher.VerifyHashedPassword(user, hash, "Correct-Horse-7!Battery"));
|
||||
Assert.Equal(PasswordVerificationResult.Failed, hasher.VerifyHashedPassword(user, hash, "wrong-password"));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user