Browse Source

Merge branch 'dev' into issue-18042

pull/18051/head
maliming 3 years ago
parent
commit
f441d0ac2f
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 2
      docs/en/Deployment/Index.md
  2. 3
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js
  3. 10
      framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/AppUrlProvider.cs
  4. 2
      framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/IAppUrlProvider.cs
  5. 9
      modules/cms-kit/src/Volo.CmsKit.Public.Web/Security/Captcha/SimpleMathsCaptchaGenerator.cs
  6. 10
      npm/ng-packs/packages/core/src/lib/guards/permission.guard.ts
  7. 3
      npm/ng-packs/packages/oauth/src/lib/utils/auth-utils.ts
  8. 4
      templates/app-nolayers/angular/src/environments/environment.prod.ts
  9. 4
      templates/app-nolayers/angular/src/environments/environment.ts

2
docs/en/Deployment/Index.md

@ -7,7 +7,7 @@ However, there are some topics that you should care about when you are deploying
## Guides
* [Configuring SSL certificate(HTTPS)](SSL.md): Explains how to configure SSL certificate(HTTPS) for your application.
* [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.

3
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js

@ -144,7 +144,8 @@ $.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!
var responseJSON = xhr.responseJSON ? xhr.responseJSON : JSON.parse(xhr.responseText);
abp.ajax.showError(responseJSON.error ? responseJSON.error : abp.ajax.defaultError);
return;
};

10
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<string?> NormalizeUrlAsync(string? url)
{
if (string.IsNullOrWhiteSpace(url))
{
return url;
}
return await ReplacePlaceHoldersAsync(url!);
}
protected virtual async Task<string> GetConfiguredUrl(string appName, string? urlName)
{
var url = await GetUrlOrNullAsync(appName, urlName);

2
framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/IAppUrlProvider.cs

@ -10,4 +10,6 @@ public interface IAppUrlProvider
Task<string?> GetUrlOrNullAsync([NotNull] string appName, string? urlName = null);
bool IsRedirectAllowedUrl(string url);
Task<string?> NormalizeUrlAsync(string? url);
}

9
modules/cms-kit/src/Volo.CmsKit.Public.Web/Security/Captcha/SimpleMathsCaptchaGenerator.cs

@ -166,10 +166,11 @@ public class SimpleMathsCaptchaGenerator : ITransientDependency
var x0 = random.Next(0, img.Width - 1);
var y0 = random.Next(0, img.Height - 1);
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 =>

10
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);
}
}),

3
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 {

4
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',
},
},

4
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',
},
},

Loading…
Cancel
Save