it ipimiutduioi
This commit is contained in:
@@ -12,7 +12,8 @@ using Microsoft.AspNetCore.Authorization;
|
||||
|
||||
#endregion
|
||||
|
||||
[EnableCors("_myAllowSpecificOrigins"), ApiController, Route("api/[controller]")]
|
||||
[EnableCors("_myAllowSpecificOrigins"), ApiController, Route("api/[controller]"),
|
||||
Authorize(AuthenticationSchemes = "Identity.Application")]
|
||||
public class InventoryController : Controller {
|
||||
#region Constants
|
||||
private const int AMOUNT_SCROLL = 5;
|
||||
|
@@ -0,0 +1,34 @@
|
||||
namespace GrossesMitainesAPI.Controllers;
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using GrossesMitainesAPI.Data;
|
||||
using SignInResult = Microsoft.AspNetCore.Identity.SignInResult;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
|
||||
[EnableCors("_myAllowSpecificOrigins"), ApiController, Route("api"),
|
||||
Authorize(AuthenticationSchemes = "Identity.Application")]
|
||||
public class LoginController : Controller {
|
||||
//private readonly UserManager<InventoryUser> _userMan;
|
||||
private readonly SignInManager<InventoryUser> _signInMan;
|
||||
|
||||
public LoginController(SignInManager<InventoryUser> signin) {
|
||||
this._signInMan = signin;
|
||||
}
|
||||
|
||||
public class User {
|
||||
public string username { get; set; }
|
||||
public string password { get; set; }
|
||||
}
|
||||
|
||||
[HttpPost, Route("Login"), AllowAnonymous]
|
||||
public async Task<SignInResult> Login(User user, bool rememberMe = false) {
|
||||
return await _signInMan.PasswordSignInAsync(user.username, user.password, rememberMe, false);
|
||||
}
|
||||
|
||||
[HttpPost, Route("Logout")]
|
||||
public void Logout() { _signInMan.SignOutAsync(); }
|
||||
}
|
||||
|
@@ -20,7 +20,8 @@ using GrossesMitainesAPI.Services;
|
||||
/// qui sera effectuée dans les 10 secondes après
|
||||
/// l'éxécution d'une modification de la BD.
|
||||
/// </summary>
|
||||
[EnableCors("_myAllowSpecificOrigins"), ApiController, Route("api/[controller]")]
|
||||
[EnableCors("_myAllowSpecificOrigins"), ApiController, Route("api/[controller]"),
|
||||
Authorize(AuthenticationSchemes = "Identity.Application")]
|
||||
public class ProductController : ControllerBase {
|
||||
#region DI Fields
|
||||
private readonly ILogger<ProductController> _logger;
|
||||
|
@@ -13,7 +13,8 @@ using System.Collections.Immutable;
|
||||
|
||||
#endregion
|
||||
|
||||
[EnableCors("_myAllowSpecificOrigins"), ApiController, Route("api/[controller]")]
|
||||
[EnableCors("_myAllowSpecificOrigins"), ApiController, Route("api/[controller]"),
|
||||
Authorize(AuthenticationSchemes = "Identity.Application")]
|
||||
public class SearchController : Controller {
|
||||
#region Constants
|
||||
private const int PREVIEW = 4;
|
||||
@@ -109,11 +110,11 @@ public class SearchController : Controller {
|
||||
sDesc = prod.Description.Replace(".", " ").Replace(",", " ").ToLower() + " ";
|
||||
if (sTitle.StartsWith(query))
|
||||
products.Add(prod);
|
||||
else if (sTitle.Contains(" " + query + " "))
|
||||
else if (sTitle.Contains(" " + query))
|
||||
title.Add(prod);
|
||||
else if (sDesc.Contains(" " + query + " "))
|
||||
else if (sDesc.Contains(" " + query))
|
||||
desc.Add(prod);
|
||||
else if (sCat.Contains(" " + query + " "))
|
||||
else if (sCat.Contains(" " + query))
|
||||
cat.Add(prod);
|
||||
}
|
||||
products.AddRange(title);
|
||||
|
Reference in New Issue
Block a user