Applied correct database query casing (#190)
This commit is contained in:
@@ -333,7 +333,7 @@ namespace Authentication
|
|||||||
|
|
||||||
private SecurityProfileViewModel GetSecurityProfile(TUser user)
|
private SecurityProfileViewModel GetSecurityProfile(TUser user)
|
||||||
{
|
{
|
||||||
string sql = "SELECT SecurityProfile FROM users WHERE Id=@Id;";
|
string sql = "SELECT SecurityProfile FROM Users WHERE Id=@Id;";
|
||||||
Dictionary<string, object> dbDict = new Dictionary<string, object>();
|
Dictionary<string, object> dbDict = new Dictionary<string, object>();
|
||||||
dbDict.Add("Id", user.Id);
|
dbDict.Add("Id", user.Id);
|
||||||
|
|
||||||
@@ -360,7 +360,7 @@ namespace Authentication
|
|||||||
|
|
||||||
private int SetSecurityProfile(TUser user, SecurityProfileViewModel securityProfile)
|
private int SetSecurityProfile(TUser user, SecurityProfileViewModel securityProfile)
|
||||||
{
|
{
|
||||||
string commandText = "UPDATE users SET SecurityProfile=@SecurityProfile WHERE Id=@Id;";
|
string commandText = "UPDATE Users SET SecurityProfile=@SecurityProfile WHERE Id=@Id;";
|
||||||
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
||||||
parameters.Add("Id", user.Id);
|
parameters.Add("Id", user.Id);
|
||||||
parameters.Add("SecurityProfile", Newtonsoft.Json.JsonConvert.SerializeObject(securityProfile));
|
parameters.Add("SecurityProfile", Newtonsoft.Json.JsonConvert.SerializeObject(securityProfile));
|
||||||
|
@@ -67,7 +67,7 @@ namespace gaseous_server.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NotFound();
|
return Problem(ModelState.ToString());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -222,6 +222,9 @@ builder.Services.ConfigureApplicationCookie(options =>
|
|||||||
options.Cookie.Name = "Gaseous.Identity";
|
options.Cookie.Name = "Gaseous.Identity";
|
||||||
options.ExpireTimeSpan = TimeSpan.FromDays(90);
|
options.ExpireTimeSpan = TimeSpan.FromDays(90);
|
||||||
options.SlidingExpiration = true;
|
options.SlidingExpiration = true;
|
||||||
|
options.Cookie.HttpOnly = true;
|
||||||
|
options.Cookie.SecurePolicy = CookieSecurePolicy.SameAsRequest;
|
||||||
|
options.Cookie.SameSite = SameSiteMode.Strict;
|
||||||
});
|
});
|
||||||
// builder.Services.AddIdentityCore<ApplicationUser>(options => {
|
// builder.Services.AddIdentityCore<ApplicationUser>(options => {
|
||||||
// options.SignIn.RequireConfirmedAccount = false;
|
// options.SignIn.RequireConfirmedAccount = false;
|
||||||
@@ -285,26 +288,26 @@ using (var scope = app.Services.CreateScope())
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// set up administrator account
|
// // set up administrator account
|
||||||
var userManager = scope.ServiceProvider.GetRequiredService<UserStore>();
|
// var userManager = scope.ServiceProvider.GetRequiredService<UserStore>();
|
||||||
if (await userManager.FindByNameAsync("admin@localhost", CancellationToken.None) == null)
|
// if (await userManager.FindByNameAsync("admin@localhost", CancellationToken.None) == null)
|
||||||
{
|
// {
|
||||||
ApplicationUser adminUser = new ApplicationUser{
|
// ApplicationUser adminUser = new ApplicationUser{
|
||||||
Id = Guid.NewGuid().ToString(),
|
// Id = Guid.NewGuid().ToString(),
|
||||||
Email = "admin@localhost",
|
// Email = "admin@localhost",
|
||||||
NormalizedEmail = "ADMIN@LOCALHOST",
|
// NormalizedEmail = "ADMIN@LOCALHOST",
|
||||||
EmailConfirmed = true,
|
// EmailConfirmed = true,
|
||||||
UserName = "administrator",
|
// UserName = "administrator",
|
||||||
NormalizedUserName = "ADMINISTRATOR"
|
// NormalizedUserName = "ADMINISTRATOR"
|
||||||
};
|
// };
|
||||||
|
|
||||||
//set user password
|
// //set user password
|
||||||
PasswordHasher<ApplicationUser> ph = new PasswordHasher<ApplicationUser>();
|
// PasswordHasher<ApplicationUser> ph = new PasswordHasher<ApplicationUser>();
|
||||||
adminUser.PasswordHash = ph.HashPassword(adminUser, "letmein");
|
// adminUser.PasswordHash = ph.HashPassword(adminUser, "letmein");
|
||||||
|
|
||||||
await userManager.CreateAsync(adminUser, CancellationToken.None);
|
// await userManager.CreateAsync(adminUser, CancellationToken.None);
|
||||||
await userManager.AddToRoleAsync(adminUser, "Admin", CancellationToken.None);
|
// await userManager.AddToRoleAsync(adminUser, "Admin", CancellationToken.None);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
|
@@ -10,6 +10,13 @@ CREATE TABLE `GameLibraries` (
|
|||||||
ALTER TABLE `Games_Roms`
|
ALTER TABLE `Games_Roms`
|
||||||
ADD COLUMN `LibraryId` INT NULL DEFAULT 0 AFTER `MetadataVersion`;
|
ADD COLUMN `LibraryId` INT NULL DEFAULT 0 AFTER `MetadataVersion`;
|
||||||
|
|
||||||
|
CREATE TABLE `Relation_Game_AgeRatings` (
|
||||||
|
`GameId` BIGINT NOT NULL,
|
||||||
|
`AgeRatingsId` BIGINT NOT NULL,
|
||||||
|
PRIMARY KEY (`GameId`, `AgeRatingsId`),
|
||||||
|
INDEX `idx_PrimaryColumn` (`GameId` ASC) VISIBLE
|
||||||
|
);
|
||||||
|
|
||||||
CREATE TABLE `Relation_Game_Genres` (
|
CREATE TABLE `Relation_Game_Genres` (
|
||||||
`GameId` BIGINT NOT NULL,
|
`GameId` BIGINT NOT NULL,
|
||||||
`GenresId` BIGINT NOT NULL,
|
`GenresId` BIGINT NOT NULL,
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
CREATE TABLE `roles` (
|
CREATE TABLE `Roles` (
|
||||||
`Id` varchar(128) NOT NULL,
|
`Id` varchar(128) NOT NULL,
|
||||||
`Name` varchar(256) NOT NULL,
|
`Name` varchar(256) NOT NULL,
|
||||||
PRIMARY KEY (`Id`)
|
PRIMARY KEY (`Id`)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE `users` (
|
CREATE TABLE `Users` (
|
||||||
`Id` varchar(128) NOT NULL,
|
`Id` varchar(128) NOT NULL,
|
||||||
`Email` varchar(256) DEFAULT NULL,
|
`Email` varchar(256) DEFAULT NULL,
|
||||||
`EmailConfirmed` tinyint(1) NOT NULL,
|
`EmailConfirmed` tinyint(1) NOT NULL,
|
||||||
@@ -24,7 +24,7 @@ CREATE TABLE `users` (
|
|||||||
PRIMARY KEY (`Id`)
|
PRIMARY KEY (`Id`)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE `userclaims` (
|
CREATE TABLE `UserClaims` (
|
||||||
`Id` int(11) NOT NULL AUTO_INCREMENT,
|
`Id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`UserId` varchar(128) NOT NULL,
|
`UserId` varchar(128) NOT NULL,
|
||||||
`ClaimType` longtext,
|
`ClaimType` longtext,
|
||||||
@@ -32,23 +32,23 @@ CREATE TABLE `userclaims` (
|
|||||||
PRIMARY KEY (`Id`),
|
PRIMARY KEY (`Id`),
|
||||||
UNIQUE KEY `Id` (`Id`),
|
UNIQUE KEY `Id` (`Id`),
|
||||||
KEY `UserId` (`UserId`),
|
KEY `UserId` (`UserId`),
|
||||||
CONSTRAINT `ApplicationUser_Claims` FOREIGN KEY (`UserId`) REFERENCES `users` (`Id`) ON DELETE CASCADE ON UPDATE NO ACTION
|
CONSTRAINT `ApplicationUser_Claims` FOREIGN KEY (`UserId`) REFERENCES `Users` (`Id`) ON DELETE CASCADE ON UPDATE NO ACTION
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE `userlogins` (
|
CREATE TABLE `UserLogins` (
|
||||||
`LoginProvider` varchar(128) NOT NULL,
|
`LoginProvider` varchar(128) NOT NULL,
|
||||||
`ProviderKey` varchar(128) NOT NULL,
|
`ProviderKey` varchar(128) NOT NULL,
|
||||||
`UserId` varchar(128) NOT NULL,
|
`UserId` varchar(128) NOT NULL,
|
||||||
PRIMARY KEY (`LoginProvider`,`ProviderKey`,`UserId`),
|
PRIMARY KEY (`LoginProvider`,`ProviderKey`,`UserId`),
|
||||||
KEY `ApplicationUser_Logins` (`UserId`),
|
KEY `ApplicationUser_Logins` (`UserId`),
|
||||||
CONSTRAINT `ApplicationUser_Logins` FOREIGN KEY (`UserId`) REFERENCES `users` (`Id`) ON DELETE CASCADE ON UPDATE NO ACTION
|
CONSTRAINT `ApplicationUser_Logins` FOREIGN KEY (`UserId`) REFERENCES `Users` (`Id`) ON DELETE CASCADE ON UPDATE NO ACTION
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE `userroles` (
|
CREATE TABLE `UserRoles` (
|
||||||
`UserId` varchar(128) NOT NULL,
|
`UserId` varchar(128) NOT NULL,
|
||||||
`RoleId` varchar(128) NOT NULL,
|
`RoleId` varchar(128) NOT NULL,
|
||||||
PRIMARY KEY (`UserId`,`RoleId`),
|
PRIMARY KEY (`UserId`,`RoleId`),
|
||||||
KEY `IdentityRole_Users` (`RoleId`),
|
KEY `IdentityRole_Users` (`RoleId`),
|
||||||
CONSTRAINT `ApplicationUser_Roles` FOREIGN KEY (`UserId`) REFERENCES `users` (`Id`) ON DELETE CASCADE ON UPDATE NO ACTION,
|
CONSTRAINT `ApplicationUser_Roles` FOREIGN KEY (`UserId`) REFERENCES `Users` (`Id`) ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||||
CONSTRAINT `IdentityRole_Users` FOREIGN KEY (`RoleId`) REFERENCES `roles` (`Id`) ON DELETE CASCADE ON UPDATE NO ACTION
|
CONSTRAINT `IdentityRole_Users` FOREIGN KEY (`RoleId`) REFERENCES `Roles` (`Id`) ON DELETE CASCADE ON UPDATE NO ACTION
|
||||||
) ;
|
) ;
|
||||||
|
Reference in New Issue
Block a user