Inits the workflow configuration
This commit is contained in:
@ -1,20 +1,17 @@
|
||||
using System.Web;
|
||||
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Services;
|
||||
using Yavsc.ViewModels.Account;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Newtonsoft.Json;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Newtonsoft.Json;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.ViewModels.Account;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Abstract.Manage;
|
||||
using Microsoft.AspNetCore.Identity.UI.Services;
|
||||
using Yavsc.Interface;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
@ -37,7 +34,6 @@ namespace Yavsc.Controllers
|
||||
// TwilioSettings _twilioSettings;
|
||||
|
||||
readonly ApplicationDbContext _dbContext;
|
||||
|
||||
|
||||
public AccountController(
|
||||
UserManager<ApplicationUser> userManager,
|
||||
@ -45,7 +41,7 @@ namespace Yavsc.Controllers
|
||||
ITrueEmailSender emailSender,
|
||||
IOptions<SiteSettings> siteSettings,
|
||||
ILoggerFactory loggerFactory, IOptions<TwilioSettings> twilioSettings,
|
||||
IStringLocalizer<Yavsc.YavscLocalisation> localizer,
|
||||
IStringLocalizer<Yavsc.YavscLocalization> localizer,
|
||||
ApplicationDbContext dbContext)
|
||||
{
|
||||
_userManager = userManager;
|
||||
@ -205,7 +201,7 @@ namespace Yavsc.Controllers
|
||||
return BadRequest();
|
||||
}
|
||||
// Note: this still is not the redirect uri given to the third party provider, at building the challenge.
|
||||
var redirectUrl = Url.Action("ExternalLoginCallback", "Account", new { model.ReturnUrl }, protocol:"https", host: Startup.Authority);
|
||||
var redirectUrl = Url.Action("ExternalLoginCallback", "Account", new { model.ReturnUrl }, protocol:"https", host: Config.Authority);
|
||||
var properties = _signInManager.ConfigureExternalAuthenticationProperties(model.Provider, redirectUrl);
|
||||
// var properties = new AuthenticationProperties{RedirectUri=ReturnUrl};
|
||||
return new ChallengeResult(model.Provider, properties);
|
||||
@ -238,14 +234,14 @@ namespace Yavsc.Controllers
|
||||
if (result.Succeeded)
|
||||
{
|
||||
_logger.LogInformation(3, "User created a new account with password.");
|
||||
await _emailSender.SendEmailAsync(Startup.SiteSetup.Owner.Name, Startup.SiteSetup.Owner.EMail,
|
||||
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}");
|
||||
|
||||
// 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
|
||||
var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);
|
||||
var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code }, protocol: "https", host: Startup.Authority);
|
||||
var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code }, protocol: "https", host: Config.Authority);
|
||||
await _emailSender.SendEmailAsync(model.UserName, model.Email, _localizer["ConfirmYourAccountTitle"],
|
||||
string.Format(_localizer["ConfirmYourAccountBody"], _siteSettings.Title, callbackUrl, _siteSettings.Slogan, _siteSettings.Audience));
|
||||
// No, wait for more than a login pass submission:
|
||||
@ -292,7 +288,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);
|
||||
var callbackUrl = Url.Action("ConfirmEmail", "Account",
|
||||
new { userId = user.Id, code }, protocol: "https", host: Startup.Authority);
|
||||
new { userId = user.Id, code }, protocol: "https", host: Config.Authority);
|
||||
var res = await _emailSender.SendEmailAsync(user.UserName, user.Email,
|
||||
this._localizer["ConfirmYourAccountTitle"],
|
||||
string.Format(this._localizer["ConfirmYourAccountBody"],
|
||||
@ -305,7 +301,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
var code = await _userManager.GenerateTwoFactorTokenAsync(user, provider);
|
||||
var callbackUrl = Url.Action("VerifyCode", "Account",
|
||||
new { userId = user.Id, code, provider }, protocol: "https", host: Startup.Authority);
|
||||
new { userId = user.Id, code, provider }, protocol: "https", host: Config.Authority);
|
||||
var res = await _emailSender.SendEmailAsync(user.UserName, user.Email,
|
||||
this._localizer["AccountEmailFactorTitle"],
|
||||
string.Format(this._localizer["AccountEmailFactorBody"],
|
||||
@ -416,8 +412,8 @@ namespace Yavsc.Controllers
|
||||
var result = await _userManager.CreateAsync(user);
|
||||
if (result.Succeeded)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
// info.ProviderDisplayName = info.Claims.First(c => c.Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name")?.Value;
|
||||
|
||||
info.ProviderDisplayName = info.Principal.Claims.First(c => c.Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name")?.Value;
|
||||
|
||||
result = await _userManager.AddLoginAsync(user, info);
|
||||
if (result.Succeeded)
|
||||
@ -425,7 +421,7 @@ namespace Yavsc.Controllers
|
||||
await _signInManager.SignInAsync(user, isPersistent: false);
|
||||
|
||||
|
||||
await _emailSender.SendEmailAsync(Startup.SiteSetup.Owner.Name, Startup.SiteSetup.Owner.EMail,
|
||||
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}");
|
||||
|
||||
_logger.LogInformation(6, "User created an account using {Name} provider.", info.LoginProvider);
|
||||
|
@ -49,7 +49,7 @@ namespace Yavsc.Controllers
|
||||
IOptions<GoogleAuthSettings> googleSettings,
|
||||
IOptions<PayPalSettings> paypalSettings,
|
||||
IOptions<CompanyInfoSettings> cinfoSettings,
|
||||
IStringLocalizer<Yavsc.YavscLocalisation> SR,
|
||||
IStringLocalizer<Yavsc.YavscLocalization> SR,
|
||||
ICalendarManager calendarManager,
|
||||
ILoggerFactory loggerFactory)
|
||||
{
|
||||
|
@ -102,7 +102,7 @@ namespace Yavsc.Controllers
|
||||
var youAreAdmin = await _userManager.IsInRoleAsync(
|
||||
await _userManager.FindByIdAsync(User.GetUserId()),
|
||||
Constants.AdminGroupName);
|
||||
throw new NotImplementedException();
|
||||
|
||||
var roles = _roleManager.Roles.Select(x => new RoleInfo {
|
||||
Id = x.Id,
|
||||
Name = x.Name
|
||||
@ -110,7 +110,6 @@ namespace Yavsc.Controllers
|
||||
var assembly = GetType().Assembly;
|
||||
ViewBag.ThisAssembly = assembly.FullName;
|
||||
ViewBag.RunTimeVersion = assembly.ImageRuntimeVersion;
|
||||
ViewBag.HostContextFullName = Startup.HostingFullName;
|
||||
return View(new AdminViewModel
|
||||
{
|
||||
Roles = roles.ToArray(),
|
||||
@ -120,7 +119,6 @@ namespace Yavsc.Controllers
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
[Authorize("AdministratorOnly")]
|
||||
public IActionResult Enroll(string roleName)
|
||||
{
|
||||
|
@ -14,11 +14,11 @@ namespace Yavsc.Controllers
|
||||
public class ActivityController : Controller
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
readonly IStringLocalizer<Yavsc.YavscLocalisation> SR;
|
||||
readonly IStringLocalizer<Yavsc.YavscLocalization> SR;
|
||||
readonly ILogger logger;
|
||||
|
||||
public ActivityController(ApplicationDbContext context,
|
||||
IStringLocalizer<Yavsc.YavscLocalisation> SR,
|
||||
IStringLocalizer<Yavsc.YavscLocalization> SR,
|
||||
ILoggerFactory loggerFactory)
|
||||
{
|
||||
_context = context;
|
||||
@ -35,7 +35,7 @@ namespace Yavsc.Controllers
|
||||
|
||||
private void SetSettingClasseInfo(string currentCode = null)
|
||||
{
|
||||
var items = Startup.ProfileTypes.Select(
|
||||
var items = Config.ProfileTypes.Select(
|
||||
pt => new SelectListItem
|
||||
{
|
||||
Text = SR[pt.FullName],
|
||||
|
@ -35,7 +35,7 @@ namespace Yavsc.Controllers
|
||||
IYavscMessageSender messageSender,
|
||||
UserManager<ApplicationUser> userManager,
|
||||
ICalendarManager calendarManager,
|
||||
IStringLocalizer<Yavsc.YavscLocalisation> localizer,
|
||||
IStringLocalizer<Yavsc.YavscLocalization> localizer,
|
||||
ITrueEmailSender emailSender,
|
||||
IOptions<SmtpSettings> smtpSettings,
|
||||
IOptions<SiteSettings> siteSettings,
|
||||
|
@ -49,7 +49,7 @@ namespace Yavsc.Controllers
|
||||
private void SetViewBag(CommandForm commandForm = null)
|
||||
{
|
||||
ViewBag.ActivityCode = new SelectList(_context.Activities, "Code", "Name", commandForm?.ActivityCode);
|
||||
ViewBag.ActionName = Startup.Forms.Select(c => new SelectListItem { Value = c, Text = c, Selected = (commandForm?.ActionName == c) });
|
||||
ViewBag.ActionName = _context.CommandForm.Select(c => new SelectListItem { Value = c.Id.ToString(), Text = c.Title, Selected = commandForm.Id == c.Id });
|
||||
}
|
||||
// POST: CommandForms/Create
|
||||
[HttpPost]
|
||||
|
@ -60,7 +60,7 @@ namespace Yavsc.Controllers
|
||||
}
|
||||
bool hasConfigurableSettings = (userActivity.Does.SettingsClassName != null);
|
||||
var settings = await billing.GetPerformerSettingsAsync(activityCode,id);
|
||||
ViewBag.ProfileType = Startup.ProfileTypes.Single(t=>t.FullName==userActivity.Does.SettingsClassName);
|
||||
ViewBag.ProfileType = Config.ProfileTypes.Single(t=>t.FullName==userActivity.Does.SettingsClassName);
|
||||
|
||||
var gift = new UserActivityViewModel {
|
||||
Declaration = userActivity,
|
||||
|
@ -24,7 +24,7 @@ namespace Yavsc.Controllers
|
||||
UserManager<ApplicationUser> userManager,
|
||||
IBillingService billing,
|
||||
ILoggerFactory loggerFactory,
|
||||
IStringLocalizer<Yavsc.YavscLocalisation> SR)
|
||||
IStringLocalizer<Yavsc.YavscLocalization> SR)
|
||||
{
|
||||
_context = context;
|
||||
_userManager = userManager;
|
||||
@ -92,7 +92,7 @@ namespace Yavsc.Controllers
|
||||
[Authorize, Route("Estimate-{id}.pdf")]
|
||||
public IActionResult EstimatePdf(long id)
|
||||
{
|
||||
ViewBag.TempDir = Startup.SiteSetup.TempDir;
|
||||
ViewBag.TempDir = Config.SiteSetup.TempDir;
|
||||
ViewBag.BillsDir = AbstractFileSystemHelpers.UserBillsDirName;
|
||||
var estimate = _context.Estimates.Include(x => x.Query)
|
||||
.Include(x => x.Query.Client)
|
||||
|
@ -34,7 +34,7 @@ namespace Yavsc.Controllers
|
||||
IOptions<GoogleAuthSettings> googleSettings,
|
||||
IYavscMessageSender GCMSender,
|
||||
UserManager<ApplicationUser> userManager,
|
||||
IStringLocalizer<Yavsc.YavscLocalisation> localizer,
|
||||
IStringLocalizer<Yavsc.YavscLocalization> localizer,
|
||||
ITrueEmailSender emailSender,
|
||||
IOptions<SmtpSettings> smtpSettings,
|
||||
IOptions<SiteSettings> siteSettings,
|
||||
|
@ -33,7 +33,7 @@ namespace Yavsc.Controllers
|
||||
return NotFound();
|
||||
}
|
||||
*/
|
||||
var info = Startup.GitOptions.FileProvider.GetFileInfo(path);
|
||||
var info = Config.GitOptions.FileProvider.GetFileInfo(path);
|
||||
if (!info.Exists)
|
||||
return NotFound();
|
||||
var stream = info.CreateReadStream();
|
||||
|
@ -16,11 +16,11 @@ namespace Yavsc.Controllers
|
||||
public class ProjectController : Controller
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
readonly IStringLocalizer<Yavsc.YavscLocalisation> _localizer;
|
||||
readonly IStringLocalizer<Yavsc.YavscLocalization> _localizer;
|
||||
readonly IStringLocalizer<BugController> _bugLocalizer;
|
||||
|
||||
public ProjectController(ApplicationDbContext context,
|
||||
IStringLocalizer<Yavsc.YavscLocalisation> localizer,
|
||||
IStringLocalizer<Yavsc.YavscLocalization> localizer,
|
||||
IStringLocalizer<BugController> bugLocalizer
|
||||
)
|
||||
{
|
||||
|
Reference in New Issue
Block a user