I was able to do it
To make it work fully you need to play with the .cshtml locations and Partial Views or make a Customer View Engine
Maybe its your route ?
endpointRouteBuilder.MapControllerRoute("Nop.Plugin.Apollo.Appointments.Login",
"Login",
new { controller = "CustomCustomer", action = "Login" });
Here is my controller
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Primitives;
using Nop.Core;
using Nop.Core.Domain;
using Nop.Core.Domain.Catalog;
using Nop.Core.Domain.Common;
using Nop.Core.Domain.Customers;
using Nop.Core.Domain.Forums;
using Nop.Core.Domain.Gdpr;
using Nop.Core.Domain.Localization;
using Nop.Core.Domain.Media;
using Nop.Core.Domain.Messages;
using Nop.Core.Domain.Security;
using Nop.Core.Domain.Tax;
using Nop.Core.Events;
using Nop.Core.Http;
using Nop.Core.Http.Extensions;
using Nop.Services.Authentication;
using Nop.Services.Authentication.External;
using Nop.Services.Authentication.MultiFactor;
using Nop.Services.Catalog;
using Nop.Services.Common;
using Nop.Services.Customers;
using Nop.Services.Directory;
using Nop.Services.ExportImport;
using Nop.Services.Gdpr;
using Nop.Services.Helpers;
using Nop.Services.Localization;
using Nop.Services.Logging;
using Nop.Services.Media;
using Nop.Services.Messages;
using Nop.Services.Orders;
using Nop.Services.Tax;
using Nop.Web.Extensions;
using Nop.Web.Factories;
using Nop.Web.Framework;
using Nop.Web.Framework.Controllers;
using Nop.Web.Framework.Mvc.Filters;
using Nop.Web.Framework.Validators;
using Nop.Web.Models.Customer;
namespace Nop.Plugin.Plugin.Name.Controllers.Public
{
public partial class CustomCustomerController : Nop.Web.Controllers.CustomerController
{
#region Fields
private readonly AddressSettings _addressSettings;
private readonly CaptchaSettings _captchaSettings;
private readonly CustomerSettings _customerSettings;
private readonly DateTimeSettings _dateTimeSettings;
private readonly IDownloadService _downloadService;
private readonly ForumSettings _forumSettings;
private readonly GdprSettings _gdprSettings;
private readonly IAddressAttributeParser _addressAttributeParser;
private readonly IAddressModelFactory _addressModelFactory;
private readonly IAddressService _addressService;
private readonly IAuthenticationService _authenticationService;
private readonly ICountryService _countryService;
private readonly ICurrencyService _currencyService;
private readonly ICustomerActivityService _customerActivityService;
private readonly ICustomerAttributeParser _customerAttributeParser;
private readonly ICustomerAttributeService _customerAttributeService;
private readonly ICustomerModelFactory _customerModelFactory;
private readonly ICustomerRegistrationService _customerRegistrationService;
private readonly ICustomerService _customerService;
private readonly IEventPublisher _eventPublisher;
private readonly IExportManager _exportManager;
private readonly IExternalAuthenticationService _externalAuthenticationService;
private readonly IGdprService _gdprService;
private readonly IGenericAttributeService _genericAttributeService;
private readonly IGiftCardService _giftCardService;
private readonly ILocalizationService _localizationService;
private readonly ILogger _logger;
private readonly IMultiFactorAuthenticationPluginManager _multiFactorAuthenticationPluginManager;
private readonly INewsLetterSubscriptionService _newsLetterSubscriptionService;
private readonly INotificationService _notificationService;
private readonly IOrderService _orderService;
private readonly IPictureService _pictureService;
private readonly IPriceFormatter _priceFormatter;
private readonly IProductService _productService;
private readonly IShoppingCartService _shoppingCartService;
private readonly IStateProvinceService _stateProvinceService;
private readonly IStoreContext _storeContext;
private readonly ITaxService _taxService;
private readonly IWebHelper _webHelper;
private readonly IWorkContext _workContext;
private readonly IWorkflowMessageService _workflowMessageService;
private readonly LocalizationSettings _localizationSettings;
private readonly MediaSettings _mediaSettings;
private readonly MultiFactorAuthenticationSettings _multiFactorAuthenticationSettings;
private readonly StoreInformationSettings _storeInformationSettings;
private readonly TaxSettings _taxSettings;
#endregion
#region Ctor
public CustomCustomerController(AddressSettings addressSettings,
CaptchaSettings captchaSettings,
CustomerSettings customerSettings,
DateTimeSettings dateTimeSettings,
IDownloadService downloadService,
ForumSettings forumSettings,
GdprSettings gdprSettings,
IAddressAttributeParser addressAttributeParser,
IAddressModelFactory addressModelFactory,
IAddressService addressService,
IAuthenticationService authenticationService,
ICountryService countryService,
ICurrencyService currencyService,
ICustomerActivityService customerActivityService,
ICustomerAttributeParser customerAttributeParser,
ICustomerAttributeService customerAttributeService,
ICustomerModelFactory customerModelFactory,
ICustomerRegistrationService customerRegistrationService,
ICustomerService customerService,
IEventPublisher eventPublisher,
IExportManager exportManager,
IExternalAuthenticationService externalAuthenticationService,
IGdprService gdprService,
IGenericAttributeService genericAttributeService,
IGiftCardService giftCardService,
ILocalizationService localizationService,
ILogger logger,
IMultiFactorAuthenticationPluginManager multiFactorAuthenticationPluginManager,
INewsLetterSubscriptionService newsLetterSubscriptionService,
INotificationService notificationService,
IOrderService orderService,
IPictureService pictureService,
IPriceFormatter priceFormatter,
IProductService productService,
IShoppingCartService shoppingCartService,
IStateProvinceService stateProvinceService,
IStoreContext storeContext,
ITaxService taxService,
IWebHelper webHelper,
IWorkContext workContext,
IWorkflowMessageService workflowMessageService,
LocalizationSettings localizationSettings,
MediaSettings mediaSettings,
MultiFactorAuthenticationSettings multiFactorAuthenticationSettings,
StoreInformationSettings storeInformationSettings,
TaxSettings taxSettings) : base(addressSettings,
captchaSettings,
customerSettings,
dateTimeSettings,
downloadService,
forumSettings,
gdprSettings,
addressAttributeParser,
addressModelFactory,
addressService,
authenticationService,
countryService,
currencyService,
customerActivityService,
customerAttributeParser,
customerAttributeService,
customerModelFactory,
customerRegistrationService,
customerService,
eventPublisher,
exportManager,
externalAuthenticationService,
gdprService,
genericAttributeService,
giftCardService,
localizationService,
logger,
multiFactorAuthenticationPluginManager,
newsLetterSubscriptionService,
notificationService,
orderService,
pictureService,
priceFormatter,
productService,
stateProvinceService,
storeContext,
taxService,
workContext,
workflowMessageService,
localizationSettings,
mediaSettings,
multiFactorAuthenticationSettings,
storeInformationSettings,
taxSettings)
{
_addressSettings = addressSettings;
_captchaSettings = captchaSettings;
_customerSettings = customerSettings;
_dateTimeSettings = dateTimeSettings;
_downloadService = downloadService;
_forumSettings = forumSettings;
_gdprSettings = gdprSettings;
_addressAttributeParser = addressAttributeParser;
_addressModelFactory = addressModelFactory;
_addressService = addressService;
_authenticationService = authenticationService;
_countryService = countryService;
_currencyService = currencyService;
_customerActivityService = customerActivityService;
_customerAttributeParser = customerAttributeParser;
_customerAttributeService = customerAttributeService;
_customerModelFactory = customerModelFactory;
_customerRegistrationService = customerRegistrationService;
_customerService = customerService;
_eventPublisher = eventPublisher;
_exportManager = exportManager;
_externalAuthenticationService = externalAuthenticationService;
_gdprService = gdprService;
_genericAttributeService = genericAttributeService;
_giftCardService = giftCardService;
_localizationService = localizationService;
_logger = logger;
_multiFactorAuthenticationPluginManager = multiFactorAuthenticationPluginManager;
_newsLetterSubscriptionService = newsLetterSubscriptionService;
_notificationService = notificationService;
_orderService = orderService;
_pictureService = pictureService;
_priceFormatter = priceFormatter;
_productService = productService;
_shoppingCartService = shoppingCartService;
_stateProvinceService = stateProvinceService;
_storeContext = storeContext;
_taxService = taxService;
_webHelper = webHelper;
_workContext = workContext;
_workflowMessageService = workflowMessageService;
_localizationSettings = localizationSettings;
_mediaSettings = mediaSettings;
_multiFactorAuthenticationSettings = multiFactorAuthenticationSettings;
_storeInformationSettings = storeInformationSettings;
_taxSettings = taxSettings;
}
#endregion
#region Methods
//available even when a store is closed
[CheckAccessClosedStore(true)]
//available even when navigation is not allowed
[CheckAccessPublicStore(true)]
/// <returns>A task that represents the asynchronous operation</returns>
public override async Task<IActionResult> Login(bool? checkoutAsGuest)
{
var model = await _customerModelFactory.PrepareLoginModelAsync(checkoutAsGuest);
return View("~/Plugins/Plugin.Name/Views/FrontView/Login.cshtml", model);
}
[HttpPost]
[ValidateCaptcha]
//available even when a store is closed
[CheckAccessClosedStore(true)]
//available even when navigation is not allowed
[CheckAccessPublicStore(true)]
/// <returns>A task that represents the asynchronous operation</returns>
public override async Task<IActionResult> Login(LoginModel model, string returnUrl, bool captchaValid)
{
//validate CAPTCHA
if (_captchaSettings.Enabled && _captchaSettings.ShowOnLoginPage && !captchaValid)
{
ModelState.AddModelError("", await _localizationService.GetResourceAsync("Common.WrongCaptchaMessage"));
}
if (ModelState.IsValid)
{
var customerUserName = model.Username?.Trim();
var customerEmail = model.Email?.Trim();
var userNameOrEmail = _customerSettings.UsernamesEnabled ? customerUserName : customerEmail;
var loginResult = await _customerRegistrationService.ValidateCustomerAsync(userNameOrEmail, model.Password);
switch (loginResult)
{
case CustomerLoginResults.Successful:
{
var customer = _customerSettings.UsernamesEnabled
? await _customerService.GetCustomerByUsernameAsync(customerUserName)
: await _customerService.GetCustomerByEmailAsync(customerEmail);
return await _customerRegistrationService.SignInCustomerAsync(customer, returnUrl, model.RememberMe);
}
case CustomerLoginResults.MultiFactorAuthenticationRequired:
{
var customerMultiFactorAuthenticationInfo = new CustomerMultiFactorAuthenticationInfo
{
UserName = userNameOrEmail,
RememberMe = model.RememberMe,
ReturnUrl = returnUrl
};
HttpContext.Session.Set(NopCustomerDefaults.CustomerMultiFactorAuthenticationInfo, customerMultiFactorAuthenticationInfo);
return RedirectToRoute("MultiFactorVerification");
}
case CustomerLoginResults.CustomerNotExist:
ModelState.AddModelError("", await _localizationService.GetResourceAsync("Account.Login.WrongCredentials.CustomerNotExist"));
break;
case CustomerLoginResults.Deleted:
ModelState.AddModelError("", await _localizationService.GetResourceAsync("Account.Login.WrongCredentials.Deleted"));
break;
case CustomerLoginResults.NotActive:
ModelState.AddModelError("", await _localizationService.GetResourceAsync("Account.Login.WrongCredentials.NotActive"));
break;
case CustomerLoginResults.NotRegistered:
ModelState.AddModelError("", await _localizationService.GetResourceAsync("Account.Login.WrongCredentials.NotRegistered"));
break;
case CustomerLoginResults.LockedOut:
ModelState.AddModelError("", await _localizationService.GetResourceAsync("Account.Login.WrongCredentials.LockedOut"));
break;
case CustomerLoginResults.WrongPassword:
default:
ModelState.AddModelError("", await _localizationService.GetResourceAsync("Account.Login.WrongCredentials"));
break;
}
}
//If we got this far, something failed, redisplay form
model = await _customerModelFactory.PrepareLoginModelAsync(model.CheckoutAsGuest);
return View("~/Plugins/Plugin.Name/Views/FrontView/Login.cshtml", model);
}
#endregion
}
}
}