use Seq.has in ToptSecret.verify
This commit is contained in:
parent
bbbc135c37
commit
1e7211def1
|
@ -54,7 +54,7 @@ trait Lilaisms
|
|||
|
||||
@inline implicit def toPimpedTryList[A](l: List[Try[A]]) = new PimpedTryList(l)
|
||||
@inline implicit def toPimpedList[A](l: List[A]) = new PimpedList(l)
|
||||
@inline implicit def toPimpedSeq[A](l: List[A]) = new PimpedSeq(l)
|
||||
@inline implicit def toPimpedSeq[A](l: Seq[A]) = new PimpedSeq(l)
|
||||
@inline implicit def toPimpedByteArray(ba: Array[Byte]) = new PimpedByteArray(ba)
|
||||
|
||||
@inline implicit def toPimpedOption[A](a: Option[A]) = new PimpedOption(a)
|
||||
|
@ -72,4 +72,4 @@ trait Lilaisms
|
|||
|
||||
final class PimpedActorSystem(private val a: akka.actor.ActorSystem) extends AnyVal {
|
||||
def lilaBus = lila.common.Bus(a)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ case class TotpSecret(secret: Array[Byte]) extends AnyVal {
|
|||
|
||||
def verify(token: TotpToken): Boolean = {
|
||||
val period = System.currentTimeMillis / 30000
|
||||
(-TotpSecret.window to TotpSecret.window).map(skew => totp(period + skew)).contains(token.value)
|
||||
(-TotpSecret.window to TotpSecret.window).map(skew => totp(period + skew)).has(token)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue