mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-07 21:58:06 -05:00
less warns when using a disposed socket topstats added to tokens as {{TOPSTATS}} fixed topstats reporting for only a single server added fix to iw4 regex for negative score tokens now support multiple lines (using Environment.NewLine to separate) localization includes culture again
38 lines
1.3 KiB
C#
38 lines
1.3 KiB
C#
using SharedLibraryCore;
|
|
using SharedLibraryCore.Objects;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace IW4MAdmin.Plugins.Login.Commands
|
|
{
|
|
public class CLogin : Command
|
|
{
|
|
public CLogin() : base("login", Utilities.CurrentLocalization.LocalizationIndex["PLUGINS_LOGIN_COMMANDS_LOGIN_DESC"], "li", Player.Permission.Trusted, false, new CommandArgument[]
|
|
{
|
|
new CommandArgument()
|
|
{
|
|
Name = "password",
|
|
Required = true
|
|
}
|
|
}){ }
|
|
|
|
public override async Task ExecuteAsync(GameEvent E)
|
|
{
|
|
var client = E.Owner.Manager.GetPrivilegedClients()[E.Origin.ClientId];
|
|
string[] hashedPassword = await Task.FromResult(SharedLibraryCore.Helpers.Hashing.Hash(E.Data, client.PasswordSalt));
|
|
|
|
if (hashedPassword[0] == client.Password)
|
|
{
|
|
Plugin.AuthorizedClients[E.Origin.ClientId] = true;
|
|
await E.Origin.Tell(Utilities.CurrentLocalization.LocalizationIndex["PLUGINS_LOGIN_COMMANDS_LOGIN_SUCCESS"]);
|
|
}
|
|
|
|
else
|
|
{
|
|
await E.Origin.Tell(Utilities.CurrentLocalization.LocalizationIndex["PLUGINS_LOGIN_COMMANDS_LOGIN_FAIL"]);
|
|
}
|
|
}
|
|
}
|
|
}
|