mirror of
https://codeberg.org/timelimit/timelimit-server.git
synced 2026-08-31 19:03:45 +02:00
Allow adding u2f keys after sign in with key
This commit is contained in:
@@ -18,20 +18,13 @@
|
||||
import { AddParentU2fKeyAction } from '../../../../action'
|
||||
import { getU2fKeyId } from '../../../../database/u2fkey'
|
||||
import { Cache } from '../cache'
|
||||
import { ApplyActionUnacceptableAuthMethodException } from '../exception/auth'
|
||||
import { LimitReachedException } from '../exception/limit'
|
||||
import { AuthenticationMethod } from '../types'
|
||||
|
||||
export async function dispatchAddU2f ({ action, cache, parentUserId, authentication }: {
|
||||
export async function dispatchAddU2f ({ action, cache, parentUserId }: {
|
||||
action: AddParentU2fKeyAction
|
||||
cache: Cache
|
||||
parentUserId: string
|
||||
authentication: AuthenticationMethod
|
||||
}) {
|
||||
if (authentication === 'u2f') {
|
||||
throw new ApplyActionUnacceptableAuthMethodException()
|
||||
}
|
||||
|
||||
const counter = await cache.database.u2fKey.count({
|
||||
where: {
|
||||
familyId: cache.familyId
|
||||
|
||||
@@ -158,7 +158,7 @@ export const dispatchParentAction = async ({
|
||||
if (action instanceof AddCategoryNetworkIdAction) {
|
||||
return dispatchAddCategoryNetworkId({ action, cache })
|
||||
} else if (action instanceof AddParentU2fKeyAction) {
|
||||
return dispatchAddU2f({ action, cache, parentUserId, authentication })
|
||||
return dispatchAddU2f({ action, cache, parentUserId })
|
||||
} else if (action instanceof AddUserAction) {
|
||||
return dispatchAddUser({ action, cache })
|
||||
} else if (action instanceof RemoveCategoryAppsAction) {
|
||||
|
||||
Reference in New Issue
Block a user