|
|
|
@ -1,10 +1,10 @@ |
|
|
|
using System; |
|
|
|
using System.ComponentModel.DataAnnotations; |
|
|
|
using System.Security.Authentication; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
using Microsoft.Extensions.Localization; |
|
|
|
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; |
|
|
|
using Volo.Abp.Identity.Localization; |
|
|
|
using Volo.Abp.Identity.Settings; |
|
|
|
using Volo.Abp.Settings; |
|
|
|
|
|
|
|
namespace Volo.Abp.Identity.Web.Pages.Identity.Shared |
|
|
|
{ |
|
|
|
@ -13,6 +13,18 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Shared |
|
|
|
[BindProperty] |
|
|
|
public PersonalSettingsInfoModel PersonalSettingsInfoModel { get; set; } |
|
|
|
|
|
|
|
[BindProperty] |
|
|
|
public PersonalSettingsInfoModel PersonalSettingsInfoModel2 { get; set; } |
|
|
|
|
|
|
|
public bool IsUsernameUpdateDisabled => !string.Equals( |
|
|
|
SettingManager.GetOrNull(IdentitySettingNames.User.IsUserNameUpdateEnabled), "true", |
|
|
|
StringComparison.OrdinalIgnoreCase); |
|
|
|
|
|
|
|
public bool IsEmailUpdateDisabled => !string.Equals( |
|
|
|
SettingManager.GetOrNull(IdentitySettingNames.User.IsEmailUpdateEnabled), "true", |
|
|
|
StringComparison.OrdinalIgnoreCase); |
|
|
|
|
|
|
|
|
|
|
|
private readonly IProfileAppService _profileAppService; |
|
|
|
|
|
|
|
public PersonalSettingsModal(IProfileAppService profileAppService) |
|
|
|
@ -33,6 +45,24 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Shared |
|
|
|
|
|
|
|
var updateDto = ObjectMapper.Map<PersonalSettingsInfoModel, UpdateProfileDto>(PersonalSettingsInfoModel); |
|
|
|
|
|
|
|
ProfileDto user = null; |
|
|
|
|
|
|
|
if (IsUsernameUpdateDisabled ) |
|
|
|
{ |
|
|
|
user = await _profileAppService.GetAsync(); |
|
|
|
updateDto.UserName = user.UserName; |
|
|
|
} |
|
|
|
|
|
|
|
if (IsEmailUpdateDisabled) |
|
|
|
{ |
|
|
|
if (user == null) |
|
|
|
{ |
|
|
|
user = await _profileAppService.GetAsync(); |
|
|
|
} |
|
|
|
|
|
|
|
updateDto.Email = user.Email; |
|
|
|
} |
|
|
|
|
|
|
|
await _profileAppService.UpdateAsync(updateDto); |
|
|
|
|
|
|
|
return NoContent(); |
|
|
|
|