Commit 2bb66a73 authored by Robert Czechowski's avatar Robert Czechowski
Browse files

Fix: Login not necessary to load and save tasks

parent 15685db2
Pipeline #246 failed with stages
in 2 minutes and 9 seconds
...@@ -392,7 +392,7 @@ pub fn logout<T: MedalConnection>(conn: &T, session_token: Option<String>) { ...@@ -392,7 +392,7 @@ pub fn logout<T: MedalConnection>(conn: &T, session_token: Option<String>) {
pub fn load_submission<T: MedalConnection>(conn: &T, task_id: i32, session_token: &str, subtask: Option<String>) pub fn load_submission<T: MedalConnection>(conn: &T, task_id: i32, session_token: &str, subtask: Option<String>)
-> MedalResult<String> { -> MedalResult<String> {
let session = conn.get_session(&session_token).ensure_logged_in().ok_or(MedalError::NotLoggedIn)?; let session = conn.get_session(&session_token).ensure_alive().ok_or(MedalError::NotLoggedIn)?;
match match subtask { match match subtask {
Some(s) => conn.load_submission(&session, task_id, Some(&s)), Some(s) => conn.load_submission(&session, task_id, Some(&s)),
...@@ -407,7 +407,7 @@ pub fn save_submission<T: MedalConnection>(conn: &T, task_id: i32, session_token ...@@ -407,7 +407,7 @@ pub fn save_submission<T: MedalConnection>(conn: &T, task_id: i32, session_token
data: String, grade: i32, subtask: Option<String>) data: String, grade: i32, subtask: Option<String>)
-> MedalResult<String> -> MedalResult<String>
{ {
let session = conn.get_session(&session_token).ensure_logged_in().ok_or(MedalError::NotLoggedIn)?; let session = conn.get_session(&session_token).ensure_alive().ok_or(MedalError::NotLoggedIn)?;
if session.csrf_token != csrf_token { if session.csrf_token != csrf_token {
return Err(MedalError::CsrfCheckFailed); return Err(MedalError::CsrfCheckFailed);
......
Markdown is supported
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