Browse Source

Merge branch 'master' of https://github.com/volosoft/abp

pull/441/head
Halil ibrahim Kalkan 8 years ago
parent
commit
8c703b5be7
  1. 10
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Menu/Default.cshtml
  2. 12
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/UserMenu/Default.cshtml
  3. 23
      framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/ApplicationMenuItem.cs
  4. 3
      framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/en.json
  5. 3
      framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/tr.json
  6. 4
      modules/account/src/Volo.Abp.Account.Web/AbpAccountUserMenuContributor.cs
  7. 2
      modules/account/src/Volo.Abp.Account.Web/Localization/Resources/AbpAccount/Web/tr.json
  8. 1
      modules/blogging/src/Volo.Blogging.Web/Localization/Resources/Blogging/Web/en.json
  9. 1
      modules/blogging/src/Volo.Blogging.Web/Localization/Resources/Blogging/Web/tr.json
  10. 43
      modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Detail.cshtml
  11. 2
      modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IIdentityUserAppService.cs
  12. 13
      modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs
  13. 3
      modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/Localization/Domain/en.json
  14. 3
      modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/Localization/Domain/tr.json
  15. 6
      modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityUserController.cs
  16. 10
      modules/identity/src/Volo.Abp.Identity.Web/AbpIdentityWebModule.cs
  17. 6
      modules/identity/src/Volo.Abp.Identity.Web/Localization/Resources/AbpIdentity/en.json
  18. 6
      modules/identity/src/Volo.Abp.Identity.Web/Localization/Resources/AbpIdentity/tr.json
  19. 20
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Shared/ChangePasswordModal.cshtml
  20. 61
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Shared/ChangePasswordModal.cshtml.cs
  21. 18
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Shared/change-password-modal.js
  22. 1
      modules/identity/src/Volo.Abp.Identity.Web/Volo.Abp.Identity.Web.csproj

10
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Menu/Default.cshtml

@ -2,6 +2,10 @@
@model ApplicationMenu @model ApplicationMenu
@foreach (var menuItem in Model.Items) @foreach (var menuItem in Model.Items)
{ {
var elementId = string.IsNullOrEmpty(menuItem.ElementId) ? string.Empty : $"id=\"{menuItem.ElementId}\"";
var cssClass = string.IsNullOrEmpty(menuItem.CssClass) ? string.Empty : menuItem.CssClass;
var disabled = menuItem.IsDisabled ? "disabled" : string.Empty;
if (menuItem.IsLeaf) if (menuItem.IsLeaf)
{ {
if (menuItem.Url == null) if (menuItem.Url == null)
@ -9,7 +13,7 @@
continue; continue;
} }
<li class="nav-item @(menuItem.IsDisabled ? "disabled" : "")"> <li class="nav-item @cssClass @disabled" @elementId>
<a class="nav-link" href="@(menuItem.Url ?? "#")"> <a class="nav-link" href="@(menuItem.Url ?? "#")">
@if (menuItem.Icon != null) @if (menuItem.Icon != null)
{ {
@ -29,7 +33,9 @@
<div class="dropdown-menu" aria-labelledby="Menu_@(menuItem.Name)"> <div class="dropdown-menu" aria-labelledby="Menu_@(menuItem.Name)">
@foreach (var childMenuItem in menuItem.Items) @foreach (var childMenuItem in menuItem.Items)
{ {
<a class="dropdown-item" href="@(childMenuItem.Url ?? "#")">@childMenuItem.DisplayName</a> <a class="dropdown-item @cssClass @disabled" href="@(childMenuItem.Url ?? "#")" @Html.Raw(elementId)>
@childMenuItem.DisplayName
</a>
} }
</div> </div>
</li> </li>

12
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/UserMenu/Default.cshtml

@ -11,16 +11,20 @@
<a class="btn btn-link dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <a class="btn btn-link dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
@CurrentUser.UserName @CurrentUser.UserName
</a> </a>
@if (Model.Items.Any()) @if (Model.Items.Any())
{ {
<div class="dropdown-menu" aria-labelledby="dropdownMenuLink"> <div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
@foreach (var menuItem in Model.Items) @foreach (var menuItem in Model.Items)
{ {
<a class="dropdown-item" href="@menuItem.Url">@menuItem.DisplayName</a> var elementId = string.IsNullOrEmpty(menuItem.ElementId) ? string.Empty : $"id=\"{menuItem.ElementId}\"";
} var cssClass = string.IsNullOrEmpty(menuItem.CssClass) ? string.Empty : menuItem.CssClass;
var disabled = menuItem.IsDisabled ? "disabled" : string.Empty;
@*<a class="dropdown-item" href="/Account/Logout">@L["Logout"]</a>*@ <a class="dropdown-item @cssClass @disabled" href="@(menuItem.Url ?? "#")" @Html.Raw(elementId)>
@menuItem.DisplayName
</a>
}
</div> </div>
} }
</div> </div>

23
framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/ApplicationMenuItem.cs

@ -37,7 +37,7 @@ namespace Volo.Abp.UI.Navigation
/// Default value: 1000. /// Default value: 1000.
/// </summary> /// </summary>
public int Order { get; set; } public int Order { get; set; }
/// <summary> /// <summary>
/// The URL to navigate when this menu item is selected. /// The URL to navigate when this menu item is selected.
/// </summary> /// </summary>
@ -65,7 +65,7 @@ namespace Volo.Abp.UI.Navigation
/// Can be used to disable this menu item. /// Can be used to disable this menu item.
/// </summary> /// </summary>
public bool IsDisabled { get; set; } public bool IsDisabled { get; set; }
/// <inheritdoc cref="IHasMenuItems.Items"/> /// <inheritdoc cref="IHasMenuItems.Items"/>
[NotNull] [NotNull]
public IList<ApplicationMenuItem> Items { get; } public IList<ApplicationMenuItem> Items { get; }
@ -75,14 +75,27 @@ namespace Volo.Abp.UI.Navigation
/// </summary> /// </summary>
public object CustomData { get; set; } public object CustomData { get; set; }
/// <summary>
/// Can be used to render the element with a specific Id for DOM selections.
/// </summary>
public string ElementId { get; set; }
/// <summary>
/// Can be used to render the element with extra CSS classes.
/// </summary>
public string CssClass { get; set; }
public ApplicationMenuItem( public ApplicationMenuItem(
[NotNull] string name, [NotNull] string name,
[NotNull] string displayName, [NotNull] string displayName,
string url = null, string url = null,
string icon = null, string icon = null,
int order = DefaultOrder, int order = DefaultOrder,
object customData = null, object customData = null,
string target = null) string target = null,
string elementId = null,
string cssClass = null)
{ {
Check.NotNullOrWhiteSpace(name, nameof(name)); Check.NotNullOrWhiteSpace(name, nameof(name));
Check.NotNullOrWhiteSpace(displayName, nameof(displayName)); Check.NotNullOrWhiteSpace(displayName, nameof(displayName));
@ -94,6 +107,8 @@ namespace Volo.Abp.UI.Navigation
Order = order; Order = order;
CustomData = customData; CustomData = customData;
Target = target; Target = target;
ElementId = elementId;
CssClass = cssClass;
Items = new List<ApplicationMenuItem>(); Items = new List<ApplicationMenuItem>();
} }

3
framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/en.json

@ -33,6 +33,7 @@
"PagerNext": "Next", "PagerNext": "Next",
"PagerPrevious": "Previous", "PagerPrevious": "Previous",
"PagerInfo": "Showing {0} to {1} of {2} entries.", "PagerInfo": "Showing {0} to {1} of {2} entries.",
"DatatableActionDropdownDefaultText": "Actions" "DatatableActionDropdownDefaultText": "Actions",
"ChangePassword": "Change password"
} }
} }

3
framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/tr.json

@ -33,6 +33,7 @@
"PagerNext": "Sonraki", "PagerNext": "Sonraki",
"PagerPrevious": "Önceki", "PagerPrevious": "Önceki",
"PagerInfo": "{2} kayıttan {0} ile {1} arası gösteriliyor.", "PagerInfo": "{2} kayıttan {0} ile {1} arası gösteriliyor.",
"DatatableActionDropdownDefaultText": "İşlemler" "DatatableActionDropdownDefaultText": "İşlemler",
"ChangePassword": "Şifre değiştir"
} }
} }

4
modules/account/src/Volo.Abp.Account.Web/AbpAccountUserMenuContributor.cs

@ -10,7 +10,7 @@ namespace Volo.Abp.Account.Web
{ {
public AbpAccountUserMenuContributor() public AbpAccountUserMenuContributor()
{ {
} }
public Task ConfigureMenuAsync(MenuConfigurationContext context) public Task ConfigureMenuAsync(MenuConfigurationContext context)
@ -22,6 +22,8 @@ namespace Volo.Abp.Account.Web
var l = context.ServiceProvider.GetRequiredService<IStringLocalizer<AbpUiResource>>(); var l = context.ServiceProvider.GetRequiredService<IStringLocalizer<AbpUiResource>>();
context.Menu.AddItem(new ApplicationMenuItem("Account.ChangePassword", l["ChangePassword"], icon: "fa fa-key", url: "#", elementId: "abp-account-change-password"));
context.Menu.AddItem(new ApplicationMenuItem("Account.Logout", l["Logout"], url: "/Account/Logout", icon: "fa fa-power-off", order: int.MaxValue - 1000)); context.Menu.AddItem(new ApplicationMenuItem("Account.Logout", l["Logout"], url: "/Account/Logout", icon: "fa fa-power-off", order: int.MaxValue - 1000));
return Task.CompletedTask; return Task.CompletedTask;

2
modules/account/src/Volo.Abp.Account.Web/Localization/Resources/AbpAccount/Web/tr.json

@ -9,7 +9,7 @@
"UseAnotherServiceToLogin": "Başka bir servisle giriş yap", "UseAnotherServiceToLogin": "Başka bir servisle giriş yap",
"UserLockedOutMessage": "Kullanıcı hesabı hatalı giriş denemeleri nedeniyle kilitlenmiştir. Lütfen bir süre bekleyip tekrar deneyin.", "UserLockedOutMessage": "Kullanıcı hesabı hatalı giriş denemeleri nedeniyle kilitlenmiştir. Lütfen bir süre bekleyip tekrar deneyin.",
"InvalidUserNameOrPassword": "Kullanıcı adı ya da şifre geçersiz!", "InvalidUserNameOrPassword": "Kullanıcı adı ya da şifre geçersiz!",
"LoginIsNotAllowed": "You are not allowed to login! E-posta adresinizi ya da telefon numaranızı doğrulamanız gerekiyor.", "LoginIsNotAllowed": "Giriş yapamazsınız! E-posta adresinizi ya da telefon numaranızı doğrulamanız gerekiyor.",
"SelfRegistrationDisabledMessage": "Bu uygulama için kullanıcıların kendi kendilerine kaydolmaları engellenmiştir. Yeni bir kullanıcı kaydetmek için lütfen uygulama yöneticisi ile iletişime geçin." "SelfRegistrationDisabledMessage": "Bu uygulama için kullanıcıların kendi kendilerine kaydolmaları engellenmiştir. Yeni bir kullanıcı kaydetmek için lütfen uygulama yöneticisi ile iletişime geçin."
} }
} }

1
modules/blogging/src/Volo.Blogging.Web/Localization/Resources/Blogging/Web/en.json

@ -26,6 +26,7 @@
"BlogDeletionWarningMessage": "Blog will be deleted.", "BlogDeletionWarningMessage": "Blog will be deleted.",
"AreYouSure": "Are you sure?", "AreYouSure": "Are you sure?",
"Comment": "{0} Comment", "Comment": "{0} Comment",
"ShareOnTwitter": "Share On Twitter",
"CoverImage": "Cover Image", "CoverImage": "Cover Image",
"CreateANewPost": "Create A New Post", "CreateANewPost": "Create A New Post",
"CreateANewBlog": "Create A New Blog", "CreateANewBlog": "Create A New Blog",

1
modules/blogging/src/Volo.Blogging.Web/Localization/Resources/Blogging/Web/tr.json

@ -17,6 +17,7 @@
"SeeAll": "Hepsini Gör", "SeeAll": "Hepsini Gör",
"PopularTags": "Popüler Etiketler", "PopularTags": "Popüler Etiketler",
"ReadWithCount": "{0} Okunma", "ReadWithCount": "{0} Okunma",
"ShareOnTwitter": "Twitter'da paylaş",
"LastPosts": "Son Yazılar", "LastPosts": "Son Yazılar",
"LeaveComment": "Yorum Bırak", "LeaveComment": "Yorum Bırak",
"TagsInThisArticle": "Makalenin Etiketleri", "TagsInThisArticle": "Makalenin Etiketleri",

43
modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Detail.cshtml

@ -155,31 +155,34 @@
} }
</div> </div>
<a class="twitter-share-button" <a class="btn-rounded float-right btn btn-primary"
href="@Model.GetTwitterShareUrl(Model.Post.Title, HttpContext.Request.GetEncodedUrl())" target="_blank"> href="@Model.GetTwitterShareUrl(Model.Post.Title, HttpContext.Request.GetEncodedUrl())" target="_blank">
Tweet <i class="fa fa-twitter"></i>
@L["ShareOnTwitter"]
</a> </a>
<div class="comment-form mt-4"> @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Create))
<div class="vs-blog-title mb-0"> {
<h3>@L["LeaveComment"]</h3> <div class="comment-form mt-4">
</div> <div class="vs-blog-title mb-0">
<div class="clearfix bg-light p-4"> <h3>@L["LeaveComment"]</h3>
<div> </div>
<form method="post"> <div class="clearfix bg-light p-4">
<input name="postId" value="@Model.Post.Id" hidden /> <div>
<input name="repliedCommentId" id="repliedCommentId" hidden /> <form method="post">
<div class="form-group"> <input name="postId" value="@Model.Post.Id" hidden />
<textarea class="form-control no-border" name="text" id="textBoxId" rows="4"></textarea> <input name="repliedCommentId" id="repliedCommentId" hidden />
</div> <div class="form-group">
<abp-button button-type="Primary" class="btn-rounded float-right" type="submit" text="@L["Submit"].Value" /> <textarea class="form-control no-border" name="text" id="textBoxId" rows="4"></textarea>
</form> </div>
<abp-button button-type="Primary" class="btn-rounded float-right" type="submit" text="@L["Submit"].Value" />
</form>
</div>
</div> </div>
</div> </div>
</div> }
<div class="comment-area">
<div class="comment-area">
@foreach (var commentWithRepliesDto in Model.CommentsWithReplies) @foreach (var commentWithRepliesDto in Model.CommentsWithReplies)
{ {
<div class="media"> <div class="media">

2
modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IIdentityUserAppService.cs

@ -19,5 +19,7 @@ namespace Volo.Abp.Identity
Task<IdentityUserDto> FindByUsernameAsync(string username); Task<IdentityUserDto> FindByUsernameAsync(string username);
Task<IdentityUserDto> FindByEmailAsync(string email); Task<IdentityUserDto> FindByEmailAsync(string email);
Task ChangePasswordAsync(string currentPassword, string newPassword);
} }
} }

13
modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs

@ -113,7 +113,6 @@ namespace Volo.Abp.Identity
await _permissionAppServiceHelper.UpdateAsync(UserPermissionValueProvider.ProviderName, id.ToString(), input); await _permissionAppServiceHelper.UpdateAsync(UserPermissionValueProvider.ProviderName, id.ToString(), input);
} }
[Authorize(IdentityPermissions.Users.Default)]
public async Task<IdentityUserDto> FindByUsernameAsync(string username) public async Task<IdentityUserDto> FindByUsernameAsync(string username)
{ {
return ObjectMapper.Map<IdentityUser, IdentityUserDto>( return ObjectMapper.Map<IdentityUser, IdentityUserDto>(
@ -121,7 +120,6 @@ namespace Volo.Abp.Identity
); );
} }
[Authorize(IdentityPermissions.Users.Default)]
public async Task<IdentityUserDto> FindByEmailAsync(string email) public async Task<IdentityUserDto> FindByEmailAsync(string email)
{ {
return ObjectMapper.Map<IdentityUser, IdentityUserDto>( return ObjectMapper.Map<IdentityUser, IdentityUserDto>(
@ -129,6 +127,17 @@ namespace Volo.Abp.Identity
); );
} }
public async Task ChangePasswordAsync(string currentPassword, string newPassword)
{
if (!CurrentUser.Id.HasValue)
{
throw new AbpException("Current user Id is null!");
}
var currentUser = await _userManager.GetByIdAsync(CurrentUser.Id.Value);
(await _userManager.ChangePasswordAsync(currentUser, currentPassword, newPassword)).CheckErrors();
}
private async Task UpdateUserByInput(IdentityUser user, IdentityUserCreateOrUpdateDtoBase input) private async Task UpdateUserByInput(IdentityUser user, IdentityUserCreateOrUpdateDtoBase input)
{ {
(await _userManager.SetEmailAsync(user, input.Email)).CheckErrors(); (await _userManager.SetEmailAsync(user, input.Email)).CheckErrors();

3
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/Localization/Domain/en.json

@ -25,6 +25,7 @@
"Identity.UserLockedOut": "User is locked out.", "Identity.UserLockedOut": "User is locked out.",
"Identity.UserLockoutNotEnabled": "Lockout is not enabled for this user.", "Identity.UserLockoutNotEnabled": "Lockout is not enabled for this user.",
"Identity.UserNameNotFound": "User {0} does not exist.", "Identity.UserNameNotFound": "User {0} does not exist.",
"Identity.UserNotInRole": "User is not in role '{0}'." "Identity.UserNotInRole": "User is not in role '{0}'.",
"Identity.PasswordConfirmationFailed": "Password does not match the confirm password."
} }
} }

3
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/Localization/Domain/tr.json

@ -25,6 +25,7 @@
"Identity.UserLockedOut": "Kullanıcı hesabı kilitlenmiş.", "Identity.UserLockedOut": "Kullanıcı hesabı kilitlenmiş.",
"Identity.UserLockoutNotEnabled": "Bu kullanıcı için hesap kilitleme etkin değil.", "Identity.UserLockoutNotEnabled": "Bu kullanıcı için hesap kilitleme etkin değil.",
"Identity.UserNameNotFound": "{0} kullanıcısı bulunamadı.", "Identity.UserNameNotFound": "{0} kullanıcısı bulunamadı.",
"Identity.UserNotInRole": "Kullanıcı '{0}' rolünde değil." "Identity.UserNotInRole": "Kullanıcı '{0}' rolünde değil.",
"Identity.PasswordConfirmationFailed": "Yeni şifre ile onay şifresi uyuşmuyor."
} }
} }

6
modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityUserController.cs

@ -64,7 +64,6 @@ namespace Volo.Abp.Identity
return _userAppService.UpdatePermissionsAsync(id, input); return _userAppService.UpdatePermissionsAsync(id, input);
} }
//todo: add authorize attrbutes on the corresponding methods.
[HttpGet] [HttpGet]
public virtual Task<IdentityUserDto> FindByUsernameAsync(string username) public virtual Task<IdentityUserDto> FindByUsernameAsync(string username)
{ {
@ -76,5 +75,10 @@ namespace Volo.Abp.Identity
{ {
return _userAppService.FindByEmailAsync(email); return _userAppService.FindByEmailAsync(email);
} }
public Task ChangePasswordAsync(string currentPassword, string newPassword)
{
return _userAppService.ChangePasswordAsync(currentPassword, newPassword);
}
} }
} }

10
modules/identity/src/Volo.Abp.Identity.Web/AbpIdentityWebModule.cs

@ -3,6 +3,8 @@ using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AspNetCore.Mvc.Localization; using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap; using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Bundling;
using Volo.Abp.AutoMapper; using Volo.Abp.AutoMapper;
using Volo.Abp.Identity.Localization; using Volo.Abp.Identity.Localization;
using Volo.Abp.Identity.Web.Navigation; using Volo.Abp.Identity.Web.Navigation;
@ -65,6 +67,14 @@ namespace Volo.Abp.Identity.Web
options.Conventions.AuthorizePage("/Identity/Roles/CreateModal", IdentityPermissions.Roles.Create); options.Conventions.AuthorizePage("/Identity/Roles/CreateModal", IdentityPermissions.Roles.Create);
options.Conventions.AuthorizePage("/Identity/Roles/EditModal", IdentityPermissions.Roles.Update); options.Conventions.AuthorizePage("/Identity/Roles/EditModal", IdentityPermissions.Roles.Update);
}); });
Configure<BundlingOptions>(options =>
{
options
.ScriptBundles
.Get(StandardBundles.Scripts.Global)
.AddFiles("/Pages/Identity/Shared/change-password-modal.js");
});
} }
} }
} }

6
modules/identity/src/Volo.Abp.Identity.Web/Localization/Resources/AbpIdentity/en.json

@ -22,6 +22,10 @@
"NewRole": "New role", "NewRole": "New role",
"RoleName": "Role name", "RoleName": "Role name",
"CreationTime": "Creation time", "CreationTime": "Creation time",
"Permissions": "Permissions" "Permissions": "Permissions",
"DisplayName:CurrentPassword": "Current password",
"DisplayName:NewPassword": "New password",
"DisplayName:NewPasswordConfirm": "Confirm new password",
"PasswordChangedMessage": "Your password has been changed successfully."
} }
} }

6
modules/identity/src/Volo.Abp.Identity.Web/Localization/Resources/AbpIdentity/tr.json

@ -22,6 +22,10 @@
"NewRole": "Yeni rol", "NewRole": "Yeni rol",
"RoleName": "Rol adı", "RoleName": "Rol adı",
"CreationTime": "Oluşturma zamanı", "CreationTime": "Oluşturma zamanı",
"Permissions": "İzinler" "Permissions": "İzinler",
"DisplayName:CurrentPassword": "Mevcut şifre",
"DisplayName:NewPassword": "Yeni şifre",
"DisplayName:NewPasswordConfirm": "Yeni şifre (tekrar)",
"PasswordChangedMessage": "Şifreniz başarıyla değiştirildi."
} }
} }

20
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Shared/ChangePasswordModal.cshtml

@ -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 ChangePasswordModal
@inject IHtmlLocalizer<IdentityResource> L
@{
Layout = null;
}
<abp-dynamic-form abp-model="@Model.ChangePasswordInfoModel" asp-page="/Identity/Shared/ChangePasswordModal">
<abp-modal>
<abp-modal-header title="@L["ChangePassword"].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>

61
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Shared/ChangePasswordModal.cshtml.cs

@ -0,0 +1,61 @@
using System.ComponentModel.DataAnnotations;
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 ChangePasswordModal : AbpPageModel
{
[BindProperty]
public ChangePasswordInfoModel ChangePasswordInfoModel { get; set; }
private readonly IIdentityUserAppService _userAppService;
private readonly IStringLocalizer<IdentityResource> _localizer;
public ChangePasswordModal(IIdentityUserAppService userAppService,
IStringLocalizer<IdentityResource> localizer)
{
_userAppService = userAppService;
_localizer = localizer;
}
public async Task<IActionResult> OnPostAsync()
{
ValidateModel();
if (ChangePasswordInfoModel.NewPassword != ChangePasswordInfoModel.NewPasswordConfirm)
{
throw new UserFriendlyException(_localizer.GetString("Identity.PasswordConfirmationFailed").Value);
}
await _userAppService.ChangePasswordAsync(ChangePasswordInfoModel.CurrentPassword,
ChangePasswordInfoModel.NewPassword);
return NoContent();
}
}
public class ChangePasswordInfoModel
{
[Required]
[StringLength(IdentityUserConsts.MaxPasswordLength)]
[Display(Name = "DisplayName:CurrentPassword")]
[DataType(DataType.Password)]
public string CurrentPassword { get; set; }
[Required]
[StringLength(IdentityUserConsts.MaxPasswordLength)]
[Display(Name = "DisplayName:NewPassword")]
[DataType(DataType.Password)]
public string NewPassword { get; set; }
[Required]
[StringLength(IdentityUserConsts.MaxPasswordLength)]
[Display(Name = "DisplayName:NewPasswordConfirm")]
[DataType(DataType.Password)]
public string NewPasswordConfirm { get; set; }
}
}

18
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Shared/change-password-modal.js

@ -0,0 +1,18 @@
(function ($) {
var l = abp.localization.getResource('AbpIdentity');
var _changePasswordModal = new abp.ModalManager(abp.appPath + 'Identity/Shared/ChangePasswordModal');
$(function () {
$("#abp-account-change-password").click(function (e) {
e.preventDefault();
_changePasswordModal.open();
});
_changePasswordModal.onResult(function () {
abp.message.success(l("PasswordChangedMessage"));
});
});
})(jQuery);

1
modules/identity/src/Volo.Abp.Identity.Web/Volo.Abp.Identity.Web.csproj

@ -37,6 +37,7 @@
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Bootstrap\Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.csproj" /> <ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Bootstrap\Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AutoMapper\Volo.Abp.AutoMapper.csproj" /> <ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AutoMapper\Volo.Abp.AutoMapper.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

Loading…
Cancel
Save