Commit a09e441b authored by Fjen Undso's avatar Fjen Undso
Browse files

Controllers: check if session is open when adding votes/questions

parent eef1b57e
......@@ -12,10 +12,14 @@ import play.mvc.Result;
public class QuestionController extends Controller {
public static Result createAnswer(String sid) {
// TODO: open check
Session session = Session.find.byId(sid);
if (session == null) {
return notFound("session not found");
}
if (!session.open) {
return forbidden("session not open");
}
JsonNode json = request().body().asJson();
if (json == null) {
......
......@@ -15,6 +15,9 @@ public class VoteController extends Controller {
if (session == null) {
return notFound("session not found");
}
if (!session.open) {
return forbidden("session not open");
}
JsonNode json = request().body().asJson();
if (json == null) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment