Skip to content

Commit 3243fef

Browse files
authored
Merge pull request #1491 from colinin/fix-issues
fix: Fix some issues
2 parents 9a0722b + c94b098 commit 3243fef

3 files changed

Lines changed: 47 additions & 1 deletion

File tree

aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore.MySql/SingleMigrationsEntityFrameworkCoreMySqlModule.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
using Volo.Abp.EntityFrameworkCore;
99
using Volo.Abp.Guids;
1010
using Volo.Abp.Modularity;
11+
using Volo.Abp.OpenIddict.EntityFrameworkCore;
12+
using Volo.Abp.OpenIddict.Tokens;
1113

1214
namespace LY.MicroService.Applications.Single.EntityFrameworkCore.MySql;
1315

@@ -64,6 +66,11 @@ public override void ConfigureServices(ServiceConfigurationContext context)
6466
options.DefaultSequentialGuidType = SequentialGuidType.SequentialAsString;
6567
}
6668
});
69+
70+
context.Services.AddAbpDbContext<OpenIddictDbContext>(options =>
71+
{
72+
options.AddRepository<OpenIddictToken, EfCoreMySqlOpenIddictTokenRepository>();
73+
});
6774
}
6875
}
6976
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using Microsoft.EntityFrameworkCore;
2+
using OpenIddict.Abstractions;
3+
using System;
4+
using System.Linq;
5+
using System.Threading;
6+
using System.Threading.Tasks;
7+
using Volo.Abp.EntityFrameworkCore;
8+
using Volo.Abp.OpenIddict.Authorizations;
9+
using Volo.Abp.OpenIddict.EntityFrameworkCore;
10+
11+
namespace Volo.Abp.OpenIddict.Tokens;
12+
13+
public class EfCoreMySqlOpenIddictTokenRepository : EfCoreOpenIddictTokenRepository
14+
{
15+
public EfCoreMySqlOpenIddictTokenRepository(
16+
IDbContextProvider<IOpenIddictDbContext> dbContextProvider)
17+
: base(dbContextProvider)
18+
{
19+
}
20+
21+
public async override Task<long> PruneAsync(DateTime date, CancellationToken cancellationToken = default)
22+
{
23+
var dbContext = await GetDbContextAsync();
24+
var tokens = await (from token in dbContext.Set<OpenIddictToken>()
25+
join authorization in dbContext.Set<OpenIddictAuthorization>()
26+
on token.AuthorizationId equals authorization.Id into tokenAuthorizations
27+
from tokenAuthorization in tokenAuthorizations.DefaultIfEmpty()
28+
where token.CreationDate < date
29+
where (token.Status != OpenIddictConstants.Statuses.Inactive && token.Status != OpenIddictConstants.Statuses.Valid) ||
30+
(tokenAuthorization != null && tokenAuthorization.Status != OpenIddictConstants.Statuses.Valid) ||
31+
token.ExpirationDate < DateTime.UtcNow
32+
select token)
33+
.ToListAsync(GetCancellationToken(cancellationToken));
34+
35+
await DeleteManyAsync(tokens, cancellationToken: GetCancellationToken(cancellationToken));
36+
37+
return tokens.Count;
38+
}
39+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public async virtual Task SendChangePhoneNumberCodeAsync(SendChangePhoneNumberCo
140140
var interval = await SettingProvider.GetAsync(Identity.Settings.IdentitySettingNames.User.SmsRepetInterval, 1);
141141
if (securityTokenCacheItem != null)
142142
{
143-
throw new UserFriendlyException(L["SendRepeatPhoneVerifyCode", interval]);
143+
throw new UserFriendlyException(L["SendRepeatSmsVerifyCode", interval]);
144144
}
145145

146146
// 是否已有用户使用手机号绑定

0 commit comments

Comments
 (0)