make sure the mobile anonymous user has an sid cookie
This commit is contained in:
parent
78163e4575
commit
086a684641
|
@ -32,24 +32,30 @@ object Account extends LilaController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def info = Auth { implicit ctx =>
|
def info = Open { implicit ctx =>
|
||||||
me =>
|
negotiate(
|
||||||
negotiate(
|
html = notFound,
|
||||||
html = notFound,
|
api = _ => ctx.me match {
|
||||||
api = _ =>
|
case None => fuccess {
|
||||||
Env.pref.api getPref me flatMap { prefs =>
|
ctx.req.session.data.contains(LilaCookie.sessionId).fold(
|
||||||
lila.game.GameRepo urgentGames me map { povs =>
|
unauthorizedApiResult,
|
||||||
Env.current.bus.publish(lila.user.User.Active(me), 'userActive)
|
unauthorizedApiResult withCookies LilaCookie.makeSessionId(ctx.req)
|
||||||
Ok {
|
)
|
||||||
import play.api.libs.json._
|
}
|
||||||
import lila.pref.JsonView._
|
case Some(me) => Env.pref.api getPref me flatMap { prefs =>
|
||||||
Env.user.jsonView(me, extended = true) ++ Json.obj(
|
lila.game.GameRepo urgentGames me map { povs =>
|
||||||
"prefs" -> prefs,
|
Env.current.bus.publish(lila.user.User.Active(me), 'userActive)
|
||||||
"nowPlaying" -> JsArray(povs take 20 map Env.api.lobbyApi.nowPlaying))
|
Ok {
|
||||||
}
|
import play.api.libs.json._
|
||||||
|
import lila.pref.JsonView._
|
||||||
|
Env.user.jsonView(me, extended = true) ++ Json.obj(
|
||||||
|
"prefs" -> prefs,
|
||||||
|
"nowPlaying" -> JsArray(povs take 20 map Env.api.lobbyApi.nowPlaying))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
def passwd = Auth { implicit ctx =>
|
def passwd = Auth { implicit ctx =>
|
||||||
|
|
|
@ -246,9 +246,11 @@ private[controllers] trait LilaController
|
||||||
implicit val req = ctx.req
|
implicit val req = ctx.req
|
||||||
Redirect(routes.Auth.signup) withCookies LilaCookie.session(Env.security.api.AccessUri, req.uri)
|
Redirect(routes.Auth.signup) withCookies LilaCookie.session(Env.security.api.AccessUri, req.uri)
|
||||||
},
|
},
|
||||||
api = _ => Unauthorized(Json.obj("error" -> "Login required")).fuccess
|
api = _ => unauthorizedApiResult.fuccess
|
||||||
)
|
)
|
||||||
|
|
||||||
|
protected val unauthorizedApiResult = Unauthorized(Json.obj("error" -> "Login required"))
|
||||||
|
|
||||||
protected def authorizationFailed(req: RequestHeader): Result =
|
protected def authorizationFailed(req: RequestHeader): Result =
|
||||||
Forbidden("no permission")
|
Forbidden("no permission")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue