mirror of https://github.com/abpframework/abp.git
30 changed files with 258 additions and 14 deletions
@ -0,0 +1,16 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
|
|||
namespace Volo.Abp.Identity |
|||
{ |
|||
public class UpdatePersonalSettingsDto |
|||
{ |
|||
[StringLength(IdentityUserConsts.MaxNameLength)] |
|||
public string Name { get; set; } |
|||
|
|||
[StringLength(IdentityUserConsts.MaxSurnameLength)] |
|||
public string Surname { get; set; } |
|||
|
|||
[StringLength(IdentityUserConsts.MaxPhoneNumberLength)] |
|||
public string PhoneNumber { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
@page |
|||
@using Microsoft.AspNetCore.Mvc.Localization |
|||
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal |
|||
@using Volo.Abp.Identity.Localization |
|||
@using Volo.Abp.Identity.Web.Pages.Identity.Shared |
|||
@model PersonalSettingsModal |
|||
@inject IHtmlLocalizer<IdentityResource> L |
|||
@{ |
|||
Layout = null; |
|||
} |
|||
|
|||
<abp-dynamic-form abp-model="@Model.PersonalSettingsInfoModel" asp-page="/Identity/Shared/PersonalSettingsModal"> |
|||
<abp-modal> |
|||
<abp-modal-header title="@L["PersonalSettings"].Value"></abp-modal-header> |
|||
<abp-modal-body> |
|||
<abp-form-content /> |
|||
</abp-modal-body> |
|||
<abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"></abp-modal-footer> |
|||
</abp-modal> |
|||
</abp-dynamic-form> |
|||
@ -0,0 +1,64 @@ |
|||
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; |
|||
|
|||
namespace Volo.Abp.Identity.Web.Pages.Identity.Shared |
|||
{ |
|||
public class PersonalSettingsModal : AbpPageModel |
|||
{ |
|||
[BindProperty] |
|||
public PersonalSettingsInfoModel PersonalSettingsInfoModel { get; set; } |
|||
|
|||
private readonly IIdentityUserAppService _userAppService; |
|||
|
|||
public PersonalSettingsModal(IIdentityUserAppService userAppService) |
|||
{ |
|||
_userAppService = userAppService; |
|||
} |
|||
|
|||
public async Task OnGetAsync() |
|||
{ |
|||
if (!CurrentUser.Id.HasValue) |
|||
{ |
|||
throw new AuthenticationException(); |
|||
} |
|||
|
|||
var user = await _userAppService.GetAsync(CurrentUser.Id.Value); |
|||
|
|||
PersonalSettingsInfoModel = ObjectMapper.Map<IdentityUserDto, PersonalSettingsInfoModel>(user); |
|||
} |
|||
|
|||
public async Task<IActionResult> OnPostAsync() |
|||
{ |
|||
ValidateModel(); |
|||
|
|||
var updateDto = ObjectMapper.Map<PersonalSettingsInfoModel, UpdatePersonalSettingsDto>(PersonalSettingsInfoModel); |
|||
|
|||
await _userAppService.UpdatePersonalSettingsAsync(updateDto); |
|||
|
|||
return NoContent(); |
|||
} |
|||
} |
|||
|
|||
public class PersonalSettingsInfoModel |
|||
{ |
|||
[Required] |
|||
[StringLength(IdentityUserConsts.MaxNameLength)] |
|||
[Display(Name = "DisplayName:Name")] |
|||
public string Name { get; set; } |
|||
|
|||
[Required] |
|||
[StringLength(IdentityUserConsts.MaxSurnameLength)] |
|||
[Display(Name = "DisplayName:Surname")] |
|||
public string Surname { get; set; } |
|||
|
|||
[Required] |
|||
[StringLength(IdentityUserConsts.MaxPhoneNumberLength)] |
|||
[Display(Name = "DisplayName:PhoneNumber")] |
|||
public string PhoneNumber { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
(function ($) { |
|||
|
|||
var l = abp.localization.getResource('AbpIdentity'); |
|||
var _personalSettingsModal = new abp.ModalManager(abp.appPath + 'Identity/Shared/PersonalSettingsModal'); |
|||
|
|||
$(function () { |
|||
|
|||
$("#abp-account-personal-settings").click(function (e) { |
|||
e.preventDefault(); |
|||
_personalSettingsModal.open(); |
|||
}); |
|||
|
|||
_personalSettingsModal.onResult(function () { |
|||
//abp.message.success(l("PersonalSettingsSavedMessage"));
|
|||
}); |
|||
}); |
|||
|
|||
})(jQuery); |
|||
Loading…
Reference in new issue