only lowercase usernames in security db

This commit is contained in:
Thibault Duplessis 2013-05-31 16:46:20 +02:00
parent 0b75ca0f13
commit f2a83824c1
3 changed files with 4 additions and 5 deletions

View file

@ -20,7 +20,7 @@ private[security] final class Api(firewall: Firewall) {
def saveAuthentication(username: String)(implicit req: RequestHeader): Fu[String] = {
val sessionId = Random nextString 12
Store.save(sessionId, username, req) inject sessionId
Store.save(sessionId, username.toLowerCase, req) inject sessionId
}
// blocking function, required by Play2 form
@ -30,8 +30,8 @@ private[security] final class Api(firewall: Firewall) {
def restoreUser(req: RequestHeader): Fu[Option[User]] =
firewall accepts req flatMap {
_ ?? {
req.session.get("sessionId").fold(fuccess(none[User])) { sessionId
Store userId sessionId flatMap { _.??(UserRepo.named) }
req.session.get("sessionId") ?? { sessionId
Store userId sessionId flatMap { _ ?? UserRepo.byId }
}
}
}

View file

@ -17,7 +17,7 @@ object Store {
type IP = String
def save(sessionId: String, userId: String, req: RequestHeader): Funit =
private[security] def save(sessionId: String, userId: String, req: RequestHeader): Funit =
$insert(Json.obj(
"_id" -> sessionId,
"user" -> userId,

1
todo
View file

@ -69,7 +69,6 @@ the forum search user:mephostophilis returns no result
check team average elo http://en.lichess.org/inbox/benuegti#bottom
if game ends during move -> bug
LilaError['[analysis] fred65 already analyses ueogn4fr, won't process ueogn4fr']
link http://webchat.freenode.net/?channels=lichess
"continue from here" does not continue from current pos. also should lazy load fen
---