Removed password from profiles

Added migration to remove password property from profiles
This commit is contained in:
Chomp
2025-10-02 09:56:51 +01:00
parent d178a0ae83
commit ba4e8d9c14
12 changed files with 1 additions and 95 deletions
@@ -45,12 +45,6 @@ public class LauncherCallbacks(
return new ValueTask<string>(string.IsNullOrEmpty(output) ? "FAILED" : "OK");
}
public ValueTask<string> ChangePassword(string url, ChangeRequestData info, MongoId sessionID)
{
var output = launcherController.ChangePassword(info);
return new ValueTask<string>(string.IsNullOrEmpty(output) ? "FAILED" : "OK");
}
public ValueTask<string> Wipe(string url, RegisterData info, MongoId sessionID)
{
var output = launcherController.Wipe(info);
@@ -1,6 +1,5 @@
using SPTarkov.DI.Annotations;
using SPTarkov.Server.Core.Controllers;
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Eft.Launcher;
using SPTarkov.Server.Core.Models.Spt.Launcher;
using SPTarkov.Server.Core.Utils;
@@ -40,17 +39,6 @@ public class LauncherV2Callbacks(
);
}
public async ValueTask<string> PasswordChange(ChangeRequestData info)
{
return httpResponseUtil.NoBody(
new LauncherV2PasswordChangeResponse
{
Response = await launcherV2Controller.PasswordChange(info),
Profiles = profileController.GetMiniProfiles(),
}
);
}
public ValueTask<string> Remove(LoginRequestData info)
{
return new ValueTask<string>(
@@ -122,7 +122,6 @@ public class LauncherController(
ScavengerId = scavId,
Aid = hashUtil.GenerateAccountId(),
Username = info.Username,
Password = info.Password,
IsWiped = true,
Edition = info.Edition,
};
@@ -150,22 +149,6 @@ public class LauncherController(
return sessionID;
}
/// <summary>
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
public string? ChangePassword(ChangeRequestData info)
{
var sessionID = Login(info);
if (!string.IsNullOrEmpty(sessionID))
{
saveServer.GetProfile(sessionID).ProfileInfo!.Password = info.Change;
}
return sessionID;
}
/// <summary>
/// Handle launcher requesting profile be wiped
/// </summary>
@@ -83,30 +83,6 @@ public class LauncherV2Controller(
return true;
}
/// <summary>
/// Make a password change.
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
public async Task<bool> PasswordChange(ChangeRequestData info)
{
var sessionId = GetSessionId(info);
if (sessionId.IsEmpty)
{
return false;
}
if (!Login(info))
{
return false;
}
saveServer.GetProfile(sessionId).ProfileInfo!.Password = info.Change;
await saveServer.SaveProfileAsync(sessionId);
return true;
}
/// <summary>
/// Remove profile from server.
/// </summary>
@@ -163,7 +139,6 @@ public class LauncherV2Controller(
ScavengerId = scavId,
Aid = hashUtil.GenerateAccountId(),
Username = info.Username,
Password = info.Password,
IsWiped = true,
Edition = info.Edition,
};
@@ -180,7 +155,7 @@ public class LauncherV2Controller(
{
foreach (var (sessionId, profile) in saveServer.GetProfiles())
{
if (info.Username == profile.ProfileInfo!.Username && info.Password == profile.ProfileInfo.Password)
if (info.Username == profile.ProfileInfo!.Username)
{
return sessionId;
}
@@ -59,7 +59,6 @@ public class ProfileController(
{
Username = profile.ProfileInfo?.Username ?? string.Empty,
Nickname = "unknown",
HasPassword = profile.ProfileInfo?.Password != string.Empty,
Side = "unknown",
CurrentLevel = 0,
CurrentExperience = 0,
@@ -77,7 +76,6 @@ public class ProfileController(
{
Username = profile.ProfileInfo?.Username,
Nickname = pmc.Info.Nickname,
HasPassword = profile.ProfileInfo?.Password != "",
Side = pmc.Info.Side,
CurrentLevel = pmc.Info.Level,
CurrentExperience = pmc.Info.Experience ?? 0,
@@ -7,7 +7,4 @@ public record GetMiniProfileRequestData : IRequestData
{
[JsonPropertyName("username")]
public string? Username { get; set; }
[JsonPropertyName("password")]
public string? Password { get; set; }
}
@@ -7,7 +7,4 @@ public record LoginRequestData : IRequestData
{
[JsonPropertyName("username")]
public string? Username { get; set; }
[JsonPropertyName("password")]
public string? Password { get; set; }
}
@@ -39,7 +39,4 @@ public record MiniProfile
[JsonPropertyName("sptData")]
public Profile.Spt? SptData { get; set; }
[JsonPropertyName("hasPassword")]
public bool? HasPassword { get; set; }
}
@@ -93,9 +93,6 @@ public record Info
[JsonPropertyName("username")]
public string? Username { get; set; }
[JsonPropertyName("password")]
public string? Password { get; set; }
[JsonPropertyName("wipe")]
public bool? IsWiped { get; set; }
@@ -1,12 +0,0 @@
using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Eft.Launcher;
using SPTarkov.Server.Core.Models.Utils;
namespace SPTarkov.Server.Core.Models.Spt.Launcher;
public class LauncherV2PasswordChangeResponse : IRequestData
{
public required bool Response { get; set; }
public required List<MiniProfile> Profiles { get; set; }
}
@@ -33,10 +33,6 @@ public class LauncherStaticRouter(LauncherCallbacks launcherCallbacks, JsonUtil
"/launcher/profile/change/username",
async (url, info, sessionID, _) => await launcherCallbacks.ChangeUsername(url, info, sessionID)
),
new RouteAction<ChangeRequestData>(
"/launcher/profile/change/password",
async (url, info, sessionID, _) => await launcherCallbacks.ChangePassword(url, info, sessionID)
),
new RouteAction<RegisterData>(
"/launcher/profile/change/wipe",
async (url, info, sessionID, _) => await launcherCallbacks.Wipe(url, info, sessionID)
@@ -22,10 +22,6 @@ public class LauncherV2StaticRouter(LauncherV2Callbacks launcherV2Callbacks, Jso
"/launcher/v2/register",
async (url, info, sessionID, _) => await launcherV2Callbacks.Register(info)
),
new RouteAction<ChangeRequestData>(
"/launcher/v2/passwordChange",
async (url, info, sessionID, _) => await launcherV2Callbacks.PasswordChange(info)
),
new RouteAction<LoginRequestData>(
"/launcher/v2/remove",
async (url, info, sessionID, _) => await launcherV2Callbacks.Remove(info)