Reverse statut & Fix Server Salt Time & Clean Code & Update API
This commit is contained in:
2
MareAPI
2
MareAPI
Submodule MareAPI updated: ff262bf690...7a48ca9823
@@ -113,7 +113,8 @@ public class JwtController : Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
var existingIdent = await _redis.GetAsync<string>("UID:" + authResult.Uid);
|
var existingIdent = await _redis.GetAsync<string>("UID:" + authResult.Uid);
|
||||||
if (!string.IsNullOrEmpty(existingIdent)) return Unauthorized("Already logged in to this account. Reconnect in 60 seconds. If you keep seeing this issue, restart your game.");
|
if (!string.IsNullOrEmpty(existingIdent) && !string.Equals(existingIdent, charaIdent, StringComparison.Ordinal))
|
||||||
|
return Unauthorized("Already logged in to this account. Reconnect in 60 seconds. If you keep seeing this issue, restart your game.");
|
||||||
|
|
||||||
var token = CreateToken(new List<Claim>()
|
var token = CreateToken(new List<Claim>()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ public partial class MareHub
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Authorize(Policy = "Identified")]
|
[Authorize(Policy = "Identified")]
|
||||||
public async Task<GroupPasswordDto> GroupCreate()
|
public async Task<GroupPasswordDto> GroupCreate(string? alias)
|
||||||
{
|
{
|
||||||
_logger.LogCallInfo();
|
_logger.LogCallInfo();
|
||||||
var existingGroupsByUser = await DbContext.Groups.CountAsync(u => u.OwnerUID == UserUID).ConfigureAwait(false);
|
var existingGroupsByUser = await DbContext.Groups.CountAsync(u => u.OwnerUID == UserUID).ConfigureAwait(false);
|
||||||
@@ -223,12 +223,23 @@ public partial class MareHub
|
|||||||
var sha = SHA256.Create();
|
var sha = SHA256.Create();
|
||||||
var hashedPw = StringUtils.Sha256String(passwd);
|
var hashedPw = StringUtils.Sha256String(passwd);
|
||||||
|
|
||||||
|
string? sanitizedAlias = null;
|
||||||
|
if (!string.IsNullOrWhiteSpace(alias))
|
||||||
|
{
|
||||||
|
sanitizedAlias = alias.Trim();
|
||||||
|
if (sanitizedAlias.Length > 50)
|
||||||
|
{
|
||||||
|
sanitizedAlias = sanitizedAlias[..50];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Group newGroup = new()
|
Group newGroup = new()
|
||||||
{
|
{
|
||||||
GID = gid,
|
GID = gid,
|
||||||
HashedPassword = hashedPw,
|
HashedPassword = hashedPw,
|
||||||
InvitesEnabled = true,
|
InvitesEnabled = true,
|
||||||
OwnerUID = UserUID,
|
OwnerUID = UserUID,
|
||||||
|
Alias = sanitizedAlias,
|
||||||
};
|
};
|
||||||
|
|
||||||
GroupPair initialPair = new()
|
GroupPair initialPair = new()
|
||||||
|
|||||||
Reference in New Issue
Block a user