mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-04-19 19:14:51 +00:00
* Base64 encode auth tokens to prevent issues in emails This fixes #1023, which should in turn solve some issues people were having with emails. * Make test bcrypt hash things as the auth token isn't one by default * Update ProjectLighthouse/Helpers/CryptoHelper.cs Co-authored-by: Josh <josh@slendy.pw> * Make only email tokens base64 encoded --------- Co-authored-by: Zaprit <zaprit@hugespaceship.io> Co-authored-by: Josh <josh@slendy.pw>
29 lines
No EOL
1 KiB
C#
29 lines
No EOL
1 KiB
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using LBPUnion.ProjectLighthouse.Database;
|
|
using LBPUnion.ProjectLighthouse.Helpers;
|
|
using LBPUnion.ProjectLighthouse.Servers.GameServer.Startup;
|
|
using LBPUnion.ProjectLighthouse.Tests.Helpers;
|
|
using LBPUnion.ProjectLighthouse.Tests.Integration;
|
|
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
|
using Xunit;
|
|
|
|
namespace ProjectLighthouse.Tests.GameApiTests.Integration;
|
|
|
|
[Trait("Category", "Integration")]
|
|
public class DatabaseTests : LighthouseServerTest<GameServerTestStartup>
|
|
{
|
|
[Fact]
|
|
public async Task CanCreateUserTwice()
|
|
{
|
|
await using DatabaseContext database = await IntegrationHelper.GetIntegrationDatabase();
|
|
|
|
int rand = new Random().Next();
|
|
|
|
UserEntity userA = await database.CreateUser("unitTestUser" + rand, CryptoHelper.BCryptHash(CryptoHelper.GenerateAuthToken()));
|
|
UserEntity userB = await database.CreateUser("unitTestUser" + rand, CryptoHelper.BCryptHash(CryptoHelper.GenerateAuthToken()));
|
|
|
|
Assert.NotNull(userA);
|
|
Assert.NotNull(userB);
|
|
}
|
|
} |