Hi, here is a simple example:
public class EmailTenantResolveContributor : HttpTenantResolveContributorBase
{
public override string Name => "Email";
protected override string GetTenantIdOrNameFromHttpContextOrNull(ITenantResolveContext context,
HttpContext httpContext)
{
if (httpContext.Request.HasFormContentType &&
httpContext.Request.Path.Value.Contains("Account/Login", StringComparison.InvariantCultureIgnoreCase))
{
var email = (string) httpContext.Request.Form["LoginInput.UserNameOrEmailAddress"];
if (email == null || !email.Contains("@"))
{
return null;
}
return email.Substring(email.IndexOf('@') + 1).Replace(".com", "");
}
return null;
}
}
Add to your module class:
Configure<AbpTenantResolveOptions>(options =>
{
options.TenantResolvers.Insert(0, new EmailTenantResolveContributor());
});
Hi,
viewbag.title
value to custom._ViewImports.cshtml
file in your pages folder.@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling
Here is login.cshtml content
@page
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.Account.Localization
@model Volo.Abp.Account.Public.Web.Pages.Account.LoginModel
@inject IHtmlLocalizer<AccountResource> L
@inject Volo.Abp.AspNetCore.Mvc.UI.Layout.IPageLayout PageLayout
@{
PageLayout.Content.Title = L["Login"].Value;
}
<div class="account-module-form">
@if (Model.EnableLocalLogin)
{
<form method="post">
<input asp-for="ReturnUrl"/>
<input asp-for="ReturnUrlHash"/>
<abp-input asp-for="LoginInput.UserNameOrEmailAddress" required-symbol="false"/>
<abp-input asp-for="LoginInput.Password" required-symbol="false"/>
<abp-row>
<abp-column>
<abp-input asp-for="LoginInput.RememberMe" class="mb-4"/>
</abp-column>
<abp-column class="text-right">
<a href="@Url.Page("./ForgotPassword", new { returnUrl = Model.ReturnUrl, returnUrlHash = Model.ReturnUrlHash })">@L["ForgotPassword"]</a>
</abp-column>
</abp-row>
<abp-button button-type="Primary" size="Block" type="submit" class="mt-2 mb-3" name="Action" value="Login">@L["Login"]</abp-button>
@if (Model.ShowCancelButton)
{
<abp-button button-type="Secondary" size="Block" type="submit" formnovalidate="formnovalidate" class="mt-2 mb-3" name="Action" value="Cancel">@L["Cancel"]</abp-button>
}
</form>
@if (Model.IsSelfRegistrationEnabled)
{
@L["NotAMemberYet"]
<a href="@Url.Page("./Register", new {returnUrl = Model.ReturnUrl, returnUrlHash = Model.ReturnUrlHash})">@L["Register"]</a>
}
}
@if (Model.VisibleExternalProviders.Any())
{
<hr/>
@L["OrSignInWith"]<br/>
<form asp-page="./Login" asp-page-handler="ExternalLogin" asp-route-returnUrl="@Model.ReturnUrl" asp-route-returnUrlHash="@Model.ReturnUrlHash" method="post">
<input asp-for="ReturnUrl"/>
<input asp-for="ReturnUrlHash"/>
@foreach (var provider in Model.VisibleExternalProviders)
{
<button
type="submit"
class="mt-2 mr-2 btn btn-outline-primary btn-sm"
name="provider"
value="@provider.AuthenticationScheme"
data-busy-text="@L["ProcessingWithThreeDot"]">
@if (provider.Icon != null)
{
<i class="@provider.Icon"></i>
}
<span>@provider.DisplayName</span>
</button>
}
</form>
}
@if (!Model.EnableLocalLogin && !Model.VisibleExternalProviders.Any())
{
<div class="alert alert-warning">
<strong>Invalid login request</strong>
There are no login schemes configured for this client.
</div>
}
</div>
Hi,
We are solving this problem, see https://github.com/abpframework/abp/issues/5215.
Hi,
Try:
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IIdentityUserAppService))]
public class MyIdentityUserAppService : IdentityUserAppService
{
public MyIdentityUserAppService(IdentityUserManager userManager, IIdentityUserRepository userRepository, IIdentityRoleRepository roleRepository) : base(userManager, userRepository, roleRepository)
{
}
[AllowAnonymous]
public override async Task<IdentityUserDto> CreateAsync(IdentityUserCreateDto input)
{
var result = await base.CreateAsync(input);
return result;
}
}
Hi,
You just need to follow https://gist.github.com/ebicoglu/ce0f0425bab806d0ee1a87d0073af96b in HttpApi.Host
project
Hi Abp use identityserver native endpoint. see https://identityserver4.readthedocs.io/en/latest/endpoints/token.html
Hi, try:
var tenants = await _tenantRepository.GetListAsync();
var result = await _workRoleTenantAssignments.Where(x => tenants.Select(t => t.Id).Contains(x.TenantId.Value)).ToListAsync();
tenants = tenants.TakeWhile(t => result.Select(r => r.TenantId).Contains(t.Id)).ToList();
Hi,
See https://docs.abp.io/en/abp/latest/UI/AspNetCore/Customization-User-Interface.
You can custom login page in HttpApi.Host
project.