vahidn / dntcaptcha.core Goto Github PK
View Code? Open in Web Editor NEWDNTCaptcha.Core is a captcha generator and validator for ASP.NET Core applications
License: Apache License 2.0
DNTCaptcha.Core is a captcha generator and validator for ASP.NET Core applications
License: Apache License 2.0
با سلام
برای درخواست های که خروجی جی سان هست مقدار کپچا تغییر نمیکند . وقتی کد کپچا رو اشتباه وارد میکند دوباره کد تغییر نمی کند .با چه روشی کپچا رو رفرش کنیم .ممنون
return Json(new { success = false, state = "loginFail", responseText = messages });
من اونطوری فراخوانی کردم حالا نمیدونم روش کارم درسته یا خیر
$("#dntCaptchaRefreshButton").trigger("click");
با سلام و احترام
زمانی در یک صفحه نیاز به وجود کپچاهای زیادی باشد مرورگر با خطای زیر مواجه میشه
Bad Request - Request Too Long
و برای ادامه کار حتما باید کش مرورگر پاک بشه
Is There a way to refresh de button vía javascript.
سلام جناب نصیری
من از این بسته برای یک وب سایت سازمانی استفاده کردم
امنیت سازمان بهم گفته که میشه با نرم افزار google lens کد رو خواند آیا راهی وجود داره که این اتفاق نیفته؟
Hi,
I found that there is only 3 language support.
Is there provide any other way for me to add other language support ?
سلام
امکان تغییر آیدی فراهم نیست
چون از دوتا کپچا دریک صفحه استفاده میشه و تداخل آیدی ایجاد میشه.
لطفا این امکانو اضافه کنید
سلام، این مشکل قبلا توسط #15 گزارش داده شده و شما هم راه حلش رو ارائه دادید.
منتها از اونجا که برای من هم مجدد پیش اومد و مدت زمانی طول کشید تا در نهایت به قسمت ایرادات مخزن سر زدم و متوجه راه حل رفع کردنش شدم، جهت صرفه جویی در وقت سایر برنامه نویسان که ممکنه در آینده به این مشکل برخورد کنند بهتر هست که قسمت راهنمای پروژه رو به روز رسانی کنید.
با توجه به اینکه استفاده از نسخه CDN
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/mvc/3.0/jquery.unobtrusive-ajax.min.js"></script>
باعث ایجاد مشکل میشه بهتر هست اون قسمت رو از راهنما حذف کنید، یا صریحا در راهنما اعلام کنید که ایجاد مشکل میکنه.
چند نکته:
1-نسخه
NPM
موجود هست میتونید به راهنما اضافه کنید. من با استفاده از
libman
اضافش کردم به پروژم بدون مشکل کار میکرد.
2-نسخه
cdnjs
در حال ایجاد شدن هست
3-آدرسی که برای پروژه
https://github.com/aspnet/jquery-ajax-unobtrusive/tree/master/dist
در راهنمای سایت گذاشتید خطای 404 میده،
به مخزن اصلی تغییرش بدید
https://github.com/aspnet/jquery-ajax-unobtrusive/
با تشکر
Please send better message to show when send wrong numbers:
this line
with this message :
"کد امنیتی وارد شده صحیح نمی باشد.به رقم وارد نمایید"
a suggest
The library doesn't support distributed systems.
It's such a waste that a good library like this doesn't have this feature.
I had a look at the source code and it seems that adding this feature doesn't need so much effort.
IMemoryCache
has been used in two files:
MemoryCacheCaptchaStorageProvider
and SerializationProvider
The latter one prevent any storage provider to work on distributed system.
I don't know what other changes is required but at least I know one part of the change required to support the feature is to just replace IMemoryCache
with IDistributedCache
.
I run my project on centos 7 and I've installed all dependencies you referred in README.md, the problem is that captcha image characters displaying on wrong direction.
Also i installed Tahoma and other RTL fonts and it didn't worked.
have you any idea to solve this?
The in-use version: DNTCaptcha.Core 1.4.4
Operating system: CentOS Linux 7
IDE: Published with Visual Studio 2017 (v15.6.5) on Windows 10
http://192.168.228.129:5000/DNTCaptchaImage/Show?text=CfDJ8LWca3Bj7zxDmnTo3VBV6aSizgT3jEfA3aTyeat07C8MaMVgW0Xv7lZCeoV3VHONnTrV8iR8wjQZz04t0dgMVb5E%2Bion2y%2BiAVXzd%2F4sJq%2Fk50Ycex6noL8hxdF6XnJ81IsX7jNRq93UAPc4OOvIb6oAzmm2RKo1dy1R4XjUh3GlLcny19aJ2YrAW6xntViwHg%3D%3D&rndDate=636692528396190703&foreColor=%23333333&backColor=%23ccc&fontSize=20&fontName=Tahoma
با سلام هنگامی که بر روی تولید عدد قرار میدهیم بیش از 3 حرف را ویرگول قرار میدهد امکان حذف ویرگول وجود دارد؟
ظاهرا مربوط به فرمت متن میباشد
DNTCaptcha.Core version:
.NET Core SDK version:
IDE:
public string GetText(long number, Language language)
{
var text = string.Format(CultureInfo.InvariantCulture, "{0:N0}", number);
return language == Language.Persian ? text.ToPersianNumbers() : text;
}
Exception message:
Full Stack trace:
I'm trying to use this library but I'm facing an HTTP 500 error.
the expected behavior is a useful error message.
Linux
DNTCaptcha.Core version: 2.3.0
.NET Core SDK version: 3.1
example request headers:
:method: POST
:path: /DNTCaptchaApi/CreateDNTCaptcha
:scheme: https
accept: application/json, text/plain, /
accept-encoding: gzip, deflate, br
accept-language: en-US,en;q=0.9
cache-control: no-cache
content-length: 210
content-type: application/json;charset=UTF-8
origin: https://localhost:5001
pragma: no-cache
referer: https://localhost:5001/login
sec-fetch-dest: empty
sec-fetch-mode: cors
sec-fetch-site: same-origin
example request payload:
{"backColor":"#f7f3f3","fontName":"Tahoma","fontSize":18,"foreColor":"#111111","language":"English","max":9000,"min":1,"useRelativeUrls":true,"displayMode":"NumberToWord","useNoise":true,"captchaToken":"token"}
I've added library API this way :
services.AddDNTCaptcha(options =>
options.UseCookieStorageProvider() // -> It relies on the server and client's times. It's ideal for
scalability, because it doesn't save anything in the server's memory. );
Error 500.
Exception message: none
did I miss something?
I'm using DNTCaptcha with ASP.NET Core API application that is behind nginx reverse proxy. It seems DNTCaptcha cannot decrypt the cookie correctly and always returns BadRequest result.
Do you have any idea what can be wrong or give me any lead to check?
this is what I got from logs :
isValidCookie:: 20 + 5��:���
Windows Server
ASP.NET Core 3.1
Nginx 1.7.10
DNTCaptcha.Core version: 2.5.0
.NET Core SDK version: 3.1.201
IDE:
با سلام
ایا کد کپچا با درخواست های اژاکسی مشکل دارد
با این حطا مواجه شدم. با تشکر.
NotSupportedException: Your ViewModel should implement the DNTCaptchaBase class (public class AccountViewModel : DNTCaptchaBase {}).
I have used this library on arch Linux before and it was working fine. yesterday i switch to Ubuntu 20.04 ( WSL2 windows 2004) and setup new development environment on my main machine everything is working fine except this library.
there is no exception but the output of DNTCaptchaImage/Show?...
is a empty transparent Image!
i already installed libgdiplus
library on ubuntu.
what possibly can cause this problem ? (look at attached image pls)
Wsl2 - Ubuntu 20.04
DNTCaptcha.Core version: 2.3.0 and 2.5.0
.NET Core SDK version: 3.1
IDE: vscode
Exception message: there is no exception
Is it possible to use this library without adding full MVC (services.AddMvc() in Startup.cs)? for example i want to just use AddControllers()
I understand that you have used Request.Scheme
to generate the captcha image link, but this might not be effective behind reverse-proxies or load-balancers where the incoming https traffic is transformed into http to reach the application. Since this can result in "mixed content" warnings in modern browsers, I think some handy option like "PublicOrigin", as accomplished by the IdentityServer team, would make everyone happy:)
DNTCaptcha.Core version: 2.6.0
.NET Core SDK version: 3.1
IDE: VS2019
ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
System.Collections.Generic.List.get_Item(int index)
Microsoft.AspNetCore.Mvc.Routing.UrlHelper.GetVirtualPathData(string routeName, RouteValueDictionary values)
Microsoft.AspNetCore.Mvc.Routing.UrlHelper.Action(UrlActionContext actionContext)
Microsoft.AspNetCore.Mvc.UrlHelperExtensions.Action(IUrlHelper helper, string action, string controller, object values, string protocol)
DNTCaptcha.Core.DNTCaptchaTagHelper.getCaptchaImageTagBuilder(string encryptedText)
DNTCaptcha.Core.DNTCaptchaTagHelper.Process(TagHelperContext context, TagHelperOutput output)
DNTCaptcha.Core.DNTCaptchaTagHelper.ProcessAsync(TagHelperContext context, TagHelperOutput output)
Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner.RunAsync(TagHelperExecutionContext executionContext)
<dnt-captcha asp-captcha-generator-max="9000"
asp-captcha-generator-min="1"
asp-captcha-generator-language="Persian"
asp-placeholder="کد امنیتی به رقم (مانند: 1388)"
asp-validation-error-message="لطفا کد امنیتی را به رقم وارد نمائید"
asp-font-name="Tahoma"
asp-font-size="18"
asp-fore-color="#333333"
asp-back-color="#ccc"
asp-text-box-class="k-textbox"
asp-text-box-template="<span class='k-textbox k-space-right w-100 border-danger'>{0}<span class='inputgroup-icon ms-Icon ms-Icon--Lock'></span></span>"
asp-validation-message-class="text-danger"
asp-refresh-button-class="ms-Icon ms-Icon--Refresh btn-sm" />
I`m using DNTCaptcha 1.4.2 and ASP Core 1.1 when i deploy the project on window server which is using docker nano server i face with this exception and captcha image was not showing in project:
System.TypeInitializationException: The type initializer for 'System.Drawing.KnownColors' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Drawing.GDIPlus' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'gdiplus': The specified module could not be found. (Exception from HRESULT: 0x8007007E)at System.Drawing.GDIPlus.GdiplusStartup(UInt64& token, GdiplusStartupInput& input,GdiplusStartupOutput& output)at System.Drawing.GDIPlus..cctor()
--- End of inner exception stack trace ---
at System.Drawing.GDIPlus.RunningOnWindows() at System.Drawing.KnownColors..cctor()
--- End of inner exception stack trace ---
at System.Drawing.KnownColors.FindColorMatch(Color c)
at System.Drawing.ColorConverter.StaticConvertFromString(ITypeDescriptorContext context, String s, CultureInfo culture)at System.Drawing.ColorConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)at System.Drawing.ColorTranslator.FromHtml(String htmlColor)
at DNTCaptcha.Core.Providers.CaptchaImageProvider.DrawCaptcha(String message, String foreColor, String backColor, Single fontSize, String fontName)
at DNTCaptcha.Core.DNTCaptchaImageController.Show(String text, String rndDate, String foreColor,String backColor, Single fontSize, String fontName)
crit: DNTCaptcha.Core.DNTCaptchaImageController[1001]
DrawCaptcha error.
I use DNTCaptcha.Core Version="1.4.1" and call it in Startup.cs like this
services.AddDNTCaptcha();
In my angular app use dnt-captcha component
When I run project angular show this error in console of browser
observable error: HttpErrorResponse {headers: HttpHeaders, status: 400, statusText: "Bad Request", url: "http://localhost:5000/DNTCaptchaApi/CreateDNTCaptcha", ok: false, …}
How can I solve this problem?
Refresh work when I click on the refresh button but after waiting for a few mins the image is still the same, and even I try to enter expected output as per the current image displayed it shows an invalid message.
DNTCaptcha.Core version: 2.3.0
.NET Core SDK version: 3.0
DNTCaptcha.Core version: 2.0.2
.NET Core SDK version: 2.2.0
If we enable Content-Security-Policy
on our website , we will get an error because of DNTCaptcha (it refers to not to put script tag in your page ).
DNTCaptcha puts a script tag in the page .
Is there any way to solve this problem ?
با سلام
دنبال روشی هستم که با چند بار اشتباه زدن کد کپچا فوق نمایش داده شود.همون اول کد کپچا نمایش داده نشود. کد فوق چند قابلیتی دارد.؟ با تشکر
سلام و عرض ادب
مشکلی که من باهاش برخورد کردم اینه که زمانیکه از طریق گوشی اندروید ارقام رو وارد میکنم اگه صفحه کلید در حالت فارسی باشه جواب نمیده(از عدد وارد شده خطا میگیره که با رشته عددی برابر نیست) ولی در حالت انگلیسی مشکلی نداره
با تشکر
<dnt-captcha asp-captcha-generator-max="999999"
asp-captcha-generator-min="1000"
asp-captcha-generator-language="Persian"
asp-captcha-generator-display-mode="NumberToWord"
asp-use-relative-urls="true"
asp-placeholder="عدد بالا"
asp-validation-error-message="لطفا عدد نوشته شده را به عدد وارد کنید"
asp-font-name="Tahoma"
asp-font-size="22"
asp-fore-color="#333333"
asp-back-color="#FFFFFF"
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='fe-icon-repeat'></i></span></span>{0}</div>"
asp-validation-message-class="text-danger"
asp-refresh-button-class="fas fa-redo btn-sm" />
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/mvc/3.0/jquery.unobtrusive-ajax.min.js"></script>
Refresh button explicitly sets model properties from query strings and generates captcha based on it.
It results in a vulnerability that by using Min and Max properties in url of refresh button, we can generate our desired value and it will validate successfully.
See this data-ajax-url attribute of refresh button for example:
data-ajax-url="/DNTCaptchaImage/Refresh?rndDate=637025421369768143&FontName=Tahoma&FontSize=12&ForeColor=%231B0172&Language=Persian&Max=999&Min=100&Placeholder=%D8%AD%D8%A7%D8%B5%D9%84%20%D8%AC%D9%85%D8%B9%20%D8%A7%D8%B9%D8%AF%D8%A7%D8%AF%20%D8%A8%D8%A7%D9%84%D8%A7%20%D8%B1%D8%A7%20%D9%88%D8%A7%D8%B1%D8%AF%20%DA%A9%D9%86%DB%8C%D8%AF&TextBoxClass=text-box%20single-line%20mx-auto&TextBoxTemplate=%7B0%7D&ValidationErrorMessage=%D9%84%D8%B7%D9%81%D8%A7%20%DA%A9%D8%AF%20%D8%A7%D9%85%D9%86%DB%8C%D8%AA%DB%8C%20%D8%B1%D8%A7%20%D8%A8%D9%87%20%D8%B1%D9%82%D9%85%20%D9%88%D8%A7%D8%B1%D8%AF%20%D9%86%D9%85%D8%A7%D8%A6%DB%8C%D8%AF&ValidationMessageClass=text-danger&CaptchaToken=.dntCaptcha95e784a1ee6e1f5c8252046ba44a97965b0484985984548&RefreshButtonClass=glyphicon%20glyphicon-refresh%20btn-sm"
we can change it to this (Max=999&Min=999):
data-ajax-url="/DNTCaptchaImage/Refresh?rndDate=637025421369768143&FontName=Tahoma&FontSize=12&ForeColor=%231B0172&Language=Persian&Max=999&Min=999&Placeholder=%D8%AD%D8%A7%D8%B5%D9%84%20%D8%AC%D9%85%D8%B9%20%D8%A7%D8%B9%D8%AF%D8%A7%D8%AF%20%D8%A8%D8%A7%D9%84%D8%A7%20%D8%B1%D8%A7%20%D9%88%D8%A7%D8%B1%D8%AF%20%DA%A9%D9%86%DB%8C%D8%AF&TextBoxClass=text-box%20single-line%20mx-auto&TextBoxTemplate=%7B0%7D&ValidationErrorMessage=%D9%84%D8%B7%D9%81%D8%A7%20%DA%A9%D8%AF%20%D8%A7%D9%85%D9%86%DB%8C%D8%AA%DB%8C%20%D8%B1%D8%A7%20%D8%A8%D9%87%20%D8%B1%D9%82%D9%85%20%D9%88%D8%A7%D8%B1%D8%AF%20%D9%86%D9%85%D8%A7%D8%A6%DB%8C%D8%AF&ValidationMessageClass=text-danger&CaptchaToken=.dntCaptcha95e784a1ee6e1f5c8252046ba44a97965b0484985984548&RefreshButtonClass=glyphicon%20glyphicon-refresh%20btn-sm"
It will give us 999 and when we write 999 in input, it will validate successfully.
A hacker can easily bypass captcha this way.
Refresh controller action must not depend on anything received from client and must generate captcha independently based on sever-side values.
`info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1]
Executing action method DNTCaptcha.Core.DNTCaptchaImageController.Show (DNTCaptcha.Core) with arguments (CfDJ8AUyVhOCtYhBqsBayGrsMEg6ZEKonj8Yu4zyLjktNB8GB1aWxuLw9zhe3cuRfPfMiOi/F2sTu/8TXeYBrtMG42XJ2TPsiPDrmOU19aetv6kfg+YXpQu7Jy3vFg1RG3I9gY0ugsP2zH5Cb5uu15Zr50A=, 636275045063773290, black, #ccc, 20, Tahoma) - ModelState is Valid
info: Microsoft.AspNetCore.Mvc.StatusCodeResult[1]
Executing HttpStatusCodeResult, setting HTTP status code 400
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
Executed action DNTCaptcha.Core.DNTCaptchaImageController.Show (DNTCaptcha.Core) in 0.3593ms
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1]
Executing action method IdentityServerWithIdentityCore.Controllers.ErrorController.Index (IdentityServerWithIdentityCore) with arguments (400) - ModelState is Valid
fail: IdentityServerWithIdentityCore.Controllers.ErrorController[0]
Error 400 for GET /DNTCaptchaImage/Show
I run my project in a docker container, if I bind a domain by nginx then use proxy_pass forward to the container, or add SSL through CDN service, the captcha will return 400 error. Maybe it results from ports or something else?
When I click on refresh button url changes but captcha image do not change
DNTCaptcha.Core version:
.NET Core SDK version: 3.0
DNTCaptcha.Core in Razor Page NOT WORKING
Register.cshtml.cs
namespace MyProject.Areas.Identity.Pages.Account
{
public class RegisterModel : PageModel
{
public async Task OnGetAsync(string returnUrl = null)
{ . . . }
[ValidateDNTCaptcha(ErrorMessage = "Please enter the security code as a number.",
CaptchaGeneratorLanguage = DNTCaptcha.Core.Providers.Language.English,
CaptchaGeneratorDisplayMode = DNTCaptcha.Core.Providers.DisplayMode.SumOfTwoNumbers)]
public async Task<IActionResult> OnPostAsync(string returnUrl = null)
{
if (ModelState.IsValid) // => Always valid
{ ... }
}
}
Register.cshtml
<div class="col-lg-6 col-sm-12">
<dnt-captcha asp-captcha-generator-max="90"
asp-captcha-generator-min="1"
asp-captcha-generator-language="English"
asp-captcha-generator-display-mode="SumOfTwoNumbers"
asp-use-relative-urls="true"
asp-placeholder="Security code as a number"
asp-validation-error-message="@_localizerShared["Please enter the security code as a number."]"
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" class="text-en" />
</div>
. . .
@section Scripts {
<partial name="_ValidationScriptsPartial" />
<script src="~/js/jquery.unobtrusive-ajax.min.js"></script>
}
ALWAYS VALID. How to use it in Razor Pages
everything is perfect but captcha refresh button not working.
Each captcha has its specific hidden inputs (2 ones), id, and cookie and maybe other things that I don't know.
These combinations with their original answer make a captcha valid. Unfortunately, each captcha expires just when its expiration time reaches. This will results a situation that captcha will be reusable in all its expiration time (approximately 8 minutes).
Right behavior is that each time a captcha is checked, its token and all stuffs related must expire.
Save the cookie in your browser. Write right answer in value attribute of the main input and copy the parent div with all things within it.
During the expiration time, the captcha remains reusable and you can use these combinations (Cookie and HTML node) to validate all your requests.
Multi-Part Forms
(function ($) {
$.fn.serializefiles = function () {
var obj = $(this);
/* ADD FILE TO PARAM AJAX */
var token = $(obj).find('input[name= "__RequestVerificationToken"]').val();
var DNTCaptchaInputText = $(obj).find('input[name= "DNTCaptchaInputText"]').val();
var DNTCaptchaText = $(obj).find('input[name= "DNTCaptchaText"]').val();
var DNTCaptchaToken = $(obj).find('input[name= "DNTCaptchaToken"]').val();
var formData = new FormData();
$.extend(formData, { '__RequestVerificationToken': token });
$.extend(formData, { 'DNTCaptchaInputText': DNTCaptchaInputText });
$.extend(formData, { 'DNTCaptchaText': DNTCaptchaText });
$.extend(formData, { 'DNTCaptchaToken': DNTCaptchaToken });
$.each($(obj).find("input[type='file']"), function (i, tag) {
$.each($(tag)[0].files, function (i, file) {
formData.append(tag.name, file);
});
});
var params = $(obj).serializeArray();
$.each(params, function (i, val) {
formData.append(val.name, val.value);
});
return formData;
};
})(jQuery);
use:
$.ajax({
type: "POST",
url: 'YOUR-URL',
data: ('form[name="YOUR-Form-Name"]').serializefiles(),
processData: false,
contentType: false,
success: function (data, status, xhr) {
if (xhr.status == 403) {
window.location = '/login'; //در حالت لاگین نبودن شخص اجرا میشود
}
else if (status === 'error' || !data) {
alert('error');
}
else {
alert('complate');
}
}
});
Hello
I can't define new font for captcha, and always read that from system fonts
asp-font-name="Vazir"
not worked actually, although this font existed in styles and appended to my project.
where we can set new font?
بعد از مدتی که یه صفحه باز بمونه و بخوایم کیچا رو رفرش کنیم خطای 500 میده
اگر صفحه رو رفرش کنیم مشکلش حل میشه
DNTCaptcha.Core version: 1.9.5
.NET Core SDK version: 2.2, net 4.8
IDE: visual studio 16.2.5
paste your core code
Exception message:
HTTP500: SERVER ERROR - The server encountered an unexpected condition that prevented it from fulfilling the request.
(XHR)POST - https://localhost:44357/dntcaptchaimage/refresh?data=CfDJ8DB9vg-EjNhHuYHkC4MDpXnsMGLJrFpv28wEoOPJ_SLHKP2Uq4AJPgJuVy-laRJ855XyeXeRbmCL1y40xJuzIxjiMIS8S828y51HKbv2QiOmOuR-j7Wl1mUjCFJnoy2trtV-_O6xhBMtY1GQb-JYwAlsZOAyq1hjdV_Fybj6HGFk7sp0YdmM_ryfm2isuWPmRg
Full Stack trace:
System.NullReferenceException: Object reference not set to an instance of an object.
at DNTCaptcha.Core.DNTCaptchaImageController.invalidateToken(DNTCaptchaTagHelperHtmlAttributes model)
at DNTCaptcha.Core.DNTCaptchaImageController.Refresh(String data)
at lambda_method(Closure , Object , Object[] )
at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextActionFilterAsync>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeInnerFilterAsync>d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeNextResourceFilter>d__23.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeFilterPipelineAsync>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeAsync>d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.<Invoke>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.<Invoke>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.<Invoke>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.ResponseCaching.ResponseCachingMiddleware.<Invoke>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.<Invoke>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Builder.Extensions.MapWhenMiddleware.<Invoke>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Builder.Extensions.MapWhenMiddleware.<Invoke>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.<Invoke>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Web.BrowserLink.BrowserLinkMiddleware.<ExecuteWithFilter>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.<Invoke>d__7.MoveNext()
سلام
در صورتی که بخوایم از کپچا در بوتسرپ نسخه 4 استفاده کنیم آیا امکانش وجود داره؟
با توجه به اینکه در نسخه 4 بوتسرپ ایکن های
glyphicon
دیگه وجود نداره و در کپچا هم امکان قرار دادن تمپلیت برای ایکن رفرش وجود نداره؟
Is possible this captcha implemented on Angular ?
I used DNTIdentityCore and got 2 different error on macOs and Docker.
On macOs(latest Mono Installed already) :
Exception: The type initializer for 'System.Drawing.KnownColors' threw an exception.</h1> at System.Drawing.KnownColors.FromKnownColor(KnownColor kc) at System.Drawing.ColorConverter.StaticConvertFromString(ITypeDescriptorContext context, String s, CultureInfo culture) at System.Drawing.ColorConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value) at System.Drawing.ColorTranslator.FromHtml(String htmlColor) at DNTCaptcha.Core.Providers.CaptchaImageProvider.DrawCaptcha(String message, String foreColor, String backColor, Single fontSize, String fontName) at DNTCaptcha.Core.DNTCaptchaImageController.Show(String text, String rndDate, String foreColor, String backColor, Single fontSize, String fontName)
And on Docker (USE microsoft/aspnetcore-build:1.1.1) :
`info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1]
Executing action method DNTCaptcha.Core.DNTCaptchaImageController.Show (DNTCaptcha.Core) with arguments (CfDJ8AUyVhOCtYhBqsBayGrsMEg6ZEKonj8Yu4zyLjktNB8GB1aWxuLw9zhe3cuRfPfMiOi/F2sTu/8TXeYBrtMG42XJ2TPsiPDrmOU19aetv6kfg+YXpQu7Jy3vFg1RG3I9gY0ugsP2zH5Cb5uu15Zr50A=, 636275045063773290, black, #ccc, 20, Tahoma) - ModelState is Valid
info: Microsoft.AspNetCore.Mvc.StatusCodeResult[1]
Executing HttpStatusCodeResult, setting HTTP status code 400
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
Executed action DNTCaptcha.Core.DNTCaptchaImageController.Show (DNTCaptcha.Core) in 0.3593ms
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1]
Executing action method IdentityServerWithIdentityCore.Controllers.ErrorController.Index (IdentityServerWithIdentityCore) with arguments (400) - ModelState is Valid
fail: IdentityServerWithIdentityCore.Controllers.ErrorController[0]
Error 400 for GET /DNTCaptchaImage/Show
Accept: image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5
Accept-Encoding: gzip, deflate
Accept-Language: en-us
Cookie: .AspNetCore.Antiforgery.c0metC3jpAQ=CfDJ8AUyVhOCtYhBqsBayGrsMEgQPLfXuennB5AZ9tcxb05LRvGuolVy-ESXwrTXZXhAoBPp-........`
با سلام ، به دلیل وجود GetSalt
امکان ایجاد کپچا توسط درخواست کاربر بامرورگر و درخواست اعتبار سنجی آن توسط یک اپلیکیشن دیگر وجود ندارد آیا امکان دارد که این کپچا بصورت یک سرویس مستقل فقط وظیفه ایجاد و اعتبار سنجی (درخواست از سرویس های دیگر) کپچا را داشته باشد؟
how to resend to refresh DNTCaptcha.Core with jquery.ajax?
سلام
روی دو تا پروژه ی ساده تازه ایجاد شده
net core 2.2 , net 4.8
تست کردم باز همین خطا رو داد
این دلیلش بود که تو باگ ایجاد شده قبلی جزییات نفرستادم
edge 44 , firefox 69 developer
DNTCaptcha.Core version: 1.9.2
.NET Core SDK version: net core 2.2 , net framework 4.8
IDE: visual studio 16.2.3
paste your core code
HTTP400: BAD REQUEST - The request could not be processed by the server due to invalid syntax.
GET - https://localhost:44333/DNTCaptchaImage/Show/CfDJ8DB9vg-EjNhHuYHkC4MDpXn9FS2k-ZuzzPnJ3rx9b2LbtrW-LuVgUrzapIYMrdlJNA6n9s5JUjTAQE8RLmfu8fUFpXgzlSMJR7KcCT6l51xuadDw1-m-qBDI2MkcocksgVA1J5IQoCygwBam-7adM0UE2b5hDZ7ogXt7iFlU90zikYz9NPQpXlFz-UV5bPAF6_CMqytNTvtZDvBjv_WVLCrqcKJdUG68I2CcaM8mdvkBEt5OOyFOq4afytCQO5HUs7MNiRX228CBfiOvRmRQvToIJXLqYgMyN91joznk6VMFBA2f_i8rlIV_8NjE2HtUrRn-XkADFrNZ8DyJ_uVW9Skm308-DADunJhR12urEiRzKez_X1UEv7Z_t6MuANTk8AlU8NwOqKnTjh8zr7PDvljpYbgBeC2DkEGIWqOORK7nvzm9NOqfbYdKZLOI15TmCMF7hD2Al_2MfD-bhT9I1R_lTZbAz_OFdO-xTU16IO_jBbOGLTStryslYPNHrptoYg
Exception message:
The request could not be processed by the server due to invalid syntax.
Full Stack trace: نداره!
Bad Request - Request Too Long
HTTP Error 400. The size of the request headers is too long.
it has chance to occur,when refresh the captcha
Hi,
It would be great if the default validator service could return the reason of invalidation.
I want to have a different error message when cookie is not valid. For example telling user that your login form has been expired.
Based on current validator service I don't have any ways to do this except writing my own validator service.
I think it's really essential for a validator service to return the reason if a captcha entry is not valid.
Thanks in advance
سلام واحترام
در کروم زمانی که از دو کپچا به صورت همزمان در یک صفحه استفاده میکنم با خطای
Found 2 elements with non-unique id #DNTCaptchaInputText
مواجه میشم
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.