Browse Source

合并

pull/872/head
李宏 2 years ago
parent
commit
3b3a6a5067
  1. 2
      apps/vue/run.bat
  2. 5
      apps/vue/src/api/account/model/profilesModel.ts
  3. 9
      apps/vue/src/api/account/profiles.ts
  4. 3
      apps/vue/src/locales/lang/en/routes/basic.ts
  5. 3
      apps/vue/src/locales/lang/zh-CN/routes/basic.ts
  6. 10
      apps/vue/src/router/routes/basic.ts
  7. 67
      apps/vue/src/views/account/email-confirm/index.vue
  8. 2
      apps/vue/src/views/account/setting/SecureSetting.vue
  9. 25
      apps/vue/src/views/sys/login/PortalForm.vue
  10. 6
      aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN/Abp/Account/Dto/ConfirmEmailInput.cs
  11. 3
      aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/MyProfileAppService.cs
  12. 1
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Portal/LINGYUN.Abp.IdentityServer.Portal.csproj
  13. 2
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Portal/LINGYUN/Abp/IdentityServer/Portal/AbpIdentityServerPortalModule.cs
  14. 19
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Portal/LINGYUN/Abp/IdentityServer/Portal/PortalGrantValidator.cs
  15. 1
      aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.Portal/LINGYUN.Abp.OpenIddict.Portal.csproj
  16. 2
      aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.Portal/LINGYUN/Abp/OpenIddict/Portal/AbpOpenIddictPortalModule.cs
  17. 14
      aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.Portal/LINGYUN/Abp/OpenIddict/Portal/PortalTokenExtensionGrant.cs
  18. 15
      aspnet-core/services/LY.MicroService.AuthServer/AuthServerModule.Configure.cs
  19. 1
      aspnet-core/services/LY.MicroService.AuthServer/Pages/Account/EmailConfirm.cshtml.cs
  20. 26
      aspnet-core/services/LY.MicroService.AuthServer/appsettings.Development.json
  21. 15
      aspnet-core/services/LY.MicroService.identityServer/IdentityServerModule.Configure.cs
  22. 1
      aspnet-core/services/LY.MicroService.identityServer/Pages/Account/EmailConfirm.cshtml.cs
  23. 24
      aspnet-core/services/LY.MicroService.identityServer/appsettings.Development.json
  24. 5
      aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameEntityFrameworkCoreModule.cs

2
apps/vue/run.bat

@ -1,2 +1,2 @@
title abp-next-admin-vben title abp-next-admin-vben
npm run dev pnpm dev

5
apps/vue/src/api/account/model/profilesModel.ts

@ -33,3 +33,8 @@ export interface SendEmailConfirmCode {
returnUrl?: string; returnUrl?: string;
returnUrlHash?: string; returnUrlHash?: string;
} }
export interface ConfirmEmailInput {
userId?: string;
confirmToken: string;
}

9
apps/vue/src/api/account/profiles.ts

@ -6,6 +6,7 @@ import {
ChangePhoneNumber, ChangePhoneNumber,
TwoFactorEnabled, TwoFactorEnabled,
SendEmailConfirmCode, SendEmailConfirmCode,
ConfirmEmailInput,
} from './model/profilesModel'; } from './model/profilesModel';
enum Api { enum Api {
@ -17,6 +18,7 @@ enum Api {
GetTwoFactorEnabled = '/api/account/my-profile/two-factor', GetTwoFactorEnabled = '/api/account/my-profile/two-factor',
ChangeTwoFactorEnabled = '/api/account/my-profile/change-two-factor', ChangeTwoFactorEnabled = '/api/account/my-profile/change-two-factor',
SendEmailConfirmLink = '/api/account/my-profile/send-email-confirm-link', SendEmailConfirmLink = '/api/account/my-profile/send-email-confirm-link',
ConfirmEmail = '/api/account/my-profile/confirm-email',
} }
export const get = () => { export const get = () => {
@ -46,6 +48,13 @@ export const sendEmailConfirmLink = (input: SendEmailConfirmCode) => {
}); });
}; };
export const confirmEmail = (input: ConfirmEmailInput) => {
return defAbpHttp.put<void>({
url: Api.ConfirmEmail,
data: input,
});
};
export const sendChangePhoneNumberCode = (phoneNumber: string) => { export const sendChangePhoneNumberCode = (phoneNumber: string) => {
return defAbpHttp.post<void>({ return defAbpHttp.post<void>({
url: Api.SendChangePhoneNumberCode, url: Api.SendChangePhoneNumberCode,

3
apps/vue/src/locales/lang/en/routes/basic.ts

@ -3,5 +3,6 @@ export default {
errorLogList: 'Error Log', errorLogList: 'Error Log',
accountSetting: 'Account Setting', accountSetting: 'Account Setting',
accountCenter: 'Account Center', accountCenter: 'Account Center',
accountSecurityLogs: 'Security Logs' accountSecurityLogs: 'Security Logs',
accountEmailConfirm: 'Email Confirm'
}; };

3
apps/vue/src/locales/lang/zh-CN/routes/basic.ts

@ -3,5 +3,6 @@ export default {
errorLogList: '错误日志列表', errorLogList: '错误日志列表',
accountSetting: '个人设置', accountSetting: '个人设置',
accountCenter: '个人中心', accountCenter: '个人中心',
accountSecurityLogs: '安全日志' accountSecurityLogs: '安全日志',
accountEmailConfirm: '邮件确认'
}; };

10
apps/vue/src/router/routes/basic.ts

@ -108,6 +108,16 @@ export const ACCOUNT_CENTER_ROUTE: AppRouteRecordRaw = {
ignoreAuth: true, ignoreAuth: true,
}, },
}, },
{
path: 'email-confirm',
name: 'email-confirm',
component: () => import('/@/views/account/email-confirm/index.vue'),
meta: {
title: t('routes.basic.accountEmailConfirm'),
hideMenu: true,
ignoreAuth: true,
},
},
], ],
}; };

67
apps/vue/src/views/account/email-confirm/index.vue

@ -0,0 +1,67 @@
<template>
<div class="container">
<BasicForm @register="registerForm" />
</div>
</template>
<script lang="ts" setup>
import { onMounted } from 'vue';
import { useRoute } from "vue-router";
import { useI18n } from "/@/hooks/web/useI18n";
import { BasicForm, useForm } from '/@/components/Form/index';
import { confirmEmail } from '/@/api/account/profiles';
const route = useRoute();
const { t } = useI18n();
const [registerForm, { setFieldsValue, getFieldsValue }] = useForm({
labelWidth: 120,
showResetButton: false,
showSubmitButton: true,
submitButtonOptions: {
text: t('common.okText'),
},
submitFunc: handleSubmit,
showAdvancedButton: false,
showActionButtonGroup: true,
schemas: [
{
field: 'userId',
component: 'Input',
label: 'userId',
show: false
},
{
field: 'confirmToken',
component: 'Input',
label: 'confirmToken',
show: false
},
{
field: 'returnUrl',
component: 'Input',
label: 'returnUrl',
show: false
},
],
});
onMounted(() => {
setFieldsValue(route.query);
});
function handleSubmit(): Promise<void> {
var input = getFieldsValue();
return confirmEmail({
userId: input.userId,
confirmToken: input.confirmToken,
}).then(() => {
if (input.returnUrl) {
window.location.href = input.returnUrl;
}
});
}
</script>
<style scoped>
</style>

2
apps/vue/src/views/account/setting/SecureSetting.vue

@ -15,7 +15,7 @@
:loading="item.loading" :loading="item.loading"
@change="handleChange(item, $event)" @change="handleChange(item, $event)"
/> />
<Button v-else-if="item.extra" class="extra" type="link" :loading="item.loading" :disbled="!item.enabled" @click="toggleCommand(item)"> <Button v-else-if="item.extra && item.enabled !== false" class="extra" type="link" :loading="item.loading" @click="toggleCommand(item)">
{{ item.extra }} {{ item.extra }}
</Button> </Button>
</template> </template>

25
apps/vue/src/views/sys/login/PortalForm.vue

@ -11,21 +11,21 @@
layout="vertical" layout="vertical"
@keypress.enter="handleLogin" @keypress.enter="handleLogin"
> >
<FormItem name="userName" class="enter-x" :label="t('AbpAccount.DisplayName:UserName')"> <FormItem name="userName" class="enter-x" :label="L('DisplayName:UserName')">
<BInput <BInput
size="large" size="large"
v-model:value="formData.userName" v-model:value="formData.userName"
:placeholder="t('AbpAccount.DisplayName:UserName')" :placeholder="L('DisplayName:UserName')"
class="fix-auto-fill" class="fix-auto-fill"
/> />
</FormItem> </FormItem>
<FormItem name="password" class="enter-x" :label="t('AbpAccount.DisplayName:Password')"> <FormItem name="password" class="enter-x" :label="L('DisplayName:Password')">
<InputPassword <InputPassword
size="large" size="large"
visibilityToggle visibilityToggle
autocomplete="off" autocomplete="off"
v-model:value="formData.password" v-model:value="formData.password"
:placeholder="t('AbpAccount.DisplayName:Password')" :placeholder="L('DisplayName:Password')"
/> />
</FormItem> </FormItem>
@ -54,6 +54,7 @@
</template> </template>
</List> </List>
</BasicModal> </BasicModal>
<TwoFactorModal @register="registerTwoFactorModal" />
</template> </template>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@ -69,6 +70,7 @@
import { useMessage } from '/@/hooks/web/useMessage'; import { useMessage } from '/@/hooks/web/useMessage';
import { useGlobSetting } from '/@/hooks/setting'; import { useGlobSetting } from '/@/hooks/setting';
import { PortalLoginModel } from '/@/api/sys/model/userModel'; import { PortalLoginModel } from '/@/api/sys/model/userModel';
import TwoFactorModal from './TwoFactorModal.vue';
const FormItem = Form.Item; const FormItem = Form.Item;
const InputPassword = Input.Password; const InputPassword = Input.Password;
@ -77,6 +79,7 @@
const { notification } = useMessage(); const { notification } = useMessage();
const [registerModal, { openModal, closeModal }] = useModal(); const [registerModal, { openModal, closeModal }] = useModal();
const [registerTwoFactorModal, { openModal: openTwoFactorModal }] = useModal();
const { t } = useI18n(); const { t } = useI18n();
const { L } = useLocalization('AbpAccount'); const { L } = useLocalization('AbpAccount');
const { handleBackLogin, getLoginState } = useLoginState(); const { handleBackLogin, getLoginState } = useLoginState();
@ -134,9 +137,17 @@
duration: 3, duration: 3,
}); });
} }
} catch (error) { } catch (error: any) {
portalModel.value = JSON.parse(error as string) as PortalLoginModel[]; if (error.userId && error.twoFactorToken) {
openModal(true); openTwoFactorModal(true, {
userId: error.userId,
userName: data.userName,
password: data.password,
});
} else {
portalModel.value = JSON.parse(error as string) as PortalLoginModel[];
openModal(true);
}
// createConfirm({ // createConfirm({
// iconType: 'info', // iconType: 'info',
// title: '', // title: '',

6
aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN/Abp/Account/Dto/ConfirmEmailInput.cs

@ -1,13 +1,9 @@
using System; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
namespace LINGYUN.Abp.Account; namespace LINGYUN.Abp.Account;
public class ConfirmEmailInput public class ConfirmEmailInput
{ {
[Required]
public Guid UserId { get; set; }
[Required] [Required]
public string ConfirmToken { get; set; } public string ConfirmToken { get; set; }
} }

3
aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/MyProfileAppService.cs

@ -11,6 +11,7 @@ using Volo.Abp.Account.Localization;
using Volo.Abp.Caching; using Volo.Abp.Caching;
using Volo.Abp.Identity; using Volo.Abp.Identity;
using Volo.Abp.Settings; using Volo.Abp.Settings;
using Volo.Abp.Users;
namespace LINGYUN.Abp.Account namespace LINGYUN.Abp.Account
{ {
@ -138,7 +139,7 @@ namespace LINGYUN.Abp.Account
{ {
await IdentityOptions.SetAsync(); await IdentityOptions.SetAsync();
var user = await UserManager.GetByIdAsync(input.UserId); var user = await UserManager.GetByIdAsync(CurrentUser.GetId());
(await UserManager.ConfirmEmailAsync(user, input.ConfirmToken)).CheckErrors(); (await UserManager.ConfirmEmailAsync(user, input.ConfirmToken)).CheckErrors();

1
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Portal/LINGYUN.Abp.IdentityServer.Portal.csproj

@ -10,6 +10,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Volo.Abp.IdentityServer.Domain" Version="$(VoloAbpPackageVersion)" /> <PackageReference Include="Volo.Abp.IdentityServer.Domain" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Volo.Abp.AspNetCore.MultiTenancy" Version="$(VoloAbpPackageVersion)" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

2
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Portal/LINGYUN/Abp/IdentityServer/Portal/AbpIdentityServerPortalModule.cs

@ -1,5 +1,6 @@
using LINGYUN.Platform; using LINGYUN.Platform;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AspNetCore.MultiTenancy;
using Volo.Abp.IdentityServer; using Volo.Abp.IdentityServer;
using Volo.Abp.IdentityServer.Localization; using Volo.Abp.IdentityServer.Localization;
using Volo.Abp.Localization; using Volo.Abp.Localization;
@ -10,6 +11,7 @@ namespace LINGYUN.Abp.IdentityServer.Portal;
[DependsOn( [DependsOn(
typeof(AbpIdentityServerDomainModule), typeof(AbpIdentityServerDomainModule),
typeof(AbpAspNetCoreMultiTenancyModule),
typeof(PlatformDomainModule))] typeof(PlatformDomainModule))]
public class AbpIdentityServerPortalModule : AbpModule public class AbpIdentityServerPortalModule : AbpModule
{ {

19
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Portal/LINGYUN/Abp/IdentityServer/Portal/PortalGrantValidator.cs

@ -5,6 +5,7 @@ using IdentityServer4.Models;
using IdentityServer4.Services; using IdentityServer4.Services;
using IdentityServer4.Validation; using IdentityServer4.Validation;
using LINGYUN.Platform.Portal; using LINGYUN.Platform.Portal;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
@ -14,6 +15,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Security.Claims; using System.Security.Claims;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp.AspNetCore.MultiTenancy;
using Volo.Abp.Identity; using Volo.Abp.Identity;
using Volo.Abp.IdentityServer; using Volo.Abp.IdentityServer;
using Volo.Abp.MultiTenancy; using Volo.Abp.MultiTenancy;
@ -40,6 +42,9 @@ public class PortalGrantValidator : IExtensionGrantValidator
private readonly ICurrentTenant _currentTenant; private readonly ICurrentTenant _currentTenant;
private readonly IEnterpriseRepository _enterpriseRepository; private readonly IEnterpriseRepository _enterpriseRepository;
private readonly AbpAspNetCoreMultiTenancyOptions _multiTenancyOptions;
private readonly IHttpContextAccessor _httpContextAccessor;
public PortalGrantValidator( public PortalGrantValidator(
ILogger<PortalGrantValidator> logger, ILogger<PortalGrantValidator> logger,
IOptions<IdentityServerOptions> options, IOptions<IdentityServerOptions> options,
@ -48,7 +53,9 @@ public class PortalGrantValidator : IExtensionGrantValidator
IdentitySecurityLogManager identitySecurityLogManager, IdentitySecurityLogManager identitySecurityLogManager,
UserManager<IdentityUser> userManager, UserManager<IdentityUser> userManager,
ICurrentTenant currentTenant, ICurrentTenant currentTenant,
IEnterpriseRepository enterpriseRepository) IEnterpriseRepository enterpriseRepository,
IOptions<AbpAspNetCoreMultiTenancyOptions> multiTenancyOptions,
IHttpContextAccessor httpContextAccessor)
{ {
_logger = logger; _logger = logger;
_options = options.Value; _options = options.Value;
@ -58,6 +65,8 @@ public class PortalGrantValidator : IExtensionGrantValidator
_userManager = userManager; _userManager = userManager;
_currentTenant = currentTenant; _currentTenant = currentTenant;
_enterpriseRepository = enterpriseRepository; _enterpriseRepository = enterpriseRepository;
_multiTenancyOptions = multiTenancyOptions.Value;
_httpContextAccessor = httpContextAccessor;
} }
[UnitOfWork] [UnitOfWork]
@ -101,6 +110,14 @@ public class PortalGrantValidator : IExtensionGrantValidator
using (_currentTenant.Change(tenantId)) using (_currentTenant.Change(tenantId))
{ {
if (_httpContextAccessor.HttpContext != null)
{
AbpMultiTenancyCookieHelper.SetTenantCookie(
_httpContextAccessor.HttpContext,
tenantId,
_multiTenancyOptions.TenantKey);
}
var validatedRequest = new ValidatedTokenRequest var validatedRequest = new ValidatedTokenRequest
{ {
Raw = parameters ?? throw new ArgumentNullException(nameof(parameters)), Raw = parameters ?? throw new ArgumentNullException(nameof(parameters)),

1
aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.Portal/LINGYUN.Abp.OpenIddict.Portal.csproj

@ -10,6 +10,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Volo.Abp.OpenIddict.AspNetCore" Version="$(VoloAbpPackageVersion)" /> <PackageReference Include="Volo.Abp.OpenIddict.AspNetCore" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Volo.Abp.AspNetCore.MultiTenancy" Version="$(VoloAbpPackageVersion)" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

2
aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.Portal/LINGYUN/Abp/OpenIddict/Portal/AbpOpenIddictPortalModule.cs

@ -1,5 +1,6 @@
using LINGYUN.Platform; using LINGYUN.Platform;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AspNetCore.MultiTenancy;
using Volo.Abp.Modularity; using Volo.Abp.Modularity;
using Volo.Abp.OpenIddict; using Volo.Abp.OpenIddict;
using Volo.Abp.OpenIddict.ExtensionGrantTypes; using Volo.Abp.OpenIddict.ExtensionGrantTypes;
@ -8,6 +9,7 @@ namespace LINGYUN.Abp.OpenIddict.Portal;
[DependsOn( [DependsOn(
typeof(AbpOpenIddictAspNetCoreModule), typeof(AbpOpenIddictAspNetCoreModule),
typeof(AbpAspNetCoreMultiTenancyModule),
typeof(PlatformDomainModule))] typeof(PlatformDomainModule))]
public class AbpOpenIddictPortalModule : AbpModule public class AbpOpenIddictPortalModule : AbpModule
{ {

14
aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.Portal/LINGYUN/Abp/OpenIddict/Portal/PortalTokenExtensionGrant.cs

@ -1,5 +1,6 @@
using LINGYUN.Platform.Portal; using LINGYUN.Platform.Portal;
using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
@ -46,7 +47,6 @@ public class PortalTokenExtensionGrant : ITokenExtensionGrant
protected IOptions<IdentityOptions> IdentityOptions => LazyServiceProvider.LazyGetRequiredService<IOptions<IdentityOptions>>(); protected IOptions<IdentityOptions> IdentityOptions => LazyServiceProvider.LazyGetRequiredService<IOptions<IdentityOptions>>();
protected IOptions<AbpAspNetCoreMultiTenancyOptions> MultiTenancyOptions => LazyServiceProvider.LazyGetRequiredService<IOptions<AbpAspNetCoreMultiTenancyOptions>>(); protected IOptions<AbpAspNetCoreMultiTenancyOptions> MultiTenancyOptions => LazyServiceProvider.LazyGetRequiredService<IOptions<AbpAspNetCoreMultiTenancyOptions>>();
protected IdentitySecurityLogManager IdentitySecurityLogManager => LazyServiceProvider.LazyGetRequiredService<IdentitySecurityLogManager>(); protected IdentitySecurityLogManager IdentitySecurityLogManager => LazyServiceProvider.LazyGetRequiredService<IdentitySecurityLogManager>();
public async virtual Task<IActionResult> HandleAsync(ExtensionGrantContext context) public async virtual Task<IActionResult> HandleAsync(ExtensionGrantContext context)
{ {
LazyServiceProvider = context.HttpContext.RequestServices.GetRequiredService<IAbpLazyServiceProvider>(); LazyServiceProvider = context.HttpContext.RequestServices.GetRequiredService<IAbpLazyServiceProvider>();
@ -83,6 +83,10 @@ public class PortalTokenExtensionGrant : ITokenExtensionGrant
using (CurrentTenant.Change(tenantId)) using (CurrentTenant.Change(tenantId))
{ {
AbpMultiTenancyCookieHelper.SetTenantCookie(
context.HttpContext,
tenantId,
MultiTenancyOptions.Value.TenantKey);
return await HandlePasswordAsync(context); return await HandlePasswordAsync(context);
} }
} }
@ -281,14 +285,6 @@ public class PortalTokenExtensionGrant : ITokenExtensionGrant
} }
); );
if (user.TenantId.HasValue)
{
AbpMultiTenancyCookieHelper.SetTenantCookie(
context.HttpContext,
user.TenantId,
MultiTenancyOptions.Value.TenantKey);
}
return new Microsoft.AspNetCore.Mvc.SignInResult(OpenIddictServerAspNetCoreDefaults.AuthenticationScheme, principal); return new Microsoft.AspNetCore.Mvc.SignInResult(OpenIddictServerAspNetCoreDefaults.AuthenticationScheme, principal);
} }

15
aspnet-core/services/LY.MicroService.AuthServer/AuthServerModule.Configure.cs

@ -36,6 +36,7 @@ using Volo.Abp.OpenIddict;
using Volo.Abp.Threading; using Volo.Abp.Threading;
using Volo.Abp.UI.Navigation.Urls; using Volo.Abp.UI.Navigation.Urls;
using Volo.Abp.VirtualFileSystem; using Volo.Abp.VirtualFileSystem;
using LINGYUN.Abp.Account;
namespace LY.MicroService.AuthServer; namespace LY.MicroService.AuthServer;
@ -289,11 +290,15 @@ public partial class AuthServerModule
{ {
Configure<AppUrlOptions>(options => Configure<AppUrlOptions>(options =>
{ {
options.Applications["MVC"].RootUrl = configuration["App:SelfUrl"]; var applicationConfiguration = configuration.GetSection("App:Urls:Applications");
options.Applications["STS"].RootUrl = configuration["App:StsUrl"]; foreach (var appConfig in applicationConfiguration.GetChildren())
{
options.Applications["MVC"].Urls["EmailVerifyLogin"] = "Account/VerifyCode"; options.Applications[appConfig.Key].RootUrl = appConfig["RootUrl"];
options.Applications["MVC"].Urls["EmailConfirm"] = "Account/EmailConfirm"; foreach (var urlsConfig in appConfig.GetSection("Urls").GetChildren())
{
options.Applications[appConfig.Key].Urls[urlsConfig.Key] = urlsConfig.Value;
}
}
}); });
} }
private void ConfigureSecurity(IServiceCollection services, IConfiguration configuration, bool isDevelopment = false) private void ConfigureSecurity(IServiceCollection services, IConfiguration configuration, bool isDevelopment = false)

1
aspnet-core/services/LY.MicroService.AuthServer/Pages/Account/EmailConfirm.cshtml.cs

@ -46,7 +46,6 @@ namespace LY.MicroService.AuthServer.Pages.Account
await MyProfileAppService.ConfirmEmailAsync( await MyProfileAppService.ConfirmEmailAsync(
new ConfirmEmailInput new ConfirmEmailInput
{ {
UserId = UserId,
ConfirmToken = ConfirmToken, ConfirmToken = ConfirmToken,
}); });
} }

26
aspnet-core/services/LY.MicroService.AuthServer/appsettings.Development.json

@ -9,11 +9,29 @@
"tag": "AuthServer" "tag": "AuthServer"
}, },
"App": { "App": {
"SelfUrl": "http://127.0.0.1:44385/", "CorsOrigins": "http://127.0.0.1:3100",
"StsUrl": "http://127.0.0.1:44385/", "Urls": {
"CorsOrigins": "http://127.0.0.1:3100" "Applications": {
"MVC": {
"RootUrl": "http://127.0.0.1:44385/",
"Urls": {
"Abp.Account.EmailConfirm": "Account/EmailConfirm",
"Abp.Account.EmailVerifyLogin": "Account/VerifyCode"
}
},
"STS": {
"RootUrl": "http://127.0.0.1:44385/"
},
"VueVbenAdmin": {
"RootUrl": "http://127.0.0.1:3100/",
"Urls": {
"Abp.Account.EmailConfirm": "account/email-confirm",
"Abp.Account.EmailVerifyLogin": "account/verify-code"
}
}
}
}
}, },
"AppSelfUrl": "http://127.0.0.1:44385/",
"Auditing": { "Auditing": {
"AllEntitiesSelector": true "AllEntitiesSelector": true
}, },

15
aspnet-core/services/LY.MicroService.identityServer/IdentityServerModule.Configure.cs

@ -17,6 +17,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using StackExchange.Redis; using StackExchange.Redis;
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography.X509Certificates;
@ -247,11 +248,15 @@ public partial class IdentityServerModule
{ {
Configure<AppUrlOptions>(options => Configure<AppUrlOptions>(options =>
{ {
options.Applications["MVC"].RootUrl = configuration["App:SelfUrl"]; var applicationConfiguration = configuration.GetSection("App:Urls:Applications");
options.Applications["STS"].RootUrl = configuration["App:StsUrl"]; foreach (var appConfig in applicationConfiguration.GetChildren())
{
options.Applications["MVC"].Urls[AccountUrlNames.EmailVerifyLogin] = "Account/VerifyCode"; options.Applications[appConfig.Key].RootUrl = appConfig["RootUrl"];
options.Applications["MVC"].Urls[AccountUrlNames.EmailConfirm] = "Account/EmailConfirm"; foreach (var urlsConfig in appConfig.GetSection("Urls").GetChildren())
{
options.Applications[appConfig.Key].Urls[urlsConfig.Key] = urlsConfig.Value;
}
}
}); });
} }
private void ConfigureSecurity(IServiceCollection services, IConfiguration configuration, bool isDevelopment = false) private void ConfigureSecurity(IServiceCollection services, IConfiguration configuration, bool isDevelopment = false)

1
aspnet-core/services/LY.MicroService.identityServer/Pages/Account/EmailConfirm.cshtml.cs

@ -46,7 +46,6 @@ namespace LY.MicroService.IdentityServer.Pages.Account
await MyProfileAppService.ConfirmEmailAsync( await MyProfileAppService.ConfirmEmailAsync(
new ConfirmEmailInput new ConfirmEmailInput
{ {
UserId = UserId,
ConfirmToken = ConfirmToken, ConfirmToken = ConfirmToken,
}); });
} }

24
aspnet-core/services/LY.MicroService.identityServer/appsettings.Development.json

@ -9,12 +9,28 @@
"tag": "AuthServer" "tag": "AuthServer"
}, },
"App": { "App": {
"SelfUrl": "http://127.0.0.1:44385/",
"StsUrl": "http://127.0.0.1:44385/",
"CorsOrigins": "http://127.0.0.1:3100", "CorsOrigins": "http://127.0.0.1:3100",
"ShowPii": true "Urls": {
"Applications": {
"MVC": {
"RootUrl": "http://127.0.0.1:44385/",
"Urls": {
"Abp.Account.EmailConfirm": "Account/EmailConfirm",
"Abp.Account.EmailVerifyLogin": "Account/VerifyCode"
}
},
"STS": {
"RootUrl": "http://127.0.0.1:44385/"
},
"VueVbenAdmin": {
"RootUrl": "http://127.0.0.1:3100/",
"Urls": {
"Abp.Account.EmailConfirm": "account/email-confirm"
}
}
}
}
}, },
"AppSelfUrl": "http://127.0.0.1:44385/",
"Auditing": { "Auditing": {
"AllEntitiesSelector": true "AllEntitiesSelector": true
}, },

5
aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameEntityFrameworkCoreModule.cs

@ -45,14 +45,19 @@ public class ProjectNameEntityFrameworkCoreModule : AbpModule
Configure<AbpDbContextOptions>(options => Configure<AbpDbContextOptions>(options =>
{ {
#if MySQL #if MySQL
options.UseMySQL();
options.UseMySQL<ProjectNameDbContext>(); options.UseMySQL<ProjectNameDbContext>();
#elif SqlServer #elif SqlServer
options.UseSqlServer();
options.UseSqlServer<ProjectNameDbContext>(); options.UseSqlServer<ProjectNameDbContext>();
#elif Sqlite #elif Sqlite
options.UseSqlite();
options.UseSqlite<ProjectNameDbContext>(); options.UseSqlite<ProjectNameDbContext>();
#elif Oracle || OracleDevart #elif Oracle || OracleDevart
options.UseOracle();
options.UseOracle<ProjectNameDbContext>(); options.UseOracle<ProjectNameDbContext>();
#elif PostgreSql #elif PostgreSql
options.UseNpgsql();
options.UseNpgsql<ProjectNameDbContext>(); options.UseNpgsql<ProjectNameDbContext>();
#endif #endif
}); });

Loading…
Cancel
Save