using Microsoft.AspNetCore.Mvc; using Nop.Plugin.MultiFactorAuth.GoogleAuthenticator.Factories; using Nop.Plugin.MultiFactorAuth.GoogleAuthenticator.Models; using Nop.Web.Framework.Components; namespace Nop.Plugin.MultiFactorAuth.GoogleAuthenticator.Components; /// /// Represents view component for setting GoogleAuthenticator /// public class GAAuthenticationViewComponent : NopViewComponent { #region Fields protected readonly AuthenticationModelFactory _authenticationModelFactory; #endregion #region Ctor public GAAuthenticationViewComponent(AuthenticationModelFactory authenticationModelFactory) { _authenticationModelFactory = authenticationModelFactory; } #endregion #region Methods /// /// Invoke view component /// /// Widget zone name /// Additional data /// /// A task that represents the asynchronous operation /// The task result contains the view component result /// public async Task InvokeAsync(string widgetZone, object additionalData) { var model = new AuthModel(); model = await _authenticationModelFactory.PrepareAuthModel(model); return View("~/Plugins/MultiFactorAuth.GoogleAuthenticator/Views/Customer/GAAuthentication.cshtml", model); } #endregion }