Browse Source

Merge branch 'dev' into aspnetcore-3.0

pull/1810/head
Halil İbrahim Kalkan 7 years ago
parent
commit
08f299b6f4
  1. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/UserMenu/Default.cshtml
  2. 19
      modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json
  3. 1
      modules/account/src/Volo.Abp.Account.HttpApi/Volo.Abp.Account.HttpApi.csproj
  4. 2
      modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/AbpAccountHttpApiModule.cs
  5. 16
      modules/account/src/Volo.Abp.Account.Web/AbpAccountUserMenuContributor.cs
  6. 14
      modules/account/src/Volo.Abp.Account.Web/AbpAccountWebAutomapperProfile.cs
  7. 15
      modules/account/src/Volo.Abp.Account.Web/AbpAccountWebModule.cs
  8. 50
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/Manage.cshtml
  9. 43
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/Manage.cshtml.cs
  10. 50
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/Manage.js
  11. 2
      modules/account/src/Volo.Abp.Account.Web/Volo.Abp.Account.Web.csproj
  12. 12
      modules/identity/src/Volo.Abp.Identity.Web/AbpIdentityWebAutoMapperProfile.cs
  13. 9
      modules/identity/src/Volo.Abp.Identity.Web/AbpIdentityWebModule.cs
  14. 20
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Shared/ChangePasswordModal.cshtml
  15. 67
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Shared/ChangePasswordModal.cshtml.cs
  16. 40
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Shared/PersonalSettingsModal.cshtml
  17. 18
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Shared/change-password-modal.js
  18. 18
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Shared/personal-settings-modal.js
  19. 1
      npm/ng-packs/packages/theme-shared/src/lib/abstracts/toaster.ts
  20. 35
      npm/ng-packs/packages/theme-shared/src/lib/components/loader-bar/loader-bar.component.ts
  21. 39
      npm/ng-packs/packages/theme-shared/src/lib/services/confirmation.service.ts
  22. 1
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj
  23. 2
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/MyProjectNameIdentityServerModule.cs
  24. 16
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Menus/MyProjectNameMenuContributor.cs
  25. 7
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs

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

@ -21,7 +21,7 @@
var cssClass = string.IsNullOrEmpty(menuItem.CssClass) ? string.Empty : menuItem.CssClass;
var disabled = menuItem.IsDisabled ? "disabled" : string.Empty;
<a class="dropdown-item @cssClass @disabled" href="@(menuItem.Url ?? "#")" @Html.Raw(elementId)>
<a class="dropdown-item @cssClass @disabled" href="@(menuItem.Url ?? "#")" target="@menuItem.Target" @Html.Raw(elementId)>
@menuItem.DisplayName
</a>
}

19
modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json

@ -16,6 +16,23 @@
"Register": "Register",
"InvalidLoginRequest": "Invalid login request",
"ThereAreNoLoginSchemesConfiguredForThisClient": "There are no login schemes configured for this client.",
"LogInUsingYourProviderAccount": "Log in using your {0} account"
"LogInUsingYourProviderAccount": "Log in using your {0} account",
"DisplayName:CurrentPassword": "Current password",
"DisplayName:NewPassword": "New password",
"DisplayName:NewPasswordConfirm": "Confirm new password",
"PasswordChangedMessage": "Your password has been changed successfully.",
"DisplayName:UserName": "User name",
"DisplayName:Email": "Email",
"DisplayName:Name": "Name",
"DisplayName:Surname": "Surname",
"DisplayName:Password": "Password",
"DisplayName:EmailAddress": "Email address",
"DisplayName:PhoneNumber": "Phone number",
"PersonalSettings": "Personal settings",
"PersonalSettingsSaved": "Personal settings saved",
"PasswordChanged": "Password changed",
"NewPasswordConfirmFailed": "Please confirm the new password.",
"Manage": "Manage",
"ManageYourProfile": "Manage your profile"
}
}

1
modules/account/src/Volo.Abp.Account.HttpApi/Volo.Abp.Account.HttpApi.csproj

@ -12,6 +12,7 @@
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.Account.Application.Contracts\Volo.Abp.Account.Application.Contracts.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc\Volo.Abp.AspNetCore.Mvc.csproj" />
<ProjectReference Include="..\..\..\identity\src\Volo.Abp.Identity.HttpApi\Volo.Abp.Identity.HttpApi.csproj" />
</ItemGroup>
</Project>

2
modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/AbpAccountHttpApiModule.cs

@ -1,6 +1,7 @@
using Localization.Resources.AbpUi;
using Volo.Abp.Account.Localization;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Identity;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
@ -8,6 +9,7 @@ namespace Volo.Abp.Account
{
[DependsOn(
typeof(AbpAccountApplicationContractsModule),
typeof(AbpIdentityHttpApiModule),
typeof(AbpAspNetCoreMvcModule))]
public class AbpAccountHttpApiModule : AbpModule
{

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

@ -2,17 +2,13 @@
using Localization.Resources.AbpUi;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
using Volo.Abp.Account.Localization;
using Volo.Abp.UI.Navigation;
namespace Volo.Abp.Account.Web
{
public class AbpAccountUserMenuContributor : IMenuContributor
{
public AbpAccountUserMenuContributor()
{
}
public Task ConfigureMenuAsync(MenuConfigurationContext context)
{
if (context.Menu.Name != StandardMenus.User)
@ -20,13 +16,11 @@ namespace Volo.Abp.Account.Web
return Task.CompletedTask;
}
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.PersonalSettings", l["PersonalInfo"], icon: "fa fa-info", url: "#", elementId: "abp-account-personal-settings"));
var uiResource = context.ServiceProvider.GetRequiredService<IStringLocalizer<AbpUiResource>>();
var accountResource = context.ServiceProvider.GetRequiredService<IStringLocalizer<AccountResource>>();
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.Manage", accountResource["ManageYourProfile"], url: "/Account/Manage", icon: "fa fa-cog", order: 1000, null));
context.Menu.AddItem(new ApplicationMenuItem("Account.Logout", uiResource["Logout"], url: "/Account/Logout", icon: "fa fa-power-off", order: int.MaxValue - 1000));
return Task.CompletedTask;
}

14
modules/account/src/Volo.Abp.Account.Web/AbpAccountWebAutomapperProfile.cs

@ -0,0 +1,14 @@
using Volo.Abp.Account.Web.Pages.Account;
using Volo.Abp.Identity;
using AutoMapper;
namespace Volo.Abp.Account.Web
{
public class AbpAccountWebAutoMapperProfile : Profile
{
public AbpAccountWebAutoMapperProfile()
{
CreateMap<ProfileDto, PersonalSettingsInfoModel>();
}
}
}

15
modules/account/src/Volo.Abp.Account.Web/AbpAccountWebModule.cs

@ -1,8 +1,10 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Account.Localization;
using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Toolbars;
using Volo.Abp.AutoMapper;
using Volo.Abp.Identity.AspNetCore;
using Volo.Abp.Modularity;
using Volo.Abp.UI.Navigation;
@ -13,6 +15,7 @@ namespace Volo.Abp.Account.Web
[DependsOn(
typeof(AbpAccountHttpApiModule),
typeof(AbpIdentityAspNetCoreModule),
typeof(AbpAutoMapperModule),
typeof(AbpAspNetCoreMvcUiThemeSharedModule)
)]
public class AbpAccountWebModule : AbpModule
@ -41,6 +44,16 @@ namespace Volo.Abp.Account.Web
{
options.Contributors.Add(new AccountModuleToolbarContributor());
});
Configure<RazorPagesOptions>(options =>
{
options.Conventions.AuthorizePage("/Account/Manage");
});
Configure<AbpAutoMapperOptions>(options =>
{
options.AddProfile<AbpAccountWebAutoMapperProfile>(validate: true);
});
}
}
}

50
modules/account/src/Volo.Abp.Account.Web/Pages/Account/Manage.cshtml

@ -0,0 +1,50 @@
@page
@model Volo.Abp.Account.Web.Pages.Account.ManageModel
@using Volo.Abp.Identity.Settings
@using Volo.Abp.Settings
@using Volo.Abp.AspNetCore.Mvc.UI.Theming
@inject ISettingProvider SettingManager
@inject IThemeManager ThemeManager
@inherits Volo.Abp.Account.Web.Pages.Account.AccountPage
@{
Layout = ThemeManager.CurrentTheme.GetApplicationLayout();
var isUserNameUpdateEnabled = string.Equals(await SettingManager.GetOrNullAsync(IdentitySettingNames.User.IsUserNameUpdateEnabled), "true",
StringComparison.OrdinalIgnoreCase);
var isEmailUpdateEnabled = string.Equals(await SettingManager.GetOrNullAsync(IdentitySettingNames.User.IsEmailUpdateEnabled), "true",
StringComparison.OrdinalIgnoreCase);
}
@section scripts {
<abp-script src="/Pages/Account/Manage.js" />
}
<abp-tabs tab-style="PillVertical">
<abp-tab title="@L["ChangePassword"].Value">
<abp-dynamic-form abp-model="@Model.ChangePasswordInfoModel" id="ChangePasswordForm">
<abp-form-content />
<abp-button type="submit" button-type="Primary" text="@L["Submit"].Value" />
</abp-dynamic-form>
</abp-tab>
<abp-tab title="@L["PersonalSettings"].Value">
<form method="post" id="PersonalSettingsForm">
<abp-input asp-for="PersonalSettingsInfoModel.UserName" readonly="!isUserNameUpdateEnabled" />
<abp-row>
<abp-column size-md="_6">
<abp-input asp-for="PersonalSettingsInfoModel.Name" />
</abp-column>
<abp-column size-md="_6">
<abp-input asp-for="PersonalSettingsInfoModel.Surname" />
</abp-column>
</abp-row>
<abp-input asp-for="PersonalSettingsInfoModel.Email" readonly="!isEmailUpdateEnabled" />
<abp-input asp-for="PersonalSettingsInfoModel.PhoneNumber" />
<abp-button type="submit" button-type="Primary" text="@L["Submit"].Value" />
</form>
</abp-tab>
</abp-tabs>

43
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Shared/PersonalSettingsModal.cshtml.cs → modules/account/src/Volo.Abp.Account.Web/Pages/Account/Manage.cshtml.cs

@ -1,18 +1,18 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;
using Volo.Abp.Identity;
namespace Volo.Abp.Identity.Web.Pages.Identity.Shared
namespace Volo.Abp.Account.Web.Pages.Account
{
public class PersonalSettingsModal : AbpPageModel
public class ManageModel : AccountPageModel
{
[BindProperty]
public ChangePasswordInfoModel ChangePasswordInfoModel { get; set; }
public PersonalSettingsInfoModel PersonalSettingsInfoModel { get; set; }
private readonly IProfileAppService _profileAppService;
public PersonalSettingsModal(IProfileAppService profileAppService)
public ManageModel(IProfileAppService profileAppService)
{
_profileAppService = profileAppService;
}
@ -23,19 +23,28 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Shared
PersonalSettingsInfoModel = ObjectMapper.Map<ProfileDto, PersonalSettingsInfoModel>(user);
}
}
public async Task<IActionResult> OnPostAsync()
{
ValidateModel();
var updateDto = ObjectMapper.Map<PersonalSettingsInfoModel, UpdateProfileDto>(PersonalSettingsInfoModel);
public class ChangePasswordInfoModel
{
[Required]
[StringLength(IdentityUserConsts.MaxPasswordLength)]
[Display(Name = "DisplayName:CurrentPassword")]
[DataType(DataType.Password)]
public string CurrentPassword { get; set; }
await _profileAppService.UpdateAsync(updateDto);
[Required]
[StringLength(IdentityUserConsts.MaxPasswordLength)]
[Display(Name = "DisplayName:NewPassword")]
[DataType(DataType.Password)]
public string NewPassword { get; set; }
return NoContent();
}
[Required]
[StringLength(IdentityUserConsts.MaxPasswordLength)]
[Display(Name = "DisplayName:NewPasswordConfirm")]
[DataType(DataType.Password)]
public string NewPasswordConfirm { get; set; }
}
public class PersonalSettingsInfoModel
{
[Required]

50
modules/account/src/Volo.Abp.Account.Web/Pages/Account/Manage.js

@ -0,0 +1,50 @@
(function ($) {
var l = abp.localization.getResource('AbpAccount');
var _profileService = volo.abp.identity.profile;
$("#ChangePasswordForm").submit(function (e) {
e.preventDefault();
if (!$("#ChangePasswordForm").valid()) {
return false;
}
var input = $("#ChangePasswordForm").serializeFormToObject().changePasswordInfoModel;
if (input.newPassword != input.newPasswordConfirm || input.currentPassword == '') {
abp.message.error(l("NewPasswordConfirmFailed"));
return;
}
if (input.currentPassword == '') {
return;
}
_profileService.changePassword(
input
).then(function (result) {
abp.message.success(l("PasswordChanged"));
});
});
$("#PersonalSettingsForm").submit(function (e) {
e.preventDefault();
if (!$("#PersonalSettingsForm").valid()) {
return false;
}
var input = $("#PersonalSettingsForm").serializeFormToObject().personalSettingsInfoModel;
_profileService.update(
input
).then(function (result) {
abp.notify.success(l("PersonalSettingsSaved"));
});
});
})(jQuery);

2
modules/account/src/Volo.Abp.Account.Web/Volo.Abp.Account.Web.csproj

@ -29,12 +29,14 @@
<Content Remove="Pages\**\*.js" />
<Content Remove="Pages\**\*.css" />
<Content Remove="Properties\launchSettings.json" />
<None Remove="Pages\Account\Manage.js" />
<None Include="Properties\launchSettings.json" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\identity\src\Volo.Abp.Identity.AspNetCore\Volo.Abp.Identity.AspNetCore.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AutoMapper\Volo.Abp.AutoMapper.csproj" />
<ProjectReference Include="..\Volo.Abp.Account.HttpApi\Volo.Abp.Account.HttpApi.csproj" />
</ItemGroup>

12
modules/identity/src/Volo.Abp.Identity.Web/AbpIdentityWebAutoMapperProfile.cs

@ -1,6 +1,5 @@
using AutoMapper;
using Volo.Abp.Identity.Web.Pages.Identity.Roles;
using Volo.Abp.Identity.Web.Pages.Identity.Shared;
using CreateUserModalModel = Volo.Abp.Identity.Web.Pages.Identity.Users.CreateModalModel;
using EditUserModalModel = Volo.Abp.Identity.Web.Pages.Identity.Users.EditModalModel;
@ -12,7 +11,6 @@ namespace Volo.Abp.Identity.Web
{
CreateUserMappings();
CreateRoleMappings();
CreateProfileMappings();
}
private void CreateUserMappings()
@ -33,10 +31,6 @@ namespace Volo.Abp.Identity.Web
CreateMap<IdentityRoleDto, EditUserModalModel.AssignedRoleViewModel>()
.ForMember(dest => dest.IsAssigned, opt => opt.Ignore());
CreateMap<ProfileDto, PersonalSettingsInfoModel>();
CreateMap<PersonalSettingsInfoModel, UpdateProfileDto>();
}
private void CreateRoleMappings()
@ -50,11 +44,5 @@ namespace Volo.Abp.Identity.Web
//EditModal
CreateMap<EditModalModel.RoleInfoModel, IdentityRoleUpdateDto>();
}
private void CreateProfileMappings()
{
CreateMap<ProfileDto, PersonalSettingsInfoModel>();
CreateMap<PersonalSettingsInfoModel, UpdateProfileDto>();
}
}
}

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

@ -59,15 +59,6 @@ namespace Volo.Abp.Identity.Web
options.Conventions.AuthorizePage("/Identity/Roles/CreateModal", IdentityPermissions.Roles.Create);
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")
.AddFiles("/Pages/Identity/Shared/personal-settings-modal.js");
});
}
}
}

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

@ -1,20 +0,0 @@
@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>

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

@ -1,67 +0,0 @@
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 IProfileAppService _profileAppService;
private readonly IStringLocalizer<IdentityResource> _localizer;
public ChangePasswordModal(
IProfileAppService profileAppService,
IStringLocalizer<IdentityResource> localizer)
{
_profileAppService = profileAppService;
_localizer = localizer;
}
public async Task<IActionResult> OnPostAsync()
{
ValidateModel();
if (ChangePasswordInfoModel.NewPassword != ChangePasswordInfoModel.NewPasswordConfirm)
{
throw new UserFriendlyException(_localizer.GetString("Identity.PasswordConfirmationFailed").Value);
}
await _profileAppService.ChangePasswordAsync(
new ChangePasswordInput()
{
CurrentPassword = ChangePasswordInfoModel.CurrentPassword,
NewPassword = 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; }
}
}

40
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Shared/PersonalSettingsModal.cshtml

@ -1,40 +0,0 @@
@page
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
@using Volo.Abp.Identity.Localization
@using Volo.Abp.Identity.Settings
@using Volo.Abp.Identity.Web.Pages.Identity.Shared
@using Volo.Abp.Settings
@model PersonalSettingsModal
@inject IHtmlLocalizer<IdentityResource> L
@inject ISettingProvider SettingProvider
@{
Layout = null;
var isUserNameUpdateEnabled = await SettingProvider.IsTrueAsync(IdentitySettingNames.User.IsUserNameUpdateEnabled);
var isEmailUpdateEnabled = await SettingProvider.IsTrueAsync(IdentitySettingNames.User.IsEmailUpdateEnabled);
}
<form asp-page="/Identity/Shared/PersonalSettingsModal">
<abp-modal>
<abp-modal-header title="@L["PersonalInfo"].Value"></abp-modal-header>
<abp-modal-body>
<abp-input asp-for="PersonalSettingsInfoModel.UserName" readonly="!isUserNameUpdateEnabled" />
<abp-row>
<abp-column size-md="_6">
<abp-input asp-for="PersonalSettingsInfoModel.Name" />
</abp-column>
<abp-column size-md="_6">
<abp-input asp-for="PersonalSettingsInfoModel.Surname" />
</abp-column>
</abp-row>
<abp-input asp-for="PersonalSettingsInfoModel.Email" readonly="!isEmailUpdateEnabled" />
<abp-input asp-for="PersonalSettingsInfoModel.PhoneNumber" />
</abp-modal-body>
<abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"></abp-modal-footer>
</abp-modal>
</form>

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

@ -1,18 +0,0 @@
(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);

18
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Shared/personal-settings-modal.js

@ -1,18 +0,0 @@
(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);

1
npm/ng-packs/packages/theme-shared/src/lib/abstracts/toaster.ts

@ -10,6 +10,7 @@ export class AbstractToaster<T = Toaster.Options> {
sticky: boolean = false;
constructor(protected messageService: MessageService) {}
info(message: string, title: string, options?: T): Observable<Toaster.Status> {
return this.show(message, title, 'info', options);
}

35
npm/ng-packs/packages/theme-shared/src/lib/components/loader-bar/loader-bar.component.ts

@ -1,10 +1,10 @@
import { StartLoader, StopLoader } from '@abp/ng.core';
import { Component, Input, OnDestroy } from '@angular/core';
import { NavigationEnd, NavigationStart, Router, NavigationError } from '@angular/router';
import { ChangeDetectorRef, Component, Input, OnDestroy } from '@angular/core';
import { NavigationEnd, NavigationError, NavigationStart, Router } from '@angular/router';
import { takeUntilDestroy } from '@ngx-validate/core';
import { Actions, ofActionSuccessful } from '@ngxs/store';
import { interval, Subscription, timer } from 'rxjs';
import { filter } from 'rxjs/operators';
import { timer } from 'rxjs';
@Component({
selector: 'abp-loader-bar',
@ -37,13 +37,15 @@ export class LoaderBarComponent implements OnDestroy {
progressLevel: number = 0;
interval: any;
interval: Subscription;
timer: Subscription;
get boxShadow(): string {
return `0 0 10px rgba(${this.color}, 0.5)`;
}
constructor(private actions: Actions, private router: Router) {
constructor(private actions: Actions, private router: Router, private cdRef: ChangeDetectorRef) {
actions
.pipe(
ofActionSuccessful(StartLoader, StopLoader),
@ -69,11 +71,15 @@ export class LoaderBarComponent implements OnDestroy {
});
}
ngOnDestroy() {}
ngOnDestroy() {
this.interval.unsubscribe();
}
startLoading() {
if (this.isLoading || this.progressLevel !== 0) return;
this.isLoading = true;
const interval = setInterval(() => {
this.interval = interval(350).subscribe(() => {
if (this.progressLevel < 75) {
this.progressLevel += Math.random() * 10;
} else if (this.progressLevel < 90) {
@ -81,18 +87,21 @@ export class LoaderBarComponent implements OnDestroy {
} else if (this.progressLevel < 100) {
this.progressLevel += 0.1;
} else {
clearInterval(interval);
this.interval.unsubscribe();
}
}, 300);
this.interval = interval;
this.cdRef.detectChanges();
});
}
stopLoading() {
clearInterval(this.interval);
this.interval.unsubscribe();
this.progressLevel = 100;
this.isLoading = false;
if (this.timer) this.timer.unsubscribe();
timer(810).subscribe(() => (this.progressLevel = 0));
this.timer = timer(820).subscribe(() => {
this.progressLevel = 0;
this.cdRef.detectChanges();
});
}
}

39
npm/ng-packs/packages/theme-shared/src/lib/services/confirmation.service.ts

@ -1,10 +1,49 @@
import { Injectable } from '@angular/core';
import { AbstractToaster } from '../abstracts/toaster';
import { Confirmation } from '../models/confirmation';
import { MessageService } from 'primeng/components/common/messageservice';
import { fromEvent, Observable, Subject } from 'rxjs';
import { takeUntil, debounceTime, filter } from 'rxjs/operators';
import { Toaster } from '../models/toaster';
@Injectable({ providedIn: 'root' })
export class ConfirmationService extends AbstractToaster<Confirmation.Options> {
key: string = 'abpConfirmation';
sticky: boolean = true;
destroy$ = new Subject();
constructor(protected messageService: MessageService) {
super(messageService);
}
show(
message: string,
title: string,
severity: Toaster.Severity,
options?: Confirmation.Options,
): Observable<Toaster.Status> {
this.listenToEscape();
return super.show(message, title, severity, options);
}
clear(status?: Toaster.Status) {
super.clear(status);
this.destroy$.next();
}
listenToEscape() {
fromEvent(document, 'keyup')
.pipe(
takeUntil(this.destroy$),
debounceTime(150),
filter((key: KeyboardEvent) => key && key.code === 'Escape'),
)
.subscribe(_ => {
this.clear();
});
}
}

1
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj

@ -44,6 +44,7 @@
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic\Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\account\src\Volo.Abp.Account.Web.IdentityServer\Volo.Abp.Account.Web.IdentityServer.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\account\src\Volo.Abp.Account.Application\Volo.Abp.Account.Application.csproj" />
<ProjectReference Include="..\MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations\MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations.csproj" />
</ItemGroup>

2
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/MyProjectNameIdentityServerModule.cs

@ -12,6 +12,7 @@ using MyCompanyName.MyProjectName.Localization;
using MyCompanyName.MyProjectName.MultiTenancy;
using StackExchange.Redis;
using Volo.Abp;
using Volo.Abp.Account;
using Volo.Abp.Account.Web;
using Volo.Abp.AspNetCore.Mvc.UI;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap;
@ -32,6 +33,7 @@ namespace MyCompanyName.MyProjectName
[DependsOn(
typeof(AbpAutofacModule),
typeof(AbpAccountWebIdentityServerModule),
typeof(AbpAccountApplicationModule),
typeof(AbpAspNetCoreMvcUiBasicThemeModule),
typeof(MyProjectNameEntityFrameworkCoreDbMigrationsModule)
)]

16
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Menus/MyProjectNameMenuContributor.cs

@ -1,8 +1,11 @@
using System.Threading.Tasks;
using System;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
using MyCompanyName.MyProjectName.Localization;
using MyCompanyName.MyProjectName.MultiTenancy;
using Volo.Abp.Account.Localization;
using Volo.Abp.TenantManagement.Web.Navigation;
using Volo.Abp.UI.Navigation;
@ -10,6 +13,13 @@ namespace MyCompanyName.MyProjectName.Web.Menus
{
public class MyProjectNameMenuContributor : IMenuContributor
{
private readonly IConfigurationRoot _configurationRoot;
public MyProjectNameMenuContributor(IConfigurationRoot configurationRoot)
{
_configurationRoot = configurationRoot;
}
public async Task ConfigureMenuAsync(MenuConfigurationContext context)
{
if (context.Menu.Name == StandardMenus.Main)
@ -40,7 +50,11 @@ namespace MyCompanyName.MyProjectName.Web.Menus
private Task ConfigureUserMenuAsync(MenuConfigurationContext context)
{
var l = context.ServiceProvider.GetRequiredService<IStringLocalizer<MyProjectNameResource>>();
var accountStringLocalizer = context.ServiceProvider.GetRequiredService<IStringLocalizer<AccountResource>>();
var identityServerUrl = _configurationRoot["AuthServer:Authority"] ?? "";
context.Menu.AddItem(new ApplicationMenuItem("Account.Manage", accountStringLocalizer["ManageYourProfile"], $"{identityServerUrl.EnsureEndsWith('/')}Account/Manage", icon: "fa fa-cog", order: 1000, null, "_blank"));
context.Menu.AddItem(new ApplicationMenuItem("Account.Logout", l["Logout"], url: "/Account/Logout", icon: "fa fa-power-off", order: int.MaxValue - 1000));
return Task.CompletedTask;

7
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs

@ -75,7 +75,8 @@ namespace MyCompanyName.MyProjectName.Web
ConfigureAuthentication(context, configuration);
ConfigureAutoMapper();
ConfigureVirtualFileSystem(hostingEnvironment);
ConfigureNavigationServices();
ConfigureNavigationServices(configuration);
ConfigureSwaggerServices(context.Services);
ConfigureMultiTenancy();
//Disabled swagger since it does not support ASP.NET Core 3.0 yet!
@ -168,11 +169,11 @@ namespace MyCompanyName.MyProjectName.Web
}
}
private void ConfigureNavigationServices()
private void ConfigureNavigationServices(IConfigurationRoot configuration)
{
Configure<NavigationOptions>(options =>
{
options.MenuContributors.Add(new MyProjectNameMenuContributor());
options.MenuContributors.Add(new MyProjectNameMenuContributor(configuration));
});
}

Loading…
Cancel
Save