Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Domain.Customers;
using Grand.Web.Features.Models.Customers;
using Grand.Web.Models.Customer;
using Grand.Mediator;
namespace Grand.Web.Features.Handlers.Customers;
public class
GetPasswordRecoveryConfirmHandler : IRequestHandler<GetPasswordRecoveryConfirm, PasswordRecoveryConfirmModel>
{
private readonly CustomerSettings _customerSettings;
private readonly ITranslationService _translationService;
public GetPasswordRecoveryConfirmHandler(
ITranslationService translationService,
CustomerSettings customerSettings)
{
_translationService = translationService;
_customerSettings = customerSettings;
}
public async Task<PasswordRecoveryConfirmModel> Handle(GetPasswordRecoveryConfirm request,
CancellationToken cancellationToken)
{
var model = new PasswordRecoveryConfirmModel();
//validate token
if (!request.Customer.IsPasswordRecoveryTokenValid(request.Token))
{
model.DisablePasswordChanging = true;
model.Result = _translationService.GetResource("Account.PasswordRecovery.WrongToken");
}
//validate token expiration date
if (!request.Customer.IsPasswordRecoveryLinkExpired(_customerSettings)) return await Task.FromResult(model);
model.DisablePasswordChanging = true;
model.Result = _translationService.GetResource("Account.PasswordRecovery.LinkExpired");
return await Task.FromResult(model);
}
}