Hooked up most of #49 Just the validation messages need to be done.

***NOTE: Due to we are now hashing the passwords and reading from a new table, We will need to create a new administrator account.***
This commit is contained in:
tidusjar 2016-03-22 10:46:24 +00:00
commit 8f7098d048
13 changed files with 250 additions and 21 deletions

View file

@ -70,6 +70,8 @@
<Compile Include="Repository\RequestJsonRepository.cs" />
<Compile Include="GenericRepository.cs" />
<Compile Include="RequestedModel.cs" />
<Compile Include="UserEntity.cs" />
<Compile Include="UsersModel.cs" />
<Compile Include="UserRepository.cs" />
<Compile Include="Sql.Designer.cs">
<AutoGen>True</AutoGen>
@ -77,7 +79,6 @@
<DependentUpon>Sql.resx</DependentUpon>
</Compile>
<Compile Include="TableCreation.cs" />
<Compile Include="UserModel.cs" />
</ItemGroup>
<ItemGroup>
<None Include="sqlite3.dll">

View file

@ -1,11 +1,12 @@
--Any DB changes need to be made in this file.
CREATE TABLE IF NOT EXISTS User
CREATE TABLE IF NOT EXISTS Users
(
Id INTEGER PRIMARY KEY AUTOINCREMENT,
User varchar(50) NOT NULL ,
UserGuid varchar(50) NOT NULL ,
UserName varchar(50) NOT NULL,
Password varchar(100) NOT NULL
Salt BLOB NOT NULL,
Hash BLOB NOT NULL
);

View file

@ -1,7 +1,7 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: UserModel.cs
// File: UserEntity.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
@ -28,11 +28,11 @@ using Dapper.Contrib.Extensions;
namespace PlexRequests.Store
{
[Table("User")]
public class UserModel : Entity
public class UserEntity
{
[Key]
public int Id { get; set; }
public string User { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
}
}
}

View file

@ -32,7 +32,7 @@ using Dapper.Contrib.Extensions;
namespace PlexRequests.Store
{
public class UserRepository<T> : IRepository<T> where T : UserModel
public class UserRepository<T> : IRepository<T> where T : UserEntity
{
public UserRepository(ISqliteConfiguration config)
{

View file

@ -0,0 +1,37 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: UserModel.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using Dapper.Contrib.Extensions;
namespace PlexRequests.Store
{
[Table("Users")]
public class UsersModel : UserEntity
{
public byte[] Hash { get; set; }
public byte[] Salt { get; set; }
}
}