mirror of
https://github.com/certd/certd.git
synced 2026-05-15 20:47:31 +08:00
perf: 支持passkey登录
This commit is contained in:
@@ -18,6 +18,7 @@ import { UserSettingsService } from "../../mine/service/user-settings-service.js
|
||||
import { isPlus } from "@certd/plus-core";
|
||||
import { AddonService } from "@certd/lib-server";
|
||||
import { OauthBoundService } from "./oauth-bound-service.js";
|
||||
import { PasskeyService } from "./passkey-service.js";
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -45,6 +46,9 @@ export class LoginService {
|
||||
@Inject()
|
||||
oauthBoundService: OauthBoundService;
|
||||
|
||||
@Inject()
|
||||
passkeyService: PasskeyService;
|
||||
|
||||
checkIsBlocked(username: string) {
|
||||
const blockDurationKey = `login_block_duration:${username}`;
|
||||
const value = cache.get(blockDurationKey);
|
||||
@@ -254,4 +258,10 @@ export class LoginService {
|
||||
}
|
||||
return this.generateToken(info);
|
||||
}
|
||||
}
|
||||
|
||||
async loginByPasskey(req: { credential: any; challenge: string }, ctx: any) {
|
||||
const {credential, challenge} = req;
|
||||
const user = await this.passkeyService.loginByPasskey(credential, challenge, ctx);
|
||||
return this.generateToken(user);
|
||||
}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user