Now targets NET 4.5, so the solution actually compiles.
Fixed an issue where /user password sets a blank string in the database Fixed an issue where /password <old> <new> wouldn't update the user's password
This commit is contained in:
parent
c918d851b0
commit
e33b6ebebc
4 changed files with 30 additions and 12 deletions
|
|
@ -887,10 +887,18 @@ namespace TShockAPI
|
|||
{
|
||||
string password = args.Parameters[0];
|
||||
if (args.Player.User.VerifyPassword(password))
|
||||
{
|
||||
try
|
||||
{
|
||||
args.Player.SendSuccessMessage("You changed your password!");
|
||||
TShock.Users.SetUserPassword(args.Player.User, args.Parameters[1]); // SetUserPassword will hash it for you.
|
||||
TShock.Log.ConsoleInfo(args.Player.IP + " named " + args.Player.Name + " changed the password of account " + args.Player.User.Name + ".");
|
||||
TShock.Log.ConsoleInfo(args.Player.IP + " named " + args.Player.Name + " changed the password of account " +
|
||||
args.Player.User.Name + ".");
|
||||
}
|
||||
catch (ArgumentOutOfRangeException)
|
||||
{
|
||||
args.Player.SendErrorMessage("Password must be greater than or equal to " + TShock.Config.MinimumPasswordLength + " characters.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1066,6 +1074,10 @@ namespace TShockAPI
|
|||
args.Player.SendErrorMessage("Password change for " + user.Name + " failed! Check console!");
|
||||
TShock.Log.ConsoleError(e.ToString());
|
||||
}
|
||||
catch (ArgumentOutOfRangeException)
|
||||
{
|
||||
args.Player.SendErrorMessage("Password must be greater than or equal to " + TShock.Config.MinimumPasswordLength + " characters.");
|
||||
}
|
||||
}
|
||||
// Group changing requires a username or IP address, and a new group to set
|
||||
else if (subcmd == "group" && args.Parameters.Count == 3)
|
||||
|
|
|
|||
|
|
@ -118,6 +118,8 @@ namespace TShockAPI.DB
|
|||
{
|
||||
try
|
||||
{
|
||||
user.CreateBCryptHash(password);
|
||||
|
||||
if (
|
||||
_database.Query("UPDATE Users SET Password = @0 WHERE Username = @1;", user.Password,
|
||||
user.Name) == 0)
|
||||
|
|
|
|||
2
TShockAPI/Resources.Designer.cs
generated
2
TShockAPI/Resources.Designer.cs
generated
|
|
@ -1,7 +1,7 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.17929
|
||||
// Runtime Version:4.0.30319.34209
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>TShockAPI</RootNamespace>
|
||||
<AssemblyName>TShockAPI</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
|
|
@ -27,6 +27,7 @@
|
|||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
|
|
@ -39,6 +40,7 @@
|
|||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DocumentationFile>bin\Debug\TShockAPI.XML</DocumentationFile>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<!-- <NoWarn>1591</NoWarn> -->
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
|
|
@ -51,6 +53,7 @@
|
|||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DocumentationFile>bin\Release\TShockAPI.XML</DocumentationFile>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="HttpServer">
|
||||
|
|
@ -64,12 +67,13 @@
|
|||
<HintPath>..\prebuilts\MySql.Data.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\prebuilts\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="BCrypt.Net">
|
||||
<HintPath>..\prebuilts\BCrypt.Net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\prebuilts\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Web" />
|
||||
|
|
@ -189,7 +193,7 @@
|
|||
</PropertyGroup>
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<UserProperties BuildVersion_UpdateAssemblyVersion="True" BuildVersion_UpdateFileVersion="True" BuildVersion_BuildAction="Both" BuildVersion_BuildVersioningStyle="None.None.None.MonthAndDayStamp" BuildVersion_StartDate="2011/6/17" BuildVersion_IncrementBeforeBuild="False" />
|
||||
<UserProperties BuildVersion_IncrementBeforeBuild="False" BuildVersion_StartDate="2011/6/17" BuildVersion_BuildVersioningStyle="None.None.None.MonthAndDayStamp" BuildVersion_BuildAction="Both" BuildVersion_UpdateFileVersion="True" BuildVersion_UpdateAssemblyVersion="True" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue