Revert "remove code duplication"

This reverts commit e919d3a847.
This commit is contained in:
Thibault Duplessis 2017-10-17 11:51:20 -05:00
parent e919d3a847
commit 7768eb7b50

View file

@ -38,8 +38,10 @@ final class Authenticator(
// This creates a bcrypt hash using the existing sha as input,
// allowing us to migrate all users in bulk.
def upgradePassword(a: AuthData): Funit = (a.bpass, a.password) match {
case (None, Some(shaHash)) => setPassword(a._id, ClearPassword(shaHash)).void >>-
lila.mon.user.auth.shaBcUpgrade()
case (None, Some(shaHash)) => userRepo.coll.update(
$id(a._id),
$set(F.bpass -> passEnc(ClearPassword(shaHash)).bytes) ++ $unset(F.password)
).void >>- lila.mon.user.auth.shaBcUpgrade()
case _ => funit
}