diff --git a/src/Application/Features/Identity/DTOs/ApplicationUserDto.cs b/src/Application/Features/Identity/DTOs/ApplicationUserDto.cs index 44d86597..b8d009cd 100644 --- a/src/Application/Features/Identity/DTOs/ApplicationUserDto.cs +++ b/src/Application/Features/Identity/DTOs/ApplicationUserDto.cs @@ -78,6 +78,7 @@ public Mapping() .ForMember(x => x.SuperiorName, s => s.MapFrom(y => y.Superior!.UserName)) .ForMember(x => x.TenantName, s => s.MapFrom(y => y.Tenant!.Name)) .ForMember(x => x.AssignedRoles, s => s.MapFrom(y => y.UserRoles.Select(r => r.Role.Name))) + .ForMember(x => x.PhoneNumber, s => s.MapFrom(x => x.PhoneNumber)) .ReverseMap() .ForMember(x => x.UserName, s => s.MapFrom(y => y.Email)) .ForMember(x => x.Notes, s => s.Ignore()) diff --git a/src/Server.UI/Pages/Identity/Users/Users.razor b/src/Server.UI/Pages/Identity/Users/Users.razor index 2b4a8c14..edc0d51a 100644 --- a/src/Server.UI/Pages/Identity/Users/Users.razor +++ b/src/Server.UI/Pages/Identity/Users/Users.razor @@ -389,8 +389,8 @@ policies ??= new() { { SecurityPolicies.SystemFunctionsWrite, (await AuthService.AuthorizeAsync(state.User, SecurityPolicies.SystemFunctionsWrite)).Succeeded }, - { SecurityPolicies.Import, (await AuthService.AuthorizeAsync(state.User, SecurityPolicies.Import)).Succeeded }, - { SecurityPolicies.Export, (await AuthService.AuthorizeAsync(state.User, SecurityPolicies.Export)).Succeeded } + { SecurityPolicies.Import, false /*(await AuthService.AuthorizeAsync(state.User, SecurityPolicies.Import)).Succeeded */ }, + { SecurityPolicies.Export, false /* (await AuthService.AuthorizeAsync(state.User, SecurityPolicies.Export)).Succeeded */ } }; _canCreate = policies.GetValueOrDefault(SecurityPolicies.SystemFunctionsWrite); @@ -533,6 +533,8 @@ var applicationUser = Mapper.Map(model); applicationUser.EmailConfirmed = true; applicationUser.IsActive = true; + applicationUser.TwoFactorEnabled = true; + applicationUser.PhoneNumberConfirmed = string.IsNullOrWhiteSpace(applicationUser.PhoneNumber) == false; var identityResult = await UserManager.CreateAsync(applicationUser); if (!identityResult.Succeeded) @@ -556,6 +558,8 @@ Mapper.Map(model, user); + user.PhoneNumberConfirmed = string.IsNullOrWhiteSpace(user.PhoneNumber) == false; + var identityResult = await UserManager.UpdateAsync(user); if (identityResult.Succeeded) {