refacto site settings
Some checks failed
Dotnet build and test / build (pull_request) Failing after 8m29s
Some checks failed
Dotnet build and test / build (pull_request) Failing after 8m29s
This commit is contained in:
parent
3e7e76edf2
commit
3bc4142383
33 changed files with 399 additions and 315 deletions
|
|
@ -490,14 +490,17 @@ IHtmlLocalizerFactory htmlLocalizerFactory,
|
|||
if (result.Succeeded)
|
||||
{
|
||||
_logger.LogInformation(3, "User created a new account with password.");
|
||||
await _emailSender.SendEmailAsync(Config.SiteSetup.Owner.Name, Config.SiteSetup.Owner.EMail,
|
||||
$"[{_siteSettings.Title}] Inscription avec mot de passe: {user.UserName} ", $"{user.Id}/{user.UserName}/{user.Email}");
|
||||
await _emailSender.SendEmailAsync(
|
||||
_siteSettings.Owner.Name,
|
||||
_siteSettings.Owner.EMail,
|
||||
$"[{_siteSettings.Title}] Inscription avec mot de passe: {user.UserName} ",
|
||||
$"{user.Id}/{user.UserName}/{user.Email}");
|
||||
|
||||
// TODO user.DiskQuota = Startup.SiteSetup.UserFiles.Quota;
|
||||
// For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=532713
|
||||
// Send an email with this link
|
||||
|
||||
Uri authority = new Uri(Config.Authority);
|
||||
Uri authority = new Uri(_siteSettings.Authority);
|
||||
|
||||
var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);
|
||||
var callbackUrl = Url.Action("ConfirmEmail", "Account",
|
||||
|
|
@ -703,10 +706,15 @@ IHtmlLocalizerFactory htmlLocalizerFactory,
|
|||
await _signInManager.SignInAsync(user, isPersistent: false);
|
||||
|
||||
|
||||
await _emailSender.SendEmailAsync(Config.SiteSetup.Owner.Name, Config.SiteSetup.Owner.EMail,
|
||||
$"[{_siteSettings.Title}] Inscription via {info.LoginProvider}: {user.UserName} ", $"{user.Id}/{user.UserName}/{user.Email}");
|
||||
await _emailSender.SendEmailAsync(
|
||||
_siteSettings.Owner.Name,
|
||||
_siteSettings.Owner.EMail,
|
||||
$"[{_siteSettings.Title}] Inscription via {info.LoginProvider}: {user.UserName} ",
|
||||
$"{user.Id}/{user.UserName}/{user.Email}");
|
||||
|
||||
_logger.LogInformation(6, "User created an account using {Name} provider.", info.LoginProvider);
|
||||
_logger.LogInformation(6,
|
||||
"User created an account using {Name} provider.",
|
||||
info.LoginProvider);
|
||||
|
||||
return Redirect(returnUrl);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,8 +109,9 @@ namespace Yavsc.Org.Controllers
|
|||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
Models.Blog.BlogPost post = blogSpotService.Create(User.GetUserId(),
|
||||
blogInput, Request.Form.Files);
|
||||
var uid = User.GetUserId();
|
||||
Models.Blog.BlogPost post = blogSpotService.Create(uid, blogInput);
|
||||
blogSpotService.AttachFiles(Request.Form.Files, uid, post.Id);
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
return View("Edit", blogInput);
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ namespace Yavsc.Controllers
|
|||
using Helpers;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Models;
|
||||
using ViewModels.FrontOffice;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
|
@ -20,18 +21,21 @@ namespace Yavsc.Controllers
|
|||
readonly ILogger _logger;
|
||||
readonly IStringLocalizer _SR;
|
||||
private readonly IBillingService _billing;
|
||||
private readonly SiteSettings _siteSettings;
|
||||
|
||||
public FrontOfficeController(ApplicationDbContext context,
|
||||
UserManager<ApplicationUser> userManager,
|
||||
IBillingService billing,
|
||||
ILoggerFactory loggerFactory,
|
||||
IStringLocalizer<FrontOfficeController> SR)
|
||||
IStringLocalizer<FrontOfficeController> SR,
|
||||
IOptions<SiteSettings> siteSettings)
|
||||
{
|
||||
_context = context;
|
||||
_userManager = userManager;
|
||||
_logger = loggerFactory.CreateLogger<FrontOfficeController>();
|
||||
_SR = SR;
|
||||
_billing = billing;
|
||||
_siteSettings = siteSettings.Value;
|
||||
}
|
||||
public ActionResult Index()
|
||||
{
|
||||
|
|
@ -95,8 +99,8 @@ namespace Yavsc.Controllers
|
|||
[HttpGet]
|
||||
public IActionResult EstimatePdf(long id)
|
||||
{
|
||||
ViewBag.TempDir = Config.SiteSetup.TempDir;
|
||||
ViewBag.BillsDir = AbstractFileSystemHelpers.UserBillsDirName;
|
||||
ViewBag.TempDir = _siteSettings.TempDir;
|
||||
ViewBag.BillsDir = _siteSettings.Bills;
|
||||
var estimate = _context.Estimates.Include(x => x.Query)
|
||||
.Include(x => x.Query.Client)
|
||||
.Include(x => x.Query.PerformerProfile)
|
||||
|
|
|
|||
|
|
@ -1,20 +1,25 @@
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
namespace Yavsc.Org.Controllers
|
||||
{
|
||||
public class FileSystemController : Controller
|
||||
{
|
||||
public FileSystemController()
|
||||
private SiteSettings _siteSettings;
|
||||
|
||||
public FileSystemController(IOptions<SiteSettings> siteSettings)
|
||||
{
|
||||
_siteSettings = siteSettings.Value;
|
||||
}
|
||||
// Removed redundant empty constructor block
|
||||
|
||||
public IActionResult Index(string subdir="")
|
||||
{
|
||||
{
|
||||
if (subdir !=null)
|
||||
if (!subdir.IsValidYavscPath())
|
||||
return new BadRequestResult();
|
||||
var files = AbstractFileSystemHelpers.GetUserFiles(User.GetUserId(), subdir);
|
||||
var files = FileSystemHelpers.GetUserFiles(_siteSettings, User.GetUserId(), subdir);
|
||||
return View(files);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue