Adopt login process for two-factor auth

This commit is contained in:
eikek
2021-08-31 21:29:07 +02:00
parent 999c39833a
commit 1afc005a6c
14 changed files with 356 additions and 126 deletions

View File

@ -70,6 +70,16 @@ object RTotp {
}
} yield n
def isEnabled(accountId: AccountId): ConnectionIO[Boolean] = {
val t = RTotp.as("t")
val u = RUser.as("u")
Select(
select(count(t.userId)),
from(t).innerJoin(u, t.userId === u.uid),
u.login === accountId.user && u.cid === accountId.collective && t.enabled === true
).build.query[Int].unique.map(_ > 0)
}
def findEnabledByLogin(
accountId: AccountId,
enabled: Boolean