diff --git a/contrib/kestrel b/contrib/kestrel index bf040ddc..9c62afce 100755 --- a/contrib/kestrel +++ b/contrib/kestrel @@ -65,6 +65,8 @@ status() { start() { + # wait a little for postgresql to be available + sleep 1 for env in $CONFIGS do setdnxenv "$env" diff --git a/src/Yavsc.Server/Models/Messaging/BaseEvent.cs b/src/Yavsc.Server/Models/Messaging/BaseEvent.cs index 3fd5286f..53a64566 100644 --- a/src/Yavsc.Server/Models/Messaging/BaseEvent.cs +++ b/src/Yavsc.Server/Models/Messaging/BaseEvent.cs @@ -25,22 +25,22 @@ namespace Yavsc.Models.Messaging using Interfaces.Workflow; /// - /// /// Base event. + /// Base event. /// public abstract class BaseEvent : IEvent { - public BaseEvent() - { - Topic = GetType().Name; - } - public BaseEvent(string topic) + public BaseEvent() { - Topic = GetType().Name+"/"+topic; + Topic = GetType().Name; + } + public BaseEvent(string topic) + { + Topic = GetType().Name + "/" + topic; } public string Topic { get; private set; } public string Sender { get; set; } - abstract public string CreateBody(); + public abstract string CreateBody(); } diff --git a/src/Yavsc/Controllers/Accounting/AccountController.cs b/src/Yavsc/Controllers/Accounting/AccountController.cs index 6268822a..e77c300a 100644 --- a/src/Yavsc/Controllers/Accounting/AccountController.cs +++ b/src/Yavsc/Controllers/Accounting/AccountController.cs @@ -26,21 +26,21 @@ namespace Yavsc.Controllers public class AccountController : Controller { - const string nextPageTokenKey = "nextPageTokenKey"; - const int defaultLen = 10; + private const string nextPageTokenKey = "nextPageTokenKey"; + private const int defaultLen = 10; private readonly UserManager _userManager; private readonly SignInManager _signInManager; private readonly IEmailSender _emailSender; // private readonly ISmsSender _smsSender; private readonly ILogger _logger; - SiteSettings _siteSettings; - TwilioSettings _twilioSettings; + readonly SiteSettings _siteSettings; + readonly TwilioSettings _twilioSettings; - IStringLocalizer _localizer; + readonly IStringLocalizer _localizer; // TwilioSettings _twilioSettings; - ApplicationDbContext _dbContext; + readonly ApplicationDbContext _dbContext; public AccountController( @@ -53,13 +53,10 @@ namespace Yavsc.Controllers ApplicationDbContext dbContext) { _userManager = userManager; - _signInManager = signInManager; var emailUserTokenProvider = new UserTokenProvider(); _userManager.RegisterTokenProvider("EmailConfirmation", emailUserTokenProvider); - _userManager.RegisterTokenProvider("ResetPassword", emailUserTokenProvider); - // _userManager.RegisterTokenProvider("SMS",new UserTokenProvider()); // _userManager.RegisterTokenProvider("Phone", new UserTokenProvider()); _emailSender = emailSender; @@ -171,7 +168,7 @@ namespace Yavsc.Controllers if (result.RequiresTwoFactor) { - return RedirectToAction(nameof(SendCode), new { ReturnUrl = model.ReturnUrl, RememberMe = model.RememberMe }); + return RedirectToAction(nameof(SendCode), new { returnUrl = model.ReturnUrl, rememberMe = model.RememberMe }); } if (result.IsLockedOut) { @@ -219,7 +216,7 @@ namespace Yavsc.Controllers return HttpBadRequest(); } // 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 { ReturnUrl = model.ReturnUrl }, protocol:"https" , host: Startup.Authority); + var redirectUrl = Url.Action("ExternalLoginCallback", "Account", new { model.ReturnUrl }, protocol:"https", host: Startup.Authority); var properties = _signInManager.ConfigureExternalAuthenticationProperties(model.Provider, redirectUrl); // var properties = new AuthenticationProperties{RedirectUri=ReturnUrl}; return new ChallengeResult(model.Provider, properties); @@ -566,17 +563,12 @@ namespace Yavsc.Controllers // 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.GeneratePasswordResetTokenAsync(user); - var callbackUrl = Url.Action("ResetPassword", "Account", new { userId = user.Id, code = code }, - protocol: "https", host: Startup.Authority); - - - await _emailSender.SendEmailAsync(user.UserName, user.Email, _localizer["Reset Password"], - _localizer["Please reset your password by following this link:"] + " <" + callbackUrl + ">"); - - - return View("ForgotPasswordConfirmation"); + var callbackUrl = Url.Action("ResetPassword", "Account", new { userId = user.Id, code }, + protocol: "https", host: Startup.Authority); + var sent = await _emailSender.SendEmailAsync(user.UserName, user.Email, _localizer["Reset Password"], + _localizer["Please reset your password by following this link:"] + " <" + callbackUrl + ">"); + return View("ForgotPasswordConfirmation", sent); } // If we got this far, something failed, redisplay form @@ -600,7 +592,7 @@ namespace Yavsc.Controllers var user = await _userManager.FindByIdAsync(UserId); if (user==null) return new BadRequestResult(); // We just serve the form to reset here. - return View(); + return View(); } // POST: /Account/ResetPassword