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

Fix: Panic on login when username but no password stored in database (possible...

Fix: Panic on login when username but no password stored in database (possible due to import from foreign contest)
parent 275ec95a
......@@ -367,8 +367,8 @@ impl MedalConnection for Connection {
//password_hash ist das, was in der Datenbank steht
if helpers::verify_password(&password,
&salt.expect("salt from database empty"),
&password_hash.expect("password from database empty"))
&salt.ok_or_else(|| println!("salt from database empty"))?,
&password_hash.ok_or_else(|| println!("password from database empty"))?)
{
// TODO: fail more pleasantly
// Login okay, update session now!
......
......@@ -463,8 +463,8 @@ impl MedalConnection for Connection {
//password_hash ist das, was in der Datenbank steht
if helpers::verify_password(&password,
&salt.expect("salt from database empty"),
&password_hash.expect("password from database empty"))
&salt.ok_or_else(|| println!("salt from database empty"))?,
&password_hash.ok_or_else(|| println!("password from database empty"))?)
{
// TODO: fail more pleasantly
// Login okay, update session now!
......@@ -811,9 +811,9 @@ impl MedalConnection for Connection {
ORDER BY taskgroup.positionalnumber";
let gradeinfo =
self.query_map_many(query, &[&session_token, &contest_id, &true], |row| Grade { taskgroup: row.get(0),
user: row.get(1),
grade: row.get(2),
validated: row.get(3) })
user: row.get(1),
grade: row.get(2),
validated: row.get(3) })
.unwrap();
let gradeinfo_iter = gradeinfo.iter();
......
......@@ -463,8 +463,8 @@ impl MedalConnection for Connection {
//password_hash ist das, was in der Datenbank steht
if helpers::verify_password(&password,
&salt.expect("salt from database empty"),
&password_hash.expect("password from database empty"))
&salt.ok_or_else(|| println!("salt from database empty"))?,
&password_hash.ok_or_else(|| println!("password from database empty"))?)
{
// TODO: fail more pleasantly
// Login okay, update session now!
......@@ -811,9 +811,9 @@ impl MedalConnection for Connection {
ORDER BY taskgroup.positionalnumber";
let gradeinfo =
self.query_map_many(query, &[&session_token, &contest_id, &true], |row| Grade { taskgroup: row.get(0),
user: row.get(1),
grade: row.get(2),
validated: row.get(3) })
user: row.get(1),
grade: row.get(2),
validated: row.get(3) })
.unwrap();
let gradeinfo_iter = gradeinfo.iter();
......
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