I already use the latest version. I don't know what is the matter with it.
Now i manage to solve it by customize Login page, and i write extra code by override OnPostAsync(string action)
if (!_validatorService.HasRequestValidCaptchaEntry(Language.English, DisplayMode.ShowDigits)) { Alerts.Danger("Please Enter Valid Captcha."); }
Please recommend if it not a good practice to override OnPostAsync(string action) of Login.cshtml.cs
Hello, I really don't know what is the difference between Abp new version with dotent 6 and the old version. I know it is not the problem with your Abp. I may need your help. My old Abo (version 4.3.3) with dotnet 5 is working normally with DNTCaptcha. **Without having to write any C# code in CustomLogin.cs, i just add the following codes in Login.cshtml and it works with the help of validating the provided captcha code for me:
<abp-script src="/libs/jquery-ajax-unobtrusive/jquery.unobtrusive-ajax.min.js" /> <abp-script src="/libs/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js" /> <abp-script src="/libs/jquery-validation/jquery.validate.js" /> <abp-script src="/libs/jquery/jquery.js" />
<dnt-captcha asp-captcha-generator-max="999999" asp-captcha-generator-min="111111" asp-captcha-generator-language="English" asp-captcha-generator-display-mode="ShowDigits" asp-use-relative-urls="true" asp-placeholder="Enter Security code" asp-validation-error-message="Please enter the security code." asp-font-name="Tahoma" asp-font-size="20" asp-fore-color="#333333" asp-back-color="#ccc" asp-text-box-class="text-box form-control" asp-text-box-template="<div class='input-group'><span class='input-group-prepend'><span class='input-group-text'><i class='fas fa-lock'></i></span></span>{0}</div>" asp-validation-message-class="text-danger" asp-refresh-button-class="fas fa-redo btn-sm" />**
It is strange with the new version. It seems jquery.validate.unobtrusive.js jquery.validate.js not validating for me
public class CustomLoginModel : LoginModel {
private readonly IDNTCaptchaValidatorService _validatorService;
private readonly DNTCaptchaOptions _captchaOptions;
public CustomLoginModel(
Microsoft.AspNetCore.Authentication.IAuthenticationSchemeProvider schemeProvider,
IOptions<Volo.Abp.Account.Public.Web.AbpAccountOptions> accountOptions,
IAbpRecaptchaValidatorFactory abpRecaptchaValidatorFactory,
IAccountExternalProviderAppService accountExternalProviderAppService,
ICurrentPrincipalAccessor currentPrincipalAccessor,
IOptions<IdentityOptions> identityOptions,
IOptionsSnapshot<reCAPTCHAOptions> reCaptchaOptions,
IDNTCaptchaValidatorService validatorService,
IOptions<DNTCaptchaOptions> options
)
: base(schemeProvider: schemeProvider,
accountOptions: accountOptions,
recaptchaValidatorFactory: abpRecaptchaValidatorFactory,
accountExternalProviderAppService: accountExternalProviderAppService,
currentPrincipalAccessor: currentPrincipalAccessor,
identityOptions: identityOptions,
reCaptchaOptions: reCaptchaOptions
)
{
_validatorService = validatorService;
_captchaOptions = options == null ? throw new ArgumentNullException(nameof(options)) : options.Value;
}
public override async Task<IActionResult> OnPostAsync(string action)
{
1/ I want to implement default Abp's implementation
2/ Want extra checking DNT Captcha whether it is correct or not
if correct => success login and go to Homepage
else => not success login
}
}
By the way, I have to customize Login page. I am trying to follow this tutorial: https://community.abp.io/articles/how-to-customize-the-login-page-for-mvc-razor-page-applications-9a40f3cd
how can i validate DNTCaptcha in the Login page? Please help
This issue does not appear to be related to
ABP
. I found the following issue with short research and I wanted to share it in case it might help.https://github.com/VahidN/DNTCaptcha.Core/issues/96
See also: https://community.abp.io/articles/patch-for-chrome-login-issue-identityserver4-samesite-cookie-problem-weypwp3n
Thank you so much.
I manage to fix successfully to show the Captcha image, but with the new version I have to write some extra code to validate the captcha number in Login.cshtml. So i try to write code like below:
public class LoginModel : PageModel {
private readonly IDNTCaptchaValidatorService _validatorService;
private readonly DNTCaptchaOptions _captchaOptions;
public LoginModel(
IDNTCaptchaValidatorService validatorService,
IOptions<DNTCaptchaOptions> options
, Microsoft.AspNetCore.Authentication.IAuthenticationSchemeProvider schemeProvider) {
_validatorService = validatorService;
_captchaOptions = options == null ? throw new ArgumentNullException(nameof(options)) : options.Value;
}
public IActionResult OnPost()
{
if (!_validatorService.HasRequestValidCaptchaEntry(Language.English, DisplayMode.NumberToWord))
{
this.ModelState.AddModelError(_captchaOptions.CaptchaComponent.CaptchaInputName, "Please enter the security code as a number.");
return Page();
}
//TODO: save data
return RedirectToPage("privacy");
}
public void OnGet()
{
}
}
But I get error at the CustomLoginModel.cs. Please see the attachement:
Try
abp install-libs
https://github.com/abpframework/abp/blob/dev/docs/en/Migration-Guides/Abp-5-0-MVC.md#use-install-libs-by-default
I try the abp install-libs and now i can run my application, but I have a problem with DNTCaptcha. Could you please help me solving it? GET https://localhost:44385/DNTCaptchaImage/Show?data=uc-XADIWBALybkfq-Jz6AIoCEzZMZdfxiCdhb_9sblBIoJ7Ctu5x-_nQ1ZbPgVgwUxqZt1PLsbBoqr0TCyfpBQ 400 (Bad Request)
Hi,
Here are some of the same topics, can you check them? https://stackoverflow.com/questions/62763225/i-get-an-error-when-i-add-migration-using-entity-framework-core
now i have this error:
AbpException: Could not find the bundle file '/libs/datatables.net-bs5/css/dataTables.bootstrap5.css' for the bundle 'Lepton.Global'!
Hello,
Now I manage to build my project successfully, but I cannot start my application. How to solve the following error?
PublicKeyToken=adb9793829ddae60' does not have an implementation.
at Microsoft.EntityFrameworkCore.InMemory.Infrastructure.Internal.InMemoryOptionsExtension.get_Info()
at Microsoft.EntityFrameworkCore.DbContextOptions.GetHashCode()
at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd[TArg](TKey key, Func
3 valueFactory, TArg factoryArgument)
at Microsoft.EntityFrameworkCore.Internal.ServiceProviderCache.GetOrAdd(IDbContextOptions options, Boolean providerRequired)
at Microsoft.EntityFrameworkCore.DbContext..ctor(DbContextOptions options)
at lambda_method34(Closure , Object[] )
at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate()
--- End of inner exception stack trace ---
at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate()
at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters) at Autofac.Core.Activators.Reflection.ReflectionActivator.<ConfigurePipeline>b__11_0(ResolveRequestContext ctxt, Action
1 next)
at Autofac.Core.Resolving.Middleware.DelegateMiddleware.Execute(ResolveRequestContext context, Action1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Middleware.DisposalTrackingMiddleware.Execute(ResolveRequestContext context, Action
1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action1 next) --- End of inner exception stack trace --- at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action
1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
at Autofac.Core.Pipeline.ResolvePipeline.Invoke(ResolveRequestContext ctxt)
at Autofac.Core.Resolving.Middleware.RegistrationPipelineInvokeMiddleware.Execute(ResolveRequestContext context, Action1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Middleware.SharingMiddleware.<>c__DisplayClass5_0.<Execute>b__0() at Autofac.Core.Lifetime.LifetimeScope.CreateSharedInstance(Guid id, Func
1 creator)
at Autofac.Core.Lifetime.LifetimeScope.CreateSharedInstance(Guid primaryId, Nullable1 qualifyingId, Func
1 creator)
at Autofac.Core.Resolving.Middleware.SharingMiddleware.Execute(ResolveRequestContext context, Action1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Middleware.CircularDependencyDetectorMiddleware.Execute(ResolveRequestContext context, Action
1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
at Autofac.Core.Pipeline.ResolvePipeline.Invoke(ResolveRequestContext ctxt)
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, ResolveRequest request)
at Autofac.Core.Resolving.ResolveOperation.ExecuteOperation(ResolveRequest request)
at Autofac.Core.Resolving.ResolveOperation.Execute(ResolveRequest request)
at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(ResolveRequest request)
at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable1 parameters, Object& instance) at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable
1 parameters)
at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType, IEnumerable`1 parameters)
at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType)
at Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetRequiredService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at HealthChecks.UI.Core.HostedService.UIInitializationHostedService.InitializeDatabase(IServiceProvider sp)
at HealthChecks.UI.Core.HostedService.UIInitializationHostedService.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
at Dashboard.Web.Program.Main(String[] args) in /Users/pisethsan/Documents/projects/dashboard/src/Dashboard.Web/Program.cs:line 31
The program '[15549] dotnet' has exited with code 0 (0x0).
Hello,
Now i manage to restore its packages successfully.
However, i get the follow 3 errors:/Users/pisethsan/Documents/projects/dashboard/src/Dashboard.Domain/IdentityServer/IdentityServerDataSeedContributor.cs(54,54): Error CS1061: 'IApiScopeRepository' does not contain a definition for 'GetByNameAsync' and no accessible extension method 'GetByNameAsync' accepting a first argument of type 'IApiScopeRepository' could be found (are you missing a using directive or an assembly reference?) (CS1061) (Dashboard.Domain)
/Users/pisethsan/Documents/projects/dashboard/test/Dashboard.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs(26,26): Error CS0246: The type or namespace name 'IProfileAppService' could not be found (are you missing a using directive or an assembly reference?) (CS0246) (Dashboard.HttpApi.Client.ConsoleTestApp)
/Users/pisethsan/Documents/projects/dashboard/test/Dashboard.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs(13,13): Error CS0246: The type or namespace name 'IProfileAppService' could not be found (are you missing a using directive or an assembly reference?) (CS0246) (Dashboard.HttpApi.Client.ConsoleTestApp)
Hello,
I manage to solve the above 3 errors, but now i get this following error:
/Users/pisethsan/Documents/projects/dashboard/src/Dashboard.Domain/IdentityServer/IdentityServerDataSeedContributor.cs(54,54): Error CS1061: 'IApiScopeRepository' does not contain a definition for 'GetByNameAsync' and no accessible extension method 'GetByNameAsync' accepting a first argument of type 'IApiScopeRepository' could be found (are you missing a using directive or an assembly reference?) (CS1061) (Dashboard.Domain)