From 7168702dc49467c39c636f4ec057978352c9d9e4 Mon Sep 17 00:00:00 2001 From: genoher <1763180+genoher@users.noreply.github.com> Date: Mon, 30 Oct 2023 19:59:26 +0100 Subject: [PATCH 1/8] Show error message when open modal fails in mvc. --- .../bootstrap/modal-manager.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js index 1907ec9e23..125542371a 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js @@ -135,7 +135,7 @@ $.validator.defaults.ignore = ''; //TODO: Would be better if we can apply only f _args = args || {}; var argsWithoutFunc = {}; - for (a in _args) { + for (var a in _args) { if (_args.hasOwnProperty(a) && typeof _args[a] !== 'function') { argsWithoutFunc[a] = _args[a]; } @@ -144,8 +144,12 @@ $.validator.defaults.ignore = ''; //TODO: Would be better if we can apply only f _createContainer(_modalId) .load(options.viewUrl, $.param(argsWithoutFunc), function (response, status, xhr) { if (status === "error") { - //TODO: Handle! - return; + var error = JSON.parse(response)?.error; + if (error.details) { + return abp.message.error(error.details, error.message); + } else { + return abp.message.error(error.message || abp.ajax.defaultError.message); + } }; if (options.scriptUrl) { From 8426687b516c6995a452f2921ee69c1742e3c2b4 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Tue, 31 Oct 2023 14:37:42 +0300 Subject: [PATCH 2/8] remove ISS in in url after the login. Remove some unuseds, --- .../packages/core/src/lib/guards/permission.guard.ts | 10 +++------- .../packages/oauth/src/lib/utils/auth-utils.ts | 3 +-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/npm/ng-packs/packages/core/src/lib/guards/permission.guard.ts b/npm/ng-packs/packages/core/src/lib/guards/permission.guard.ts index ae3fdb6e37..a4576d41bf 100644 --- a/npm/ng-packs/packages/core/src/lib/guards/permission.guard.ts +++ b/npm/ng-packs/packages/core/src/lib/guards/permission.guard.ts @@ -1,13 +1,9 @@ import { Injectable, inject } from '@angular/core'; import { ActivatedRouteSnapshot, Router, RouterStateSnapshot } from '@angular/router'; import { HttpErrorResponse } from '@angular/common/http'; - import { Observable, of } from 'rxjs'; import { tap } from 'rxjs/operators'; - -import { OAuthService } from 'angular-oauth2-oidc'; - -import { IAbpGuard } from '../abstracts'; +import { AuthService, IAbpGuard } from '../abstracts'; import { findRoute, getRoutePath } from '../utils/route-utils'; import { RoutesService, PermissionService, HttpErrorReporterService } from '../services'; @@ -17,7 +13,7 @@ import { RoutesService, PermissionService, HttpErrorReporterService } from '../s export class PermissionGuard implements IAbpGuard { protected readonly router = inject(Router); protected readonly routesService = inject(RoutesService); - protected readonly oAuthService = inject(OAuthService); + protected readonly oAuthService = inject(AuthService); protected readonly permissionService = inject(PermissionService); protected readonly httpErrorReporter = inject(HttpErrorReporterService); @@ -33,7 +29,7 @@ export class PermissionGuard implements IAbpGuard { return this.permissionService.getGrantedPolicy$(requiredPolicy).pipe( tap(access => { - if (!access && this.oAuthService.hasValidAccessToken()) { + if (!access && this.oAuthService.isAuthenticated) { this.httpErrorReporter.reportError({ status: 403 } as HttpErrorResponse); } }), diff --git a/npm/ng-packs/packages/oauth/src/lib/utils/auth-utils.ts b/npm/ng-packs/packages/oauth/src/lib/utils/auth-utils.ts index f1dc5b6106..bd50e97ee7 100644 --- a/npm/ng-packs/packages/oauth/src/lib/utils/auth-utils.ts +++ b/npm/ng-packs/packages/oauth/src/lib/utils/auth-utils.ts @@ -1,6 +1,5 @@ -import { inject, Injector } from '@angular/core'; +import { Injector } from '@angular/core'; import { Router } from '@angular/router'; -import { OAuthStorage, TokenResponse } from 'angular-oauth2-oidc'; import { pipe } from 'rxjs'; import { switchMap, tap } from 'rxjs/operators'; import { From 7f244bc6174c60e19aeea33aa4f609162e4a4762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Tue, 31 Oct 2023 18:30:20 +0300 Subject: [PATCH 3/8] Update Index.md --- docs/en/Deployment/Index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/Deployment/Index.md b/docs/en/Deployment/Index.md index 3eb299b483..cae5b8282d 100644 --- a/docs/en/Deployment/Index.md +++ b/docs/en/Deployment/Index.md @@ -6,7 +6,7 @@ However, there are some topics that you should care about when you are deploying ## Guides -* [Configuring for OpenIddict](Configuring-OpenIddict.md): Notes for some essential configurations for OpenIddict. +* [Configuring OpenIddict](Configuring-OpenIddict.md): Notes for some essential configurations for OpenIddict. * [Configuring for Production](Configuring-Production.md): Notes for some essential configurations for production environments. * [Optimization for Production](Optimizing-Production.md): Tips and suggestions for optimizing your application on production environments. * [Deploying to a Clustered Environment](Clustered-Environment.md): Explains how to configure your application when you want to run multiple instances of your application concurrently. From 8399bb7983d8d3f4db084e75e0c7c6c463e05733 Mon Sep 17 00:00:00 2001 From: maliming Date: Wed, 1 Nov 2023 13:56:34 +0800 Subject: [PATCH 4/8] Update modal-manager.js --- .../bootstrap/modal-manager.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js index 125542371a..03ba2706d0 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js @@ -144,12 +144,9 @@ $.validator.defaults.ignore = ''; //TODO: Would be better if we can apply only f _createContainer(_modalId) .load(options.viewUrl, $.param(argsWithoutFunc), function (response, status, xhr) { if (status === "error") { - var error = JSON.parse(response)?.error; - if (error.details) { - return abp.message.error(error.details, error.message); - } else { - return abp.message.error(error.message || abp.ajax.defaultError.message); - } + var responseJSON = xhr.responseJSON ? xhr.responseJSON : JSON.parse(xhr.responseText); + abp.ajax.showError(responseJSON.error ? responseJSON.error : abp.ajax.defaultError); + return; }; if (options.scriptUrl) { From 35cd8523d090ceb349c1be53b0e61e32bb5fb43c Mon Sep 17 00:00:00 2001 From: Salih Date: Wed, 1 Nov 2023 10:59:31 +0300 Subject: [PATCH 5/8] Fix captcha generate error --- .../Security/Captcha/SimpleMathsCaptchaGenerator.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Security/Captcha/SimpleMathsCaptchaGenerator.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Security/Captcha/SimpleMathsCaptchaGenerator.cs index 7255b6b195..636210d0fb 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Security/Captcha/SimpleMathsCaptchaGenerator.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Security/Captcha/SimpleMathsCaptchaGenerator.cs @@ -155,10 +155,11 @@ public class SimpleMathsCaptchaGenerator : ISingletonDependency var x0 = random.Next(0, img.Width); var y0 = random.Next(0, img.Height); img.Mutate( - ctx => ctx - .DrawLine(options.NoiseRateColor[random.Next(0, options.NoiseRateColor.Length)], - RandomTextGenerator.GenerateNextFloat(0.5, 1.5), new PointF[] { new Vector2(x0, y0), new Vector2(x0, y0) }) - ); + ctx => ctx + .DrawLine(options.NoiseRateColor[random.Next(0, options.NoiseRateColor.Length)], + RandomTextGenerator.GenerateNextFloat(0.5, 1.5), + new PointF[] { new Vector2(x0, y0), new Vector2(x0 + 0.005f, y0 + 0.005f) }) + ); }); img.Mutate(x => From 547698e50a4438cf05b3a560327076217d5b0172 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Wed, 1 Nov 2023 16:40:57 +0800 Subject: [PATCH 6/8] Add NormalizeUrlAsync to IAppUrlProvider --- .../Volo/Abp/Ui/Navigation/Urls/AppUrlProvider.cs | 10 ++++++++++ .../Volo/Abp/Ui/Navigation/Urls/IAppUrlProvider.cs | 2 ++ 2 files changed, 12 insertions(+) diff --git a/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/AppUrlProvider.cs b/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/AppUrlProvider.cs index a258d3f8ab..d845f983ab 100644 --- a/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/AppUrlProvider.cs +++ b/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/AppUrlProvider.cs @@ -53,6 +53,16 @@ public class AppUrlProvider : IAppUrlProvider, ITransientDependency return allow; } + public virtual async Task NormalizeUrlAsync(string? url) + { + if (string.IsNullOrWhiteSpace(url)) + { + return url; + } + + return await ReplacePlaceHoldersAsync(url); + } + protected virtual async Task GetConfiguredUrl(string appName, string? urlName) { var url = await GetUrlOrNullAsync(appName, urlName); diff --git a/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/IAppUrlProvider.cs b/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/IAppUrlProvider.cs index 9241c5f428..4e800a524e 100644 --- a/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/IAppUrlProvider.cs +++ b/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/IAppUrlProvider.cs @@ -10,4 +10,6 @@ public interface IAppUrlProvider Task GetUrlOrNullAsync([NotNull] string appName, string? urlName = null); bool IsRedirectAllowedUrl(string url); + + Task NormalizeUrlAsync(string? url); } From 0e32ef4ba831eb6ccc171da9bd1757b1ee6adc79 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Wed, 1 Nov 2023 16:52:05 +0800 Subject: [PATCH 7/8] Update AppUrlProvider.cs --- .../Volo/Abp/Ui/Navigation/Urls/AppUrlProvider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/AppUrlProvider.cs b/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/AppUrlProvider.cs index d845f983ab..b8bebd95a5 100644 --- a/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/AppUrlProvider.cs +++ b/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/AppUrlProvider.cs @@ -60,7 +60,7 @@ public class AppUrlProvider : IAppUrlProvider, ITransientDependency return url; } - return await ReplacePlaceHoldersAsync(url); + return await ReplacePlaceHoldersAsync(url!); } protected virtual async Task GetConfiguredUrl(string appName, string? urlName) From 699f47db20beb2a7d153413d3f8fa1ba04ddfcb8 Mon Sep 17 00:00:00 2001 From: maliming Date: Wed, 1 Nov 2023 17:17:51 +0800 Subject: [PATCH 8/8] Update the angular's port of `app-nolayers` --- .../app-nolayers/angular/src/environments/environment.prod.ts | 4 ++-- .../app-nolayers/angular/src/environments/environment.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/app-nolayers/angular/src/environments/environment.prod.ts b/templates/app-nolayers/angular/src/environments/environment.prod.ts index e6cc007d52..7702e6fc43 100644 --- a/templates/app-nolayers/angular/src/environments/environment.prod.ts +++ b/templates/app-nolayers/angular/src/environments/environment.prod.ts @@ -10,7 +10,7 @@ export const environment = { logoUrl: '', }, oAuthConfig: { - issuer: 'https://localhost:44305/', + issuer: 'https://localhost:44300/', redirectUri: baseUrl, clientId: 'MyProjectName_App', responseType: 'code', @@ -19,7 +19,7 @@ export const environment = { }, apis: { default: { - url: 'https://localhost:44305', + url: 'https://localhost:44300', rootNamespace: 'MyCompanyName.MyProjectName', }, }, diff --git a/templates/app-nolayers/angular/src/environments/environment.ts b/templates/app-nolayers/angular/src/environments/environment.ts index 04dc6e89f3..f12e925ee9 100644 --- a/templates/app-nolayers/angular/src/environments/environment.ts +++ b/templates/app-nolayers/angular/src/environments/environment.ts @@ -10,7 +10,7 @@ export const environment = { logoUrl: '', }, oAuthConfig: { - issuer: 'https://localhost:44305/', + issuer: 'https://localhost:44300/', redirectUri: baseUrl, clientId: 'MyProjectName_App', responseType: 'code', @@ -19,7 +19,7 @@ export const environment = { }, apis: { default: { - url: 'https://localhost:44305', + url: 'https://localhost:44300', rootNamespace: 'MyCompanyName.MyProjectName', }, },