Commit 1a91b49b authored by Robert Czechowski's avatar Robert Czechowski
Browse files

Allow not-logged-in users to start unlimited contests

parent 3736ffba
......@@ -133,13 +133,18 @@ pub fn show_contest<T: MedalConnection>(conn: &T, contest_id: u32, session_token
data.insert("contest".to_string(), to_json(&ci));
data.insert("logged_in".to_string(), to_json(&false));
data.insert("can_start".to_string(), to_json(&false));
if let Some(session) = conn.get_session(&session_token) {
data.insert("logged_in".to_string(), to_json(&true));
data.insert("can_start".to_string(), to_json(&true));
data.insert("username".to_string(), to_json(&session.username));
data.insert("firstname".to_string(), to_json(&session.firstname));
data.insert("lastname".to_string(), to_json(&session.lastname));
data.insert("teacher".to_string(), to_json(&session.is_teacher));
}
if c.duration == 0 {
data.insert("can_start".to_string(), to_json(&true));
}
match conn.get_participation(&session_token, contest_id) {
None => Ok(("contest".to_owned(), data)),
......
......@@ -31,7 +31,7 @@
{{else}}
{{#if logged_in}}
{{#if can_start}}
<p>
<form action="" method="post">
<input type="hidden" name="csrftoken" value="{{csrftoken}}">
......
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