hi
Halil: There is no source code, unfortunately. It is just a simple example, nothing fancy.
hi
Do you have code like below in your FormsHttpApiHostModule?
If so can you share the steps to reproduce this error in a new angular and aspnet core template app?
context.Services.AddCors(options =>
{
options.AddDefaultPolicy(builder =>
{
builder
.WithOrigins(
configuration["App:CorsOrigins"]?
.Split(",", StringSplitOptions.RemoveEmptyEntries)
.Select(o => o.Trim().RemovePostFix("/"))
.ToArray() ?? Array.Empty<string>()
)
.WithAbpExposedHeaders()
.SetIsOriginAllowedToAllowWildcardSubdomains()
.AllowAnyHeader()
.AllowAnyMethod()
.AllowCredentials();
});
});
app.UseCors();
app.UseStaticFiles();
app.UseRouting();
app.UseCors();
hi
Can you share the logs.txt ?
liming.ma@volosoft.com
hi
Http failure response
Please check the browser console/network panel to see if there are any messages.
hi
Replacing ABP's AuthServer with Auth0.
This could break a lot of built-in functionality, and I'm not sure it's feasible.
How do I let the authenticated user see the links and menus post-authentication?
Make sure the ICurrentTenant and ICurrentUser have correct values.
How do I ensure that ICurrentTenant has the correct tenant post-login?
The ICurrentTenant changed from MultiTenancyMiddleware
https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/MultiTenancyMiddleware.cs#L61
How do I ensure that CurrentUser.IsAuthenticated gets updated correctly? I can see that HttpContext.User.IsAuthenticated is equals true, but CurrentUser.IsAuthenticated is always false.
Make sure ICurrentUser gets the correct claim type.
https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.Security/Volo/Abp/Users/CurrentUser.cs#L14 https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.Security/System/Security/Principal/AbpClaimsIdentityExtensions.cs#L35
You can change the AbpClaimTypes values.
eg:
AbpClaimTypes.UserName = JwtClaimTypes.PreferredUserName;
AbpClaimTypes.Name = JwtClaimTypes.GivenName;
AbpClaimTypes.SurName = JwtClaimTypes.FamilyName;
AbpClaimTypes.UserId = JwtClaimTypes.Subject;
AbpClaimTypes.Role = JwtClaimTypes.Role;
AbpClaimTypes.Email = JwtClaimTypes.Email;
hi
You can inject the IPasswordHasher<IdentityUser> service. Then use ObjectHelper to set the protected property.
ObjectHelper.TrySetProperty(identityUser, x => x.PasswordHash, () => your_password);
https://github.com/dotnet/aspnetcore/blob/main/src/Identity/Extensions.Core/src/IPasswordHasher.cs
Thanks. 8.1.1 will be coming soon.
hi
I have updated the code: Disable button before recaptcha is initialized.
From d31de08f1aeaf5918aa97e4e5a141e1814011803 Mon Sep 17 00:00:00 2001
Date: Tue, 16 Apr 2024 09:22:57 +0800
Subject: [PATCH] Disable button before recaptcha is initialized.
---
.../Pages/Account/Login.cshtml | 5 +++--
.../Pages/Account/Login.js | 12 +++++++++++-
.../Pages/Account/Register.cshtml | 5 +++--
.../Pages/Account/Register.js | 12 +++++++++++-
4 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/abp/account/src/Volo.Abp.Account.Pro.Public.Web/Pages/Account/Login.cshtml b/abp/account/src/Volo.Abp.Account.Pro.Public.Web/Pages/Account/Login.cshtml
index 1a6d756715..df7831e351 100644
--- a/abp/account/src/Volo.Abp.Account.Pro.Public.Web/Pages/Account/Login.cshtml
+++ b/abp/account/src/Volo.Abp.Account.Pro.Public.Web/Pages/Account/Login.cshtml
@@ -93,14 +93,15 @@
{
<script>
recaptchaCallback = function (token) {
- $('#@RecaptchaValidatorBase.RecaptchaResponseKey').val(token)
+ $('form button[type=submit]').removeAttr("disabled");
+ $('#@RecaptchaValidatorBase.RecaptchaResponseKey').val(token)
};
</script>
<recaptcha-div-v2 callback="recaptchaCallback"/>
}
<div class="d-grid gap-2">
- <abp-button button-type="Primary" type="submit" class="mb-3" name="Action" value="Login">
+ <abp-button button-type="Primary" type="submit" class="mb-3" name="Action" value="Login" disabled="true">
<i class="bi bi-box-arrow-in-right me-1"></i>
@L["Login"]
</abp-button>
diff --git a/abp/account/src/Volo.Abp.Account.Pro.Public.Web/Pages/Account/Login.js b/abp/account/src/Volo.Abp.Account.Pro.Public.Web/Pages/Account/Login.js
index 18aa0242bc..b1f25f1221 100644
--- a/abp/account/src/Volo.Abp.Account.Pro.Public.Web/Pages/Account/Login.js
+++ b/abp/account/src/Volo.Abp.Account.Pro.Public.Web/Pages/Account/Login.js
@@ -1,8 +1,18 @@
$(function () {
+
+ var isRecaptchaEnabled = typeof grecaptcha !== 'undefined';
+ if (isRecaptchaEnabled) {
+ grecaptcha.ready(function () {
+ $("form button[type=submit]").removeAttr("disabled");
+ });
+ } else {
+ $("form button[type=submit]").removeAttr("disabled");
+ }
+
$("form button[type=submit]").click(function (e) {
e.preventDefault();
var form = $("form");
- if (form.valid() && typeof grecaptcha !== 'undefined' && abp.utils.isFunction(grecaptcha.reExecute)) {
+ if (form.valid() && isRecaptchaEnabled && abp.utils.isFunction(grecaptcha.reExecute)) {
grecaptcha.reExecute(function (token) {
form.find("input[type=hidden][data-captcha=true]").val(token);
form.submit();
diff --git a/abp/account/src/Volo.Abp.Account.Pro.Public.Web/Pages/Account/Register.cshtml b/abp/account/src/Volo.Abp.Account.Pro.Public.Web/Pages/Account/Register.cshtml
index 36c19a41f0..3fb5613942 100644
--- a/abp/account/src/Volo.Abp.Account.Pro.Public.Web/Pages/Account/Register.cshtml
+++ b/abp/account/src/Volo.Abp.Account.Pro.Public.Web/Pages/Account/Register.cshtml
@@ -89,7 +89,8 @@
{
<script>
recaptchaCallback = function (token) {
- $('#@RecaptchaValidatorBase.RecaptchaResponseKey').val(token)
+ $('form button[type=submit]').removeAttr("disabled");
+ $('#@RecaptchaValidatorBase.RecaptchaResponseKey').val(token)
};
</script>
<recaptcha-div-v2 callback="recaptchaCallback"/>
@@ -99,7 +100,7 @@
@if (Model.EnableLocalRegister || Model.IsExternalLogin)
{
<div class="d-grid gap-2">
- <abp-button button-type="Primary" type="submit" class="mt-2 mb-3">@L["Register"]</abp-button>
+ <abp-button button-type="Primary" type="submit" class="mt-2 mb-3" disabled="true">@L["Register"]</abp-button>
</div>
}
diff --git a/abp/account/src/Volo.Abp.Account.Pro.Public.Web/Pages/Account/Register.js b/abp/account/src/Volo.Abp.Account.Pro.Public.Web/Pages/Account/Register.js
index 11bb49dace..187ccd4463 100644
--- a/abp/account/src/Volo.Abp.Account.Pro.Public.Web/Pages/Account/Register.js
+++ b/abp/account/src/Volo.Abp.Account.Pro.Public.Web/Pages/Account/Register.js
@@ -1,8 +1,18 @@
$(function () {
+
+ var isRecaptchaEnabled = typeof grecaptcha !== 'undefined';
+ if (isRecaptchaEnabled) {
+ grecaptcha.ready(function () {
+ $("form button[type=submit]").removeAttr("disabled");
+ });
+ } else {
+ $("form button[type=submit]").removeAttr("disabled");
+ }
+
$("form button[type=submit]").click(function (e) {
e.preventDefault();
var form = $("form");
- if (form.valid() && typeof grecaptcha !== 'undefined' && abp.utils.isFunction(grecaptcha.reExecute)) {
+ if (form.valid() && isRecaptchaEnabled && abp.utils.isFunction(grecaptcha.reExecute)) {
grecaptcha.reExecute(function (token) {
form.find("input[type=hidden][data-captcha=true]").val(token);
form.submit();
hi
I will ask Halil İbrahim Kalkan