Allow to authenticate with the same account from different sources

A new config allows to treat an account same independent where it was
created (openid or local).

Issue: #1827 #1781
This commit is contained in:
eikek
2022-11-04 22:33:46 +01:00
parent 14643ae4d1
commit 8ae4c9ec78
12 changed files with 219 additions and 52 deletions

View File

@ -204,11 +204,20 @@ object RUser {
val t = Table(None)
DML.update(
t,
t.cid === collId && t.uid === userId && t.source === AccountSource.Local,
t.cid === collId && t.uid === userId,
DML.set(t.password.setTo(hashedPass))
)
}
def updateSource(
userId: Ident,
collId: CollectiveId,
source: AccountSource
): ConnectionIO[Int] = {
val t = Table(None)
DML.update(t, t.uid === userId && t.cid === collId, DML.set(t.source.setTo(source)))
}
def delete(user: Ident, coll: CollectiveId): ConnectionIO[Int] = {
val t = Table(None)
DML.delete(t, t.cid === coll && t.login === user)