AbpSetting kısmı ayarların uygulanması
This commit is contained in:
parent
f56eccee55
commit
921c3c6d35
11 changed files with 141 additions and 72 deletions
|
|
@ -7,7 +7,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ConfigureAwait.Fody" Version="3.4.0" />
|
<PackageReference Include="ConfigureAwait.Fody" Version="3.4.0" PrivateAssets="All" />
|
||||||
<PackageReference Include="Fody" Version="6.9.3">
|
<PackageReference Include="Fody" Version="6.9.3">
|
||||||
<PrivateAssets>All</PrivateAssets>
|
<PrivateAssets>All</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ConfigureAwait.Fody" Version="3.4.0" />
|
<PackageReference Include="ConfigureAwait.Fody" Version="3.4.0" PrivateAssets="All" />
|
||||||
<PackageReference Include="Fody" Version="6.9.3">
|
<PackageReference Include="Fody" Version="6.9.3">
|
||||||
<PrivateAssets>All</PrivateAssets>
|
<PrivateAssets>All</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ConfigureAwait.Fody" Version="3.4.0" />
|
<PackageReference Include="ConfigureAwait.Fody" Version="3.4.0" PrivateAssets="All" />
|
||||||
<PackageReference Include="Fody" Version="6.9.3">
|
<PackageReference Include="Fody" Version="6.9.3">
|
||||||
<PrivateAssets>All</PrivateAssets>
|
<PrivateAssets>All</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ConfigureAwait.Fody" Version="3.4.0" />
|
<PackageReference Include="ConfigureAwait.Fody" Version="3.4.0" PrivateAssets="All" />
|
||||||
<PackageReference Include="Fody" Version="6.9.3">
|
<PackageReference Include="Fody" Version="6.9.3">
|
||||||
<PrivateAssets>All</PrivateAssets>
|
<PrivateAssets>All</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,15 @@ using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Sozsoft.Platform.Extensions;
|
using Sozsoft.Platform.Extensions;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Identity;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
using Volo.Abp;
|
using Volo.Abp;
|
||||||
using Volo.Abp.Domain.Entities;
|
using Volo.Abp.Domain.Entities;
|
||||||
using Volo.Abp.Identity;
|
using Volo.Abp.Identity;
|
||||||
using Volo.Abp.TenantManagement;
|
using Volo.Abp.TenantManagement;
|
||||||
using Volo.Abp.Data;
|
using Volo.Abp.Data;
|
||||||
|
using IdentityUser = Volo.Abp.Identity.IdentityUser;
|
||||||
|
using Sozsoft.Platform.Data.Seeds;
|
||||||
|
|
||||||
namespace Sozsoft.Platform.ListForms.DynamicApi;
|
namespace Sozsoft.Platform.ListForms.DynamicApi;
|
||||||
|
|
||||||
|
|
@ -18,79 +22,128 @@ public class ListFormDynamicApiAppService : PlatformAppService, IListFormDynamic
|
||||||
private readonly ITenantManager tenantManager;
|
private readonly ITenantManager tenantManager;
|
||||||
private readonly IIdentityUserAppService identityUserAppService;
|
private readonly IIdentityUserAppService identityUserAppService;
|
||||||
private readonly IIdentityRoleAppService identityRoleAppService;
|
private readonly IIdentityRoleAppService identityRoleAppService;
|
||||||
|
private readonly IdentityUserManager userManager;
|
||||||
|
private readonly IOptions<IdentityOptions> identityOptions;
|
||||||
|
|
||||||
public ListFormDynamicApiAppService(
|
public ListFormDynamicApiAppService(
|
||||||
ITenantRepository tenantRepository,
|
ITenantRepository tenantRepository,
|
||||||
ITenantManager tenantManager,
|
ITenantManager tenantManager,
|
||||||
IIdentityUserAppService identityUserAppService,
|
IIdentityUserAppService identityUserAppService,
|
||||||
IIdentityRoleAppService identityRoleAppService)
|
IIdentityRoleAppService identityRoleAppService,
|
||||||
|
IdentityUserManager userManager,
|
||||||
|
IOptions<IdentityOptions> identityOptions)
|
||||||
{
|
{
|
||||||
this.tenantRepository = tenantRepository;
|
this.tenantRepository = tenantRepository;
|
||||||
this.tenantManager = tenantManager;
|
this.tenantManager = tenantManager;
|
||||||
this.identityUserAppService = identityUserAppService;
|
this.identityUserAppService = identityUserAppService;
|
||||||
this.identityRoleAppService = identityRoleAppService;
|
this.identityRoleAppService = identityRoleAppService;
|
||||||
|
this.userManager = userManager;
|
||||||
|
this.identityOptions = identityOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Authorize(IdentityPermissions.Users.Create)]
|
[Authorize(IdentityPermissions.Users.Create)]
|
||||||
public async Task PostUserInsertAsync(DynamicApiBaseInput<CreateUpdateUserInput> input)
|
public async Task PostUserInsertAsync(DynamicApiBaseInput<CreateUpdateUserInput> input)
|
||||||
{
|
{
|
||||||
var user = new IdentityUserCreateDto
|
await identityOptions.SetAsync();
|
||||||
{
|
|
||||||
UserName = input.Data.Email,
|
|
||||||
Name = input.Data.Name,
|
|
||||||
Surname = input.Data.Surname,
|
|
||||||
Email = input.Data.Email,
|
|
||||||
PhoneNumber = input.Data.PhoneNumber,
|
|
||||||
IsActive = input.Data.IsActive ?? true,
|
|
||||||
LockoutEnabled = true,
|
|
||||||
Password = input.Data.Password,
|
|
||||||
RoleNames = [], //input.Data.RoleNames,
|
|
||||||
};
|
|
||||||
user.SetProperty(PlatformConsts.AbpIdentity.User.WorkHour, input.Data.WorkHour);
|
|
||||||
user.SetProperty(PlatformConsts.AbpIdentity.User.DepartmentId, input.Data.DepartmentId);
|
|
||||||
user.SetProperty(PlatformConsts.AbpIdentity.User.JobPositionId, input.Data.JobPositionId);
|
|
||||||
|
|
||||||
await identityUserAppService.CreateAsync(user);
|
var verifySetting = await SettingProvider.GetOrNullAsync(PlatformConsts.AbpIdentity.Profile.General.RequireVerifiedAccount);
|
||||||
|
var verify = !string.Equals(verifySetting, "true", StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
var phoneSetting = await SettingProvider.GetOrNullAsync(PlatformConsts.AbpIdentity.SignIn.RequireConfirmedPhoneNumber);
|
||||||
|
var phoneVerified = !string.Equals(phoneSetting, "true", StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
var user = new IdentityUser(
|
||||||
|
GuidGenerator.Create(),
|
||||||
|
input.Data.Email,
|
||||||
|
input.Data.Email,
|
||||||
|
CurrentTenant.Id)
|
||||||
|
{
|
||||||
|
Name = input.Data.Name,
|
||||||
|
Surname = input.Data.Surname
|
||||||
|
};
|
||||||
|
|
||||||
|
user.SetIsActive(input.Data.IsActive ?? true);
|
||||||
|
user.SetPhoneNumber(input.Data.PhoneNumber, phoneVerified);
|
||||||
|
user.SetWorkHour(input.Data.WorkHour);
|
||||||
|
user.SetDepartmentId(ParseGuid(input.Data.DepartmentId));
|
||||||
|
user.SetJobPositionId(ParseGuid(input.Data.JobPositionId));
|
||||||
|
user.SetIsVerified(verify);
|
||||||
|
|
||||||
|
(await userManager.CreateAsync(user, input.Data.Password)).CheckErrors();
|
||||||
|
await userManager.SetLockoutEnabledAsync(user, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Guid ParseGuid(string value)
|
||||||
|
{
|
||||||
|
return Guid.TryParse(value, out var id) ? id : Guid.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Authorize(IdentityPermissions.Users.Update)]
|
[Authorize(IdentityPermissions.Users.Update)]
|
||||||
public async Task PostUserUpdateAsync(DynamicApiBaseInput<CreateUpdateUserInput> input)
|
public async Task PostUserUpdateAsync(DynamicApiBaseInput<CreateUpdateUserInput> input)
|
||||||
{
|
{
|
||||||
|
await identityOptions.SetAsync();
|
||||||
|
|
||||||
if (input.Keys.IsNullOrEmpty())
|
if (input.Keys.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
throw new UserFriendlyException(L["RecordNotFound"]);
|
throw new UserFriendlyException(L["RecordNotFound"]);
|
||||||
}
|
}
|
||||||
var id = Guid.Parse(input.Keys[0]!.ToString()!);
|
var id = Guid.Parse(input.Keys[0]!.ToString()!);
|
||||||
var entity = await identityUserAppService.GetAsync(id) ?? throw new EntityNotFoundException(L["RecordNotFound"]);
|
var user = await userManager.GetByIdAsync(id);
|
||||||
var user = new IdentityUserUpdateDto
|
if (user == null)
|
||||||
{
|
{
|
||||||
UserName = input.Data.Email ?? entity.Email,
|
throw new EntityNotFoundException(L["RecordNotFound"]);
|
||||||
Email = input.Data.Email ?? entity.Email,
|
|
||||||
Name = input.Data.Name ?? entity.Name,
|
|
||||||
Surname = input.Data.Surname ?? entity.Surname,
|
|
||||||
PhoneNumber = input.Data.PhoneNumber ?? entity.PhoneNumber,
|
|
||||||
IsActive = input.Data.IsActive ?? entity.IsActive,
|
|
||||||
LockoutEnabled = input.Data.LockoutEnabled ?? entity.LockoutEnabled,
|
|
||||||
//RoleNames = input.Data.RoleNames ?? identity.RoleNames,
|
|
||||||
};
|
|
||||||
if (!input.Data.Password.IsNullOrWhiteSpace())
|
|
||||||
{
|
|
||||||
user.Password = input.Data.Password;
|
|
||||||
}
|
|
||||||
if (input.Data.WorkHour != null)
|
|
||||||
{
|
|
||||||
user.SetProperty(PlatformConsts.AbpIdentity.User.WorkHour, input.Data.WorkHour);
|
|
||||||
}
|
|
||||||
if (input.Data.DepartmentId != null)
|
|
||||||
{
|
|
||||||
user.SetProperty(PlatformConsts.AbpIdentity.User.DepartmentId, input.Data.DepartmentId);
|
|
||||||
}
|
|
||||||
if (input.Data.JobPositionId != null)
|
|
||||||
{
|
|
||||||
user.SetProperty(PlatformConsts.AbpIdentity.User.JobPositionId, input.Data.JobPositionId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await identityUserAppService.UpdateAsync(id, user);
|
if (!input.Data.Email.IsNullOrWhiteSpace() && input.Data.Email != user.Email)
|
||||||
|
{
|
||||||
|
(await userManager.SetUserNameAsync(user, input.Data.Email)).CheckErrors();
|
||||||
|
(await userManager.SetEmailAsync(user, input.Data.Email)).CheckErrors();
|
||||||
|
}
|
||||||
|
|
||||||
|
user.Name = input.Data.Name ?? user.Name;
|
||||||
|
user.Surname = input.Data.Surname ?? user.Surname;
|
||||||
|
|
||||||
|
if (input.Data.PhoneNumber != null)
|
||||||
|
{
|
||||||
|
user.SetPhoneNumber(input.Data.PhoneNumber, user.PhoneNumberConfirmed);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input.Data.IsActive.HasValue)
|
||||||
|
{
|
||||||
|
user.SetIsActive(input.Data.IsActive.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input.Data.LockoutEnabled.HasValue)
|
||||||
|
{
|
||||||
|
(await userManager.SetLockoutEnabledAsync(user, input.Data.LockoutEnabled.Value)).CheckErrors();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!input.Data.Password.IsNullOrWhiteSpace())
|
||||||
|
{
|
||||||
|
if (await userManager.HasPasswordAsync(user))
|
||||||
|
{
|
||||||
|
(await userManager.RemovePasswordAsync(user)).CheckErrors();
|
||||||
|
}
|
||||||
|
|
||||||
|
(await userManager.AddPasswordAsync(user, input.Data.Password)).CheckErrors();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input.Data.WorkHour != null)
|
||||||
|
{
|
||||||
|
user.SetWorkHour(input.Data.WorkHour);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input.Data.DepartmentId != null)
|
||||||
|
{
|
||||||
|
user.SetDepartmentId(ParseGuid(input.Data.DepartmentId));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input.Data.JobPositionId != null)
|
||||||
|
{
|
||||||
|
user.SetJobPositionId(ParseGuid(input.Data.JobPositionId));
|
||||||
|
}
|
||||||
|
|
||||||
|
(await userManager.UpdateAsync(user)).CheckErrors();
|
||||||
}
|
}
|
||||||
|
|
||||||
//RoleAppService
|
//RoleAppService
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,9 @@
|
||||||
"code": "Abp.Localization.DefaultLanguage",
|
"code": "Abp.Localization.DefaultLanguage",
|
||||||
"nameKey": "Abp.Localization.DefaultLanguage",
|
"nameKey": "Abp.Localization.DefaultLanguage",
|
||||||
"descriptionKey": "Abp.Localization.DefaultLanguage.Description",
|
"descriptionKey": "Abp.Localization.DefaultLanguage.Description",
|
||||||
"defaultValue": "tr",
|
"defaultValue": "en",
|
||||||
"isVisibleToClients": false,
|
"isVisibleToClients": false,
|
||||||
"providers": "T|G|D",
|
"providers": "G|D",
|
||||||
"isInherited": false,
|
"isInherited": false,
|
||||||
"isEncrypted": false,
|
"isEncrypted": false,
|
||||||
"mainGroupKey": "App.SiteManagement",
|
"mainGroupKey": "App.SiteManagement",
|
||||||
|
|
@ -48,7 +48,7 @@
|
||||||
"descriptionKey": "Abp.Timing.TimeZone.Description",
|
"descriptionKey": "Abp.Timing.TimeZone.Description",
|
||||||
"defaultValue": "Turkey Standard Time",
|
"defaultValue": "Turkey Standard Time",
|
||||||
"isVisibleToClients": false,
|
"isVisibleToClients": false,
|
||||||
"providers": "T|G|D",
|
"providers": "G|D",
|
||||||
"isInherited": false,
|
"isInherited": false,
|
||||||
"isEncrypted": false,
|
"isEncrypted": false,
|
||||||
"mainGroupKey": "App.SiteManagement",
|
"mainGroupKey": "App.SiteManagement",
|
||||||
|
|
@ -642,7 +642,7 @@
|
||||||
"code": "Abp.Account.IsSelfRegistrationEnabled",
|
"code": "Abp.Account.IsSelfRegistrationEnabled",
|
||||||
"nameKey": "Abp.Account.IsSelfRegistrationEnabled",
|
"nameKey": "Abp.Account.IsSelfRegistrationEnabled",
|
||||||
"descriptionKey": "Abp.Account.IsSelfRegistrationEnabled.Description",
|
"descriptionKey": "Abp.Account.IsSelfRegistrationEnabled.Description",
|
||||||
"defaultValue": "True",
|
"defaultValue": "False",
|
||||||
"isVisibleToClients": false,
|
"isVisibleToClients": false,
|
||||||
"providers": "G|D",
|
"providers": "G|D",
|
||||||
"isInherited": false,
|
"isInherited": false,
|
||||||
|
|
@ -754,8 +754,8 @@
|
||||||
"code": "Abp.Identity.Profile.General.RequireVerifiedAccount",
|
"code": "Abp.Identity.Profile.General.RequireVerifiedAccount",
|
||||||
"nameKey": "Abp.Identity.Profile.General.RequireVerifiedAccount",
|
"nameKey": "Abp.Identity.Profile.General.RequireVerifiedAccount",
|
||||||
"descriptionKey": "Abp.Identity.Profile.General.RequireVerifiedAccount.Description",
|
"descriptionKey": "Abp.Identity.Profile.General.RequireVerifiedAccount.Description",
|
||||||
"defaultValue": "True",
|
"defaultValue": "False",
|
||||||
"isVisibleToClients": false,
|
"isVisibleToClients": true,
|
||||||
"providers": "T|G|D",
|
"providers": "T|G|D",
|
||||||
"isInherited": false,
|
"isInherited": false,
|
||||||
"isEncrypted": false,
|
"isEncrypted": false,
|
||||||
|
|
@ -995,7 +995,7 @@
|
||||||
"nameKey": "Abp.Identity.User.IsUserNameUpdateEnabled",
|
"nameKey": "Abp.Identity.User.IsUserNameUpdateEnabled",
|
||||||
"descriptionKey": "Abp.Identity.User.IsUserNameUpdateEnabled.Description",
|
"descriptionKey": "Abp.Identity.User.IsUserNameUpdateEnabled.Description",
|
||||||
"defaultValue": "True",
|
"defaultValue": "True",
|
||||||
"isVisibleToClients": false,
|
"isVisibleToClients": true,
|
||||||
"providers": "G|D",
|
"providers": "G|D",
|
||||||
"isInherited": false,
|
"isInherited": false,
|
||||||
"isEncrypted": false,
|
"isEncrypted": false,
|
||||||
|
|
@ -1011,7 +1011,7 @@
|
||||||
"nameKey": "Abp.Identity.User.IsEmailUpdateEnabled",
|
"nameKey": "Abp.Identity.User.IsEmailUpdateEnabled",
|
||||||
"descriptionKey": "Abp.Identity.User.IsEmailUpdateEnabled.Description",
|
"descriptionKey": "Abp.Identity.User.IsEmailUpdateEnabled.Description",
|
||||||
"defaultValue": "True",
|
"defaultValue": "True",
|
||||||
"isVisibleToClients": false,
|
"isVisibleToClients": true,
|
||||||
"providers": "G|D",
|
"providers": "G|D",
|
||||||
"isInherited": false,
|
"isInherited": false,
|
||||||
"isEncrypted": false,
|
"isEncrypted": false,
|
||||||
|
|
|
||||||
|
|
@ -797,7 +797,7 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep
|
||||||
PermissionJson = DefaultPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, listFormName, PlatformConsts.IdentityPermissions.Users.Update, PlatformConsts.IdentityPermissions.Users.Delete, PlatformConsts.IdentityPermissions.Users.Export, PlatformConsts.IdentityPermissions.Users.Import, PlatformConsts.IdentityPermissions.Users.Note),
|
PermissionJson = DefaultPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, listFormName, PlatformConsts.IdentityPermissions.Users.Update, PlatformConsts.IdentityPermissions.Users.Delete, PlatformConsts.IdentityPermissions.Users.Export, PlatformConsts.IdentityPermissions.Users.Import, PlatformConsts.IdentityPermissions.Users.Note),
|
||||||
DeleteCommand = $"UPDATE \"AbpUsers\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id",
|
DeleteCommand = $"UPDATE \"AbpUsers\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id",
|
||||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson(),
|
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson(),
|
||||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 600, true, true, true, true, false),
|
EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 730, true, true, true, true, false),
|
||||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
|
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
|
||||||
new () { Order=1,ColCount=1,ColSpan=1,ItemType="group",Items=[
|
new () { Order=1,ColCount=1,ColSpan=1,ItemType="group",Items=[
|
||||||
new EditingFormItemDto { Order=1, DataField="Email", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxTextBox },
|
new EditingFormItemDto { Order=1, DataField="Email", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxTextBox },
|
||||||
|
|
@ -980,6 +980,7 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep
|
||||||
IsActive = true,
|
IsActive = true,
|
||||||
|
|
||||||
AllowSearch = true,
|
AllowSearch = true,
|
||||||
|
ValidationRuleJson = DefaultValidationRuleRequiredJson,
|
||||||
EditorOptions = EditorOptionValues.PhoneEditorOptions,
|
EditorOptions = EditorOptionValues.PhoneEditorOptions,
|
||||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||||
PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false),
|
PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false),
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,13 @@ public static class PlatformConsts
|
||||||
{
|
{
|
||||||
public const string GroupName = $"{Prefix.Abp}.Identity";
|
public const string GroupName = $"{Prefix.Abp}.Identity";
|
||||||
|
|
||||||
|
public static class SignIn
|
||||||
|
{
|
||||||
|
public const string Default = GroupName + ".SignIn";
|
||||||
|
public const string RequireConfirmedEmail = Default + ".RequireConfirmedEmail";
|
||||||
|
public const string RequireConfirmedPhoneNumber = Default + ".RequireConfirmedPhoneNumber";
|
||||||
|
}
|
||||||
|
|
||||||
public static class Profile
|
public static class Profile
|
||||||
{
|
{
|
||||||
public const string Default = GroupName + ".Profile";
|
public const string Default = GroupName + ".Profile";
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ import { ProfileDto, UpdateProfileDto } from '@/proxy/account/models'
|
||||||
import { getProfile, updateProfile } from '@/services/account.service'
|
import { getProfile, updateProfile } from '@/services/account.service'
|
||||||
import { CountryDto, getCountry } from '@/services/home.service'
|
import { CountryDto, getCountry } from '@/services/home.service'
|
||||||
import { SelectBoxOption } from '@/types/shared'
|
import { SelectBoxOption } from '@/types/shared'
|
||||||
|
import { useSetting } from '@/utils/hooks/useSetting'
|
||||||
|
|
||||||
const schema = Yup.object().shape({
|
const schema = Yup.object().shape({
|
||||||
name: Yup.string().min(3).max(50).required(),
|
name: Yup.string().min(3).max(50).required(),
|
||||||
|
|
@ -50,6 +51,9 @@ const General = () => {
|
||||||
const auth = useStoreState((state) => state.auth)
|
const auth = useStoreState((state) => state.auth)
|
||||||
const { setUser } = useStoreActions((actions) => actions.auth.user)
|
const { setUser } = useStoreActions((actions) => actions.auth.user)
|
||||||
|
|
||||||
|
const { setting } = useSetting()
|
||||||
|
const isEmailUpdateEnabled = setting('Abp.Identity.User.IsEmailUpdateEnabled')
|
||||||
|
|
||||||
const { translate } = useLocalization()
|
const { translate } = useLocalization()
|
||||||
const cropperRef = useRef<CropperRef>(null)
|
const cropperRef = useRef<CropperRef>(null)
|
||||||
const previewRef = useRef<CropperPreviewRef>(null)
|
const previewRef = useRef<CropperPreviewRef>(null)
|
||||||
|
|
@ -243,7 +247,7 @@ const General = () => {
|
||||||
<FormItem label={translate('::Abp.Account.EmailAddress')}>
|
<FormItem label={translate('::Abp.Account.EmailAddress')}>
|
||||||
<Input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
disabled
|
disabled={isEmailUpdateEnabled?.toLowerCase() !== 'true'}
|
||||||
prefix={<FaEnvelope className="text-xl" />}
|
prefix={<FaEnvelope className="text-xl" />}
|
||||||
value={profileData?.email}
|
value={profileData?.email}
|
||||||
></Input>
|
></Input>
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,7 @@ import { AdaptableCard, ConfirmDialog, Container } from '@/components/shared'
|
||||||
import { AssignedClaimViewModel, UserInfoViewModel } from '@/proxy/admin/models'
|
import { AssignedClaimViewModel, UserInfoViewModel } from '@/proxy/admin/models'
|
||||||
import { APP_NAME, AVATAR_URL } from '@/constants/app.constant'
|
import { APP_NAME, AVATAR_URL } from '@/constants/app.constant'
|
||||||
import { useStoreActions, useStoreState } from '@/store'
|
import { useStoreActions, useStoreState } from '@/store'
|
||||||
|
import { useSetting } from '@/utils/hooks/useSetting'
|
||||||
|
|
||||||
export interface ClaimTypeDto {
|
export interface ClaimTypeDto {
|
||||||
claimType: string
|
claimType: string
|
||||||
|
|
@ -100,6 +101,8 @@ function UserDetails() {
|
||||||
const previewRef = useRef<CropperPreviewRef>(null)
|
const previewRef = useRef<CropperPreviewRef>(null)
|
||||||
const auth = useStoreState((state) => state.auth)
|
const auth = useStoreState((state) => state.auth)
|
||||||
const { setUser } = useStoreActions((actions) => actions.auth.user)
|
const { setUser } = useStoreActions((actions) => actions.auth.user)
|
||||||
|
const { setting } = useSetting()
|
||||||
|
const isEmailUpdateEnabled = setting('Abp.Identity.User.IsEmailUpdateEnabled')
|
||||||
|
|
||||||
const getUser = async (syncAvatar = true) => {
|
const getUser = async (syncAvatar = true) => {
|
||||||
const { data } = await getUserDetail(userId || '')
|
const { data } = await getUserDetail(userId || '')
|
||||||
|
|
@ -296,7 +299,7 @@ function UserDetails() {
|
||||||
<FormItem label={translate('::Abp.Account.EmailAddress')}>
|
<FormItem label={translate('::Abp.Account.EmailAddress')}>
|
||||||
<Field
|
<Field
|
||||||
type="text"
|
type="text"
|
||||||
disabled
|
disabled={isEmailUpdateEnabled?.toLowerCase() !== 'true'}
|
||||||
name="email"
|
name="email"
|
||||||
placeholder="Email Address"
|
placeholder="Email Address"
|
||||||
prefix={<FaEnvelope className="text-xl" />}
|
prefix={<FaEnvelope className="text-xl" />}
|
||||||
|
|
@ -515,13 +518,7 @@ function UserDetails() {
|
||||||
) : (
|
) : (
|
||||||
<img
|
<img
|
||||||
className="cropper max-h-[300px] max-w-[300px]"
|
className="cropper max-h-[300px] max-w-[300px]"
|
||||||
src={
|
src={image || AVATAR_URL(values.id, values.tenantId)}
|
||||||
image ||
|
|
||||||
AVATAR_URL(
|
|
||||||
values.id,
|
|
||||||
values.tenantId,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<div className="flex items-start gap-4">
|
<div className="flex items-start gap-4">
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import { useNavigate } from 'react-router-dom'
|
||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
import { Helmet } from 'react-helmet'
|
import { Helmet } from 'react-helmet'
|
||||||
import { APP_NAME } from '@/constants/app.constant'
|
import { APP_NAME } from '@/constants/app.constant'
|
||||||
|
import { useSetting } from '@/utils/hooks/useSetting'
|
||||||
|
|
||||||
type SignInFormSchema = {
|
type SignInFormSchema = {
|
||||||
userName: string
|
userName: string
|
||||||
|
|
@ -62,6 +63,9 @@ const Login = () => {
|
||||||
}, 100)
|
}, 100)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { setting } = useSetting()
|
||||||
|
const isSelfRegistrationEnabled = setting('Abp.Account.IsSelfRegistrationEnabled')
|
||||||
|
|
||||||
const { signIn } = useAuth()
|
const { signIn } = useAuth()
|
||||||
const { translate } = useLocalization()
|
const { translate } = useLocalization()
|
||||||
|
|
||||||
|
|
@ -283,12 +287,15 @@ const Login = () => {
|
||||||
<Button block loading={isSubmitting} variant="solid" type="submit">
|
<Button block loading={isSubmitting} variant="solid" type="submit">
|
||||||
{isSubmitting ? 'Signing in...' : 'Sign In'}
|
{isSubmitting ? 'Signing in...' : 'Sign In'}
|
||||||
</Button>
|
</Button>
|
||||||
{/* <div className="mt-4 text-center">
|
|
||||||
|
{isSelfRegistrationEnabled === 'true' && (
|
||||||
|
<div className="mt-4 text-center">
|
||||||
<span>{translate('::Abp.Account.SignUp.Message')} </span>
|
<span>{translate('::Abp.Account.SignUp.Message')} </span>
|
||||||
<ActionLink to={ROUTES_ENUM.authenticated.register}>
|
<ActionLink to={ROUTES_ENUM.authenticated.register}>
|
||||||
{translate('::Abp.Account.Register')}
|
{translate('::Abp.Account.Register')}
|
||||||
</ActionLink>
|
</ActionLink>
|
||||||
</div> */}
|
</div>
|
||||||
|
)}
|
||||||
</FormContainer>
|
</FormContainer>
|
||||||
</Form>
|
</Form>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue