Added UserExtensions
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
<appSettings>
|
||||
<add key="market_data" value="Database=market_data;Datasource=localhost;Username=root;Password=dbas"/>
|
||||
<add key="portfolio_data" value="Database=portfolio_data;Datasource=localhost;Username=root;Password=dbas"/>
|
||||
<add key="user_data" value="Database=user_data;Datasource=localhost;Username=root;Password=dbas"/>
|
||||
<add key="sms_smtpaddress" value="smtp.gmail.com"/>
|
||||
<add key="sms_smsusername" value="skessler1964@gmail.com"/>
|
||||
<add key="sms_smspassword" value="xjfo isnf gmyi zovr"/>
|
||||
|
||||
17
MarketDataLib/Extensions/UserExtensions.cs
Normal file
17
MarketDataLib/Extensions/UserExtensions.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using MarketData.MarketDataModel.User;
|
||||
using MarketData.Security;
|
||||
|
||||
namespace MarketData.Extensions
|
||||
{
|
||||
public static class UserExtensions
|
||||
{
|
||||
public static bool Verify(this User user, string password)
|
||||
{
|
||||
if(null == user || null == user.Username || null == user.Salt || null==user.Hash)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return Encryption.VerifyPassword(password, user.Salt, user.Hash);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -111,6 +111,7 @@
|
||||
<Compile Include="DataAccess\PremarketDA.cs" />
|
||||
<Compile Include="DataAccess\SECFilingDA.cs" />
|
||||
<Compile Include="DataAccess\SplitsDA.cs" />
|
||||
<Compile Include="DataAccess\UserDA.cs" />
|
||||
<Compile Include="DataAccess\ValuationDA.cs" />
|
||||
<Compile Include="DataAccess\WatchListDA.cs" />
|
||||
<Compile Include="DataAccess\YieldCurveDA.cs" />
|
||||
@@ -119,6 +120,7 @@
|
||||
<Compile Include="DividendRiskParity\DividendRiskParityPosition.cs" />
|
||||
<Compile Include="DividendRiskParity\DividendRiskParityResult.cs" />
|
||||
<Compile Include="DividendRiskParity\EquilibriumGenerator.cs" />
|
||||
<Compile Include="Extensions\UserExtensions.cs" />
|
||||
<Compile Include="Generator\AcquirersMultipleGenerator.cs" />
|
||||
<Compile Include="Generator\CMMomentum\CMActivePositions.cs" />
|
||||
<Compile Include="Generator\CMMomentum\CMBacktest.cs" />
|
||||
@@ -264,6 +266,7 @@
|
||||
<Compile Include="MarketDataModel\PricesByDate.cs" />
|
||||
<Compile Include="MarketDataModel\SharpeRatioModel.cs" />
|
||||
<Compile Include="MarketDataModel\StopLimit.cs" />
|
||||
<Compile Include="MarketDataModel\User\User.cs" />
|
||||
<Compile Include="Numerics\LeastSquares.cs" />
|
||||
<Compile Include="Numerics\SharpeRatioGenerator.cs" />
|
||||
<Compile Include="Security\Encryption.cs" />
|
||||
|
||||
28
Program.cs
28
Program.cs
@@ -25,6 +25,8 @@ using System.Data;
|
||||
using MarketData.Generator.MovingAverage;
|
||||
using MarketData.Generator.MGSHMomentum;
|
||||
using MarketData.Security;
|
||||
using MarketData.MarketDataModel.User;
|
||||
using MarketData.Extensions;
|
||||
|
||||
namespace MarketData
|
||||
{
|
||||
@@ -989,11 +991,27 @@ namespace MarketData
|
||||
Trace.Listeners.Add(new TextWriterTraceListener(strLogFile));
|
||||
DateTime currentDate=DateTime.Now;
|
||||
|
||||
//String salt= default;
|
||||
//String hash = default;
|
||||
|
||||
// (String salt, String hash)= Encryption.HashPasswordWithSalt("MN5191306");
|
||||
// bool result = Encryption.VerifyPassword("MN5191306", salt, hash);
|
||||
|
||||
//User user = UserDA.GetUser("sean");
|
||||
|
||||
//if(!user.Verify("MN5191306"))
|
||||
//{
|
||||
// MDTrace.WriteLine(LogLevel.DEBUG,$"User {user.Username} was not verified");
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// MDTrace.WriteLine(LogLevel.DEBUG,$"User {user.Username} was verified");
|
||||
//}
|
||||
|
||||
//(String salt, String hash) = Encryption.HashPasswordWithSalt("MN5191306");
|
||||
//bool result = Encryption.VerifyPassword("MN5191306", salt, hash);
|
||||
|
||||
//User user = new User();
|
||||
//user.Username="Sean";
|
||||
//user.Salt=salt;
|
||||
//user.Hash=hash;
|
||||
|
||||
//UserDA.AddUser(user);
|
||||
|
||||
|
||||
DateTime maxHolidayDate =HolidayDA.GetMaxHolidayDate();
|
||||
|
||||
Reference in New Issue
Block a user