0% found this document useful (0 votes)
25 views5 pages

Repository

The document outlines the implementation of an account authorization system for a gaming platform, detailing the process of user login and error handling. It includes methods for checking user credentials, managing session data, and handling various authorization states. The code also integrates database interactions and user notifications based on the authorization results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views5 pages

Repository

The document outlines the implementation of an account authorization system for a gaming platform, detailing the process of user login and error handling. It includes methods for checking user credentials, managing session data, and handling various authorization states. The code also integrates database interactions and user notifications based on the authorization results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

using Database;

using GTANetworkAPI;
using [Link];
using LinqToDB;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using System;
using [Link];
using [Link];
using [Link];
using Localization;

namespace [Link]
{
public class Repository
{
private static readonly nLog Log = new
nLog("[Link]");

public static async Task AutorizationAccount(ExtPlayer player, string


loginOrEmail, string password)
{
/*Ban ban = Ban.Get1(player, login);
if (ban != null)
{
if ([Link] && [Link]())
{
[Link](player, ban);
return;
}
}*/
var testSpeedLoad = [Link];
AutorizationEnum result = await InitAccount(player, loginOrEmail,
password);
if (result == [Link])
[Link](player, testSpeedLoad);
else if (result == [Link]) [Link](player,
[Link], [Link], [Link]([Link],
[Link]), 3000);
else if (result == [Link]) [Link](player,
[Link], [Link], [Link]([Link],
[Link]), 3000);
else if (result == [Link]) [Link](player,
[Link], [Link], [Link]([Link],
[Link]), 3000);
else if (result == [Link]) [Link](player,
[Link], [Link], [Link]([Link],
[Link]), 3000);
else if (result == [Link]) [Link](player,
[Link], [Link], [Link]([Link],
[Link]), 3000);
//else if (result == [Link]) [Link](player,
[Link], [Link], "", 3000);
//[Link]($"{[Link]} ({[Link]} |
{[Link]}) tryed to signin.");
}

public static async Task<AutorizationEnum> InitAccount(ExtPlayer player,


string loginOrEmail, string password)
{
try
{
var sessionData = [Link]();
if (sessionData == null)
return [Link];
if ([Link]("NONE") ||
[Link]("NONE"))
return [Link];
if ([Link]())
return [Link];
if ([Link](player))
return [Link];

var auntificationData = [Link];

if ([Link] != 0 && ![Link])


return [Link];

loginOrEmail = [Link]();

if (loginOrEmail == [Link]())
{
if ([Link] != password)
return [Link];
}

await using var db = new ServerBD("MainDB");//В отдельном потоке

// Получаем модель пользователя по логину


var account = await [Link]
.Where(v => ([Link]() == loginOrEmail ||
[Link]() == loginOrEmail) && [Link] == password)
.FirstOrDefaultAsync();

// Если база не вернула значение, то отправляем сброс


if (account == null)
return [Link];

if ([Link] != 0 && !
[Link]([Link]) && !
[Link]([Link]))
return [Link];

var target = [Link]([Link]);


if ([Link] && target != null)
return [Link];

if ([Link](player))
return [Link];

/*if ([Link]().Any(p =>


[Link]()?.Login == [Link]))
return [Link];*/
//Удаляем таймер на авторизацию
if ([Link] != null)
{
[Link]([Link]);
[Link] = null;
}

var accountData = new AccountData


{
Login = [Link],
Email = [Link],
Password = [Link],
HWID = [Link],
IP = [Link],
SocialClub = [Link],
RedBucks = [Link],
VipLvl = [Link],
VipDate = [Link],

PresentGet = [Link]([Link]),
RefPresentGet = [Link]([Link]),

RefferalId = [Link],

isSubscribe = [Link],
SubscribeEndTime = [Link],
SubscribeTime = [Link],

ReceivedAwardWeek = [Link],
ReceivedAwardDonate = [Link],

Unique = [Link]([Link]),

LastSelectCharUUID = [Link],

Ga = [Link],
};

//
try
{
[Link] =
[Link]<List<string>>([Link]);
}
catch
{
[Link] = new List<string>();
}
//
try
{
[Link] =
[Link]<List<string>>([Link]);
}
catch
{
[Link] = new List<string>();
}
//
List<int> Chars = new List<int>();
try
{
Chars =
[Link]<List<int>>([Link]);
}
catch
{
Chars = new List<int>() { -2, -2, -2, -2, -2, -2 };
}

[Link] = new List<int>()


{
account.Character1,
account.Character2,
account.Character3,
};

if ([Link])
{
foreach (int i in Chars)
{
[Link](i);
}
}

//
try
{
[Link] =
[Link]<int[]>(account.@case);
}
catch
{
[Link] = new int[3] { 0, 0, 0 };
}
//
try
{
[Link] =
[Link]<List<int>>([Link]);
}
catch
{
[Link] = new List<int>();
}

try
{
[Link] =
[Link]<List<int>>([Link]);
if ([Link] < 9)
[Link](0);
if ([Link] < 10)
[Link](0);
if ([Link] < 11)
[Link](0);
if ([Link] < 12)
[Link](0);
if ([Link] < 13)
[Link](0);
if ([Link] < 14)
[Link](0);
}
catch
{
[Link] = new List<int>() { 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 0, 0, 0 };
}
//
if ([Link] > [Link])
{
[Link] = false;
[Link] = [Link];
[Link] = [Link];
}

[Link](accountData);

if (![Link]([Link]))
[Link]([Link]);

[Link](player);//TODO

//

var ticks = Convert.ToInt64([Link] -


[Link]);

if (ticks >= 1)
{
var date = new DateTime(ticks);

if ([Link] > 20)

[Link]("login_returned_user", [Link],
[Link]);
else
[Link]("login_current_user",
[Link], [Link]);
}
//

return [Link];
}
catch (Exception e)
{
[Link]($"AutorizationAccount Exception: {[Link]()}");
return [Link];
}
}
}
}

You might also like