Fixed an issue where the table didn't match the model.

Fixed #67
pull/83/head
tidusjar 9 years ago
parent c4f57169ad
commit 59cf379d56

@ -73,7 +73,7 @@ namespace PlexRequests.Core
var passwordMatch = PasswordHasher.VerifyPassword(password, u.Salt, u.Hash); var passwordMatch = PasswordHasher.VerifyPassword(password, u.Salt, u.Hash);
if (passwordMatch) if (passwordMatch)
{ {
return new Guid(u.User); return new Guid(u.UserGuid);
} }
} }
} }
@ -93,12 +93,12 @@ namespace PlexRequests.Core
var repo = new UserRepository<UsersModel>(Db); var repo = new UserRepository<UsersModel>(Db);
var salt = PasswordHasher.GenerateSalt(); var salt = PasswordHasher.GenerateSalt();
var userModel = new UsersModel { UserName = username, User = Guid.NewGuid().ToString(), Salt = salt, Hash = PasswordHasher.ComputeHash(password, salt)}; var userModel = new UsersModel { UserName = username, UserGuid = Guid.NewGuid().ToString(), Salt = salt, Hash = PasswordHasher.ComputeHash(password, salt)};
repo.Insert(userModel); repo.Insert(userModel);
var userRecord = repo.Get(userModel.User); var userRecord = repo.Get(userModel.UserGuid);
return new Guid(userRecord.User); return new Guid(userRecord.UserGuid);
} }
public static bool UpdateUser(string username, string oldPassword, string newPassword) public static bool UpdateUser(string username, string oldPassword, string newPassword)

@ -32,7 +32,8 @@ namespace PlexRequests.Store
{ {
[Key] [Key]
public int Id { get; set; } public int Id { get; set; }
public string User { get; set; }
public string UserName { get; set; } public string UserName { get; set; }
public string UserGuid { get; set; }
} }
} }

@ -39,7 +39,7 @@ namespace PlexRequests.Store
Config = config; Config = config;
} }
private ISqliteConfiguration Config { get; set; } private ISqliteConfiguration Config { get; }
public long Insert(T entity) public long Insert(T entity)
{ {
using (var cnn = Config.DbConnection()) using (var cnn = Config.DbConnection())
@ -65,7 +65,7 @@ namespace PlexRequests.Store
{ {
db.Open(); db.Open();
var result = db.GetAll<T>(); var result = db.GetAll<T>();
var selected = result.FirstOrDefault(x => x.User == id); var selected = result.FirstOrDefault(x => x.UserGuid == id);
return selected; return selected;
} }
} }

@ -337,7 +337,8 @@ function buildRequestContext(result, type) {
issues: result.issues, issues: result.issues,
otherMessage: result.otherMessage, otherMessage: result.otherMessage,
requestId: result.id, requestId: result.id,
adminNote: result.adminNotes adminNote: result.adminNotes,
imdb: result.imdbId
}; };
return context; return context;

@ -139,7 +139,8 @@ function buildMovieContext(result) {
voteCount: result.voteCount, voteCount: result.voteCount,
voteAverage: result.voteAverage, voteAverage: result.voteAverage,
year: year, year: year,
type: "movie" type: "movie",
imdb: result.imdbId
}; };
return context; return context;
@ -154,7 +155,8 @@ function buildTvShowContext(result) {
title: result.seriesName, title: result.seriesName,
overview: result.overview, overview: result.overview,
year: year, year: year,
type: "tv" type: "tv",
imdb: result.imdbId
}; };
return context; return context;
} }

@ -94,7 +94,7 @@
</div> </div>
<div class="col-sm-5 "> <div class="col-sm-5 ">
<div> <div>
<a href="https://www.themoviedb.org/{{type}}/{{id}}"> <a href="http://www.imdb.com/title/{{imdb}}/" targe="_blank">
<h4 class="request-title">{{title}} ({{year}})</h4> <h4 class="request-title">{{title}} ({{year}})</h4>
</a> </a>
<span class="label label-success">{{status}}</span> <span class="label label-success">{{status}}</span>

@ -76,7 +76,7 @@
</div> </div>
<div class="col-sm-5 "> <div class="col-sm-5 ">
<div> <div>
<a href="https://www.themoviedb.org/{{type}}/{{id}}"> <a href="http://www.imdb.com/title/{{imdb}}/" targe="_blank">
<h4>{{title}} ({{year}})</h4> <h4>{{title}} ({{year}})</h4>
</a> </a>
</div> </div>

Loading…
Cancel
Save