hi @michael.sudnik
The below code is the patch. I will fix this in 4.0.
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
using Volo.Abp.Account;
using Volo.Abp.Account.Public.Web.Pages.Account;
using Volo.Abp.DependencyInjection;
using IdentityUser = Volo.Abp.Identity.IdentityUser;
namespace MyApp.Web
{
[ExposeServices(typeof(MyRegisterModel), typeof(RegisterModel))]
public class MyRegisterModel : RegisterModel
{
protected override async Task RegisterExternalUserAsync(ExternalLoginInfo externalLoginInfo, string emailAddress)
{
var user = new IdentityUser(GuidGenerator.Create(), emailAddress, emailAddress, CurrentTenant.Id);
(await UserManager.CreateAsync(user)).CheckErrors();
(await UserManager.AddDefaultRolesAsync(user)).CheckErrors();
if (!user.EmailConfirmed)
{
await AccountAppService.SendEmailConfirmationTokenAsync(
new SendEmailConfirmationTokenDto
{
AppName = "MVC",
Email = emailAddress,
ReturnUrl = ReturnUrl,
ReturnUrlHash = ReturnUrlHash
}
);
}
var userLoginAlreadyExists = user.Logins.Any(x =>
x.TenantId == user.TenantId &&
x.LoginProvider == externalLoginInfo.LoginProvider &&
x.ProviderKey == externalLoginInfo.ProviderKey);
if (!userLoginAlreadyExists)
{
user.AddLogin(new UserLoginInfo(
externalLoginInfo.LoginProvider,
externalLoginInfo.ProviderKey,
externalLoginInfo.ProviderDisplayName
)
);
(await UserManager.UpdateAsync(user)).CheckErrors();
}
await SignInManager.SignInAsync(user, isPersistent: true);
}
}
}
hi
It seems there is a problem with mongodb, I will check it. Thank you
hi @rachanee-mwp
You can create a custom ConfigurationSettingValueProvider
then read settings via underscore name
.
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpSettingOptions>(options =>
{
options.ValueProviders.InsertAfter(typeof(ConfigurationSettingValueProvider), typeof(MyConfigurationSettingValueProvider));
});
}
public class MyConfigurationSettingValueProvider : ISettingValueProvider, ITransientDependency
{
public const string ConfigurationNamePrefix = "Settings:";
public const string ProviderName = "MC";
public string Name => ProviderName;
protected IConfiguration Configuration { get; }
public MyConfigurationSettingValueProvider(IConfiguration configuration)
{
Configuration = configuration;
}
public virtual Task<string> GetOrNullAsync(SettingDefinition setting)
{
return Task.FromResult(Configuration[ConfigurationNamePrefix + setting.Name.Replace(".", "_")]);
}
public Task<List<SettingValue>> GetAllAsync(SettingDefinition[] settings)
{
return Task.FromResult(settings.Select(x => new SettingValue(x.Name, Configuration[ConfigurationNamePrefix + x.Name.Replace(".", "_")])).ToList());
}
}
hi
I create a mvc
project using 4.0.0-rc.3
, When I register with my email, it will automatically log in when I log in again.
! 4.0.0 has not yet released the official version, RC is for testing only.
dotnet tool uninstall --global Volo.Abp.Cli && dotnet tool install --global Volo.Abp.Cli --version 4.0.0-rc.3
abp new MyApp -t app-pro -u mvc --mobile none --database-provider ef --csf --preview
hi
I received the mail, I will check, thank you
Do not share the ABP source code and your private NuGet API key If there is a need, please share it to our support staff via email info@abp.io
hi @michael.sudnik
Can you share the ClientId
and ClientSecret
with me? so that I can test it locally.
liming.ma@volosoft.com
hi jason.smith
Can you create a new quesion?
hi
Can you share your external login code and provide a test Microsoft account? liming.ma@volosoft.com
hi @Leaf
Maybe you should access the property of data.record
.
visible : function(data){
//data.record.status
return data.record.xxx == 'New';
}