- ABP Framework version: v5
- UI type: MVC
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated (Angular): no
- Exception message and stack trace:
- Steps to reproduce the issue:"
31 Answer(s)
-
0
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
-
0
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 } }
-
0
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
-
0
You may be using the version of
DNTCapcha
that does not supportdotnet v6.0
version.Can you check?
If you are using the
dotnet v6.0
version ofDNTCapcha
that supportsdotnet v6.0
and you are still getting errors, please provide the relevant log record and code examples so that I can reproduce the error. -
0
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
-
0
Glad it worked. There is nothing wrong with overriding anywhere for your own needs. You don't need to worry about this.
I am closing the issue. Feel free to re-open or create a new issue if you have further questions.