still refactoring
This commit is contained in:
parent
149583ffb3
commit
6e6aca44f0
36 changed files with 303 additions and 324 deletions
|
|
@ -130,7 +130,7 @@ namespace Yavsc.ApiControllers
|
|||
var regids = estimate.Client.Devices.Select(d => d.GCMRegistrationId).ToArray();
|
||||
bool gcmSent = false;
|
||||
if (regids.Length>0) {
|
||||
var grep = await _GCMSender.NotifyEstimateAsync(_googleSettings,regids,yaev);
|
||||
var grep = await _GCMSender.NotifyEstimateAsync(regids,yaev);
|
||||
gcmSent = grep.success>0;
|
||||
}
|
||||
return Ok (new { ProviderValidationDate = estimate.ProviderValidationDate, GCMSent = gcmSent });
|
||||
|
|
@ -187,4 +187,4 @@ namespace Yavsc.ApiControllers
|
|||
return File(fi.OpenRead(), "application/x-pdf", filename); ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ namespace Yavsc.Controllers
|
|||
// private readonly ISmsSender _smsSender;
|
||||
private readonly ILogger _logger;
|
||||
SiteSettings _siteSettings;
|
||||
SmtpSettings _smtpSettings;
|
||||
TwilioSettings _twilioSettings;
|
||||
|
||||
IStringLocalizer _localizer;
|
||||
|
|
@ -43,8 +42,7 @@ namespace Yavsc.Controllers
|
|||
UserManager<ApplicationUser> userManager,
|
||||
SignInManager<ApplicationUser> signInManager,
|
||||
IEmailSender emailSender,
|
||||
IOptions<SiteSettings> siteSettings,
|
||||
IOptions<SmtpSettings> smtpSettings,
|
||||
IOptions<SiteSettings> siteSettings,
|
||||
ILoggerFactory loggerFactory, IOptions<TwilioSettings> twilioSettings,
|
||||
IStringLocalizer<Yavsc.Resources.YavscLocalisation> localizer,
|
||||
ApplicationDbContext dbContext)
|
||||
|
|
@ -55,7 +53,6 @@ namespace Yavsc.Controllers
|
|||
// _userManager.RegisterTokenProvider("Phone", new UserTokenProvider());
|
||||
_emailSender = emailSender;
|
||||
_siteSettings = siteSettings.Value;
|
||||
_smtpSettings = smtpSettings.Value;
|
||||
_twilioSettings = twilioSettings.Value;
|
||||
_logger = loggerFactory.CreateLogger<AccountController>();
|
||||
_localizer = localizer;
|
||||
|
|
@ -212,7 +209,7 @@ namespace Yavsc.Controllers
|
|||
if (result.Succeeded)
|
||||
{
|
||||
_logger.LogInformation(3, "User created a new account with password.");
|
||||
await _emailSender.SendEmailAsync(_siteSettings, _smtpSettings, Startup.SiteSetup.Owner.Name, Startup.SiteSetup.Owner.EMail,
|
||||
await _emailSender.SendEmailAsync(Startup.SiteSetup.Owner.Name, Startup.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;
|
||||
|
|
@ -220,7 +217,7 @@ namespace Yavsc.Controllers
|
|||
// Send an email with this link
|
||||
var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);
|
||||
var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: HttpContext.Request.Scheme);
|
||||
var emailSent = await _emailSender.SendEmailAsync(_siteSettings, _smtpSettings, model.UserName, model.Email, _localizer["ConfirmYourAccountTitle"],
|
||||
var emailSent = await _emailSender.SendEmailAsync(model.UserName, model.Email, _localizer["ConfirmYourAccountTitle"],
|
||||
string.Format(_localizer["ConfirmYourAccountBody"], _siteSettings.Title, callbackUrl, _siteSettings.Slogan, _siteSettings.Audience));
|
||||
await _signInManager.SignInAsync(user, isPersistent: false);
|
||||
if (!emailSent)
|
||||
|
|
@ -258,7 +255,7 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);
|
||||
var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: HttpContext.Request.Scheme);
|
||||
var res = await _emailSender.SendEmailAsync(_siteSettings, _smtpSettings, user.UserName, user.Email, "Confirm your account",
|
||||
var res = await _emailSender.SendEmailAsync(user.UserName, user.Email, "Confirm your account",
|
||||
"Please confirm your account by clicking this link: <a href=\"" + callbackUrl + "\">link</a>");
|
||||
return res;
|
||||
}
|
||||
|
|
@ -371,7 +368,7 @@ namespace Yavsc.Controllers
|
|||
await _signInManager.SignInAsync(user, isPersistent: false);
|
||||
|
||||
|
||||
await _emailSender.SendEmailAsync(_siteSettings, _smtpSettings, Startup.SiteSetup.Owner.Name, Startup.SiteSetup.Owner.EMail,
|
||||
await _emailSender.SendEmailAsync(Startup.SiteSetup.Owner.Name, Startup.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);
|
||||
|
|
@ -450,7 +447,7 @@ namespace Yavsc.Controllers
|
|||
// Send an email with this link
|
||||
var code = await _userManager.GeneratePasswordResetTokenAsync(user);
|
||||
var callbackUrl = Url.Action("ResetPassword", "Account", new { userId = user.Id, code = code }, protocol: HttpContext.Request.Scheme);
|
||||
await _emailSender.SendEmailAsync(_siteSettings, _smtpSettings, user.UserName, user.Email, _localizer["Reset Password"],
|
||||
await _emailSender.SendEmailAsync(user.UserName, user.Email, _localizer["Reset Password"],
|
||||
_localizer["Please reset your password by following this link:"] + " <" + callbackUrl + ">");
|
||||
return View("ForgotPasswordConfirmation");
|
||||
}
|
||||
|
|
@ -565,7 +562,7 @@ namespace Yavsc.Controllers
|
|||
}
|
||||
else // if (model.SelectedProvider == Constants.EMailFactor || model.SelectedProvider == "Default" )
|
||||
{
|
||||
await _emailSender.SendEmailAsync(_siteSettings, _smtpSettings,user.UserName, await _userManager.GetEmailAsync(user), "Security Code", message);
|
||||
await _emailSender.SendEmailAsync(user.UserName, await _userManager.GetEmailAsync(user), "Security Code", message);
|
||||
}
|
||||
return RedirectToAction(nameof(VerifyCode), new { Provider = model.SelectedProvider, ReturnUrl = model.ReturnUrl, RememberMe = model.RememberMe });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ namespace Yavsc.Controllers
|
|||
if (pro.Performer.Devices.Count > 0) {
|
||||
var regids = command.PerformerProfile.Performer
|
||||
.Devices.Select(d => d.GCMRegistrationId);
|
||||
grep = await _GCMSender.NotifyBookQueryAsync(_googleSettings,regids,yaev);
|
||||
grep = await _GCMSender.NotifyBookQueryAsync(regids,yaev);
|
||||
}
|
||||
|
||||
// TODO setup a profile choice to allow notifications
|
||||
|
|
@ -181,7 +181,6 @@ namespace Yavsc.Controllers
|
|||
ViewBag.GooglePayload=grep;
|
||||
|
||||
ViewBag.EmailSent = await _emailSender.SendEmailAsync(
|
||||
_siteSettings, _smtpSettings,
|
||||
command.PerformerProfile.Performer.UserName,
|
||||
command.PerformerProfile.Performer.Email,
|
||||
$"{command.Client.UserName} (un client) vous demande un rendez-vous",
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ namespace Yavsc.Controllers
|
|||
var regids = command.PerformerProfile.Performer
|
||||
.Devices.Select(d => d.GCMRegistrationId);
|
||||
|
||||
grep = await _GCMSender.NotifyAsync(_googleSettings, regids, yaev);
|
||||
grep = await _GCMSender.NotifyAsync(regids, yaev);
|
||||
}
|
||||
// TODO setup a profile choice to allow notifications
|
||||
// both on mailbox and mobile
|
||||
|
|
@ -112,7 +112,6 @@ namespace Yavsc.Controllers
|
|||
}
|
||||
|
||||
ViewBag.EmailSent = await _emailSender.SendEmailAsync(
|
||||
_siteSettings, _smtpSettings,
|
||||
command.PerformerProfile.Performer.UserName,
|
||||
command.PerformerProfile.Performer.Email,
|
||||
yaev.Topic,
|
||||
|
|
@ -275,7 +274,7 @@ namespace Yavsc.Controllers
|
|||
if (pro.Performer.Devices.Count > 0)
|
||||
{
|
||||
var regids = pro.Performer.Devices.Select(d => d.GCMRegistrationId);
|
||||
grep = await _GCMSender.NotifyHairCutQueryAsync(_googleSettings, regids, yaev);
|
||||
grep = await _GCMSender.NotifyHairCutQueryAsync(regids, yaev);
|
||||
}
|
||||
// TODO setup a profile choice to allow notifications
|
||||
// both on mailbox and mobile
|
||||
|
|
@ -300,7 +299,6 @@ namespace Yavsc.Controllers
|
|||
else _logger.LogWarning($"Calendar: {pro.Performer.DedicatedGoogleCalendar != null}\nEventDate: {yaev.EventDate != null}");
|
||||
|
||||
await _emailSender.SendEmailAsync(
|
||||
_siteSettings, _smtpSettings,
|
||||
pro.Performer.UserName,
|
||||
pro.Performer.Email,
|
||||
$"{yaev.Client.UserName}: {yaev.Reason}",
|
||||
|
|
@ -436,7 +434,7 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
var regids = command.PerformerProfile.Performer
|
||||
.Devices.Select(d => d.GCMRegistrationId);
|
||||
grep = await _GCMSender.NotifyHairCutQueryAsync(_googleSettings, regids, yaev);
|
||||
grep = await _GCMSender.NotifyHairCutQueryAsync(regids, yaev);
|
||||
}
|
||||
// TODO setup a profile choice to allow notifications
|
||||
// both on mailbox and mobile, and to allow calendar event insertion.
|
||||
|
|
@ -458,7 +456,6 @@ namespace Yavsc.Controllers
|
|||
}
|
||||
|
||||
await _emailSender.SendEmailAsync(
|
||||
_siteSettings, _smtpSettings,
|
||||
command.PerformerProfile.Performer.UserName,
|
||||
command.PerformerProfile.Performer.Email,
|
||||
yaev.Topic + " " + yaev.Sender,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,13 @@ PRODDESTDIR=/srv/www/yavsc
|
|||
HOSTING=localhost
|
||||
HOSTADMIN=root
|
||||
|
||||
include ../common.mk
|
||||
include ../versioning.mk
|
||||
include ../dnx.mk
|
||||
|
||||
all: $(BINTARGETPATH)
|
||||
|
||||
web: project.lock.json
|
||||
ASPNET_ENV=$(ASPNET_ENV) dnx web --configuration=$(CONFIGURATION)
|
||||
|
||||
status:
|
||||
ifeq ($(git_status),0)
|
||||
|
|
@ -32,7 +38,7 @@ ifeq ($(git_status),0)
|
|||
ssh $(HOSTADMIN)@$(HOSTING) sudo sync
|
||||
ssh $(HOSTADMIN)@$(HOSTING) sudo service kestrel start
|
||||
else
|
||||
@echo EPRODANDGITSTATUS! Refus de pousser en production: des changements doivent être validés auprès du contrôle de versions.
|
||||
$(error EPRODANDGITSTATUS! Refus de pousser en production: des changements doivent être validés auprès du contrôle de versions.)
|
||||
git status
|
||||
endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
using Yavsc.Abstract.Templates;
|
||||
using Yavsc.Models;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yavsc.Templates
|
||||
{
|
||||
public class UserOrientedTemplate: Template
|
||||
{
|
||||
public ApplicationUser User { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -126,19 +126,15 @@
|
|||
"Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final",
|
||||
"System.Json": "4.0.20126.16343",
|
||||
"Yavsc.Abstract": {
|
||||
"target": "project",
|
||||
"type": "default"
|
||||
},
|
||||
"Yavsc.Server": {
|
||||
"target": "project",
|
||||
"type": "default"
|
||||
},
|
||||
"OAuth.AspNet.Token": {
|
||||
"target": "project",
|
||||
"type": "build"
|
||||
},
|
||||
"OAuth.AspNet.AuthServer": {
|
||||
"target": "project",
|
||||
"type": "build"
|
||||
},
|
||||
"PayPalMerchant-net451": {
|
||||
|
|
@ -179,4 +175,4 @@
|
|||
"prepublish": "gulp min"
|
||||
},
|
||||
"embed": "Views/**/*.cshtml"
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
15
|
||||
Loading…
Add table
Add a link
Reference in a new issue