scala - Slick match on encrypted variable -
scala - Slick match on encrypted variable -
how select on encrypted variable slick.
i have bcrypt encoded password in database.
to illustrate intentions:
def login(name: string, password: string) = action { ... { u <- users if u.name === name && bcrypt.checkpw(password, u.password) } yield u of course of study slick complains u.password beingness lifted column , not string.
how go solve problem?
actually managed solve problem.
def login(name: string, password: string) = action { database withsession { (for { u <- users if u.name === name } yield u).list } match { case nil => ok("no user found") case head :: tail => if(bcrypt.checkpw(password, head.password)) ok("accepted").withsession("userid" -> head.id.get.tostring) else ok("incorrect password") } } scala encryption playframework-2.0 playframework-2.1 slick
Comments
Post a Comment