Commit 82b9a2fc authored by Robert Czechowski's avatar Robert Czechowski

Do not allow login with empty group code or empty login code even if an...

Do not allow login with empty group code or empty login code even if an corresponding entry exists in the database
parent 78c2d76e
Pipeline #854 canceled with stage
...@@ -421,6 +421,10 @@ impl MedalConnection for Connection { ...@@ -421,6 +421,10 @@ impl MedalConnection for Connection {
//TODO: use session //TODO: use session
fn login_with_code(&self, _session: Option<&str>, logincode: &str) -> Result<String, ()> { fn login_with_code(&self, _session: Option<&str>, logincode: &str) -> Result<String, ()> {
if logincode == "" {
return Err(());
}
let query = "SELECT id let query = "SELECT id
FROM session FROM session
WHERE logincode = $1"; WHERE logincode = $1";
...@@ -506,6 +510,10 @@ impl MedalConnection for Connection { ...@@ -506,6 +510,10 @@ impl MedalConnection for Connection {
//TODO: use session //TODO: use session
fn create_user_with_groupcode(&self, _session: Option<&str>, groupcode: &str) -> Result<String, ()> { fn create_user_with_groupcode(&self, _session: Option<&str>, groupcode: &str) -> Result<String, ()> {
if groupcode == "" {
return Err(());
}
let query = "SELECT id let query = "SELECT id
FROM usergroup FROM usergroup
WHERE groupcode = $1"; WHERE groupcode = $1";
......
...@@ -533,6 +533,10 @@ impl MedalConnection for Connection { ...@@ -533,6 +533,10 @@ impl MedalConnection for Connection {
//TODO: use session //TODO: use session
fn login_with_code(&self, _session: Option<&str>, logincode: &str) -> Result<String, ()> { fn login_with_code(&self, _session: Option<&str>, logincode: &str) -> Result<String, ()> {
if logincode == "" {
return Err(());
}
let query = "SELECT id let query = "SELECT id
FROM session FROM session
WHERE logincode = $1"; WHERE logincode = $1";
...@@ -618,6 +622,10 @@ impl MedalConnection for Connection { ...@@ -618,6 +622,10 @@ impl MedalConnection for Connection {
//TODO: use session //TODO: use session
fn create_user_with_groupcode(&self, _session: Option<&str>, groupcode: &str) -> Result<String, ()> { fn create_user_with_groupcode(&self, _session: Option<&str>, groupcode: &str) -> Result<String, ()> {
if groupcode == "" {
return Err(());
}
let query = "SELECT id let query = "SELECT id
FROM usergroup FROM usergroup
WHERE groupcode = $1"; WHERE groupcode = $1";
......
...@@ -533,6 +533,10 @@ impl MedalConnection for Connection { ...@@ -533,6 +533,10 @@ impl MedalConnection for Connection {
//TODO: use session //TODO: use session
fn login_with_code(&self, _session: Option<&str>, logincode: &str) -> Result<String, ()> { fn login_with_code(&self, _session: Option<&str>, logincode: &str) -> Result<String, ()> {
if logincode == "" {
return Err(());
}
let query = "SELECT id let query = "SELECT id
FROM session FROM session
WHERE logincode = ?1"; WHERE logincode = ?1";
...@@ -618,6 +622,10 @@ impl MedalConnection for Connection { ...@@ -618,6 +622,10 @@ impl MedalConnection for Connection {
//TODO: use session //TODO: use session
fn create_user_with_groupcode(&self, _session: Option<&str>, groupcode: &str) -> Result<String, ()> { fn create_user_with_groupcode(&self, _session: Option<&str>, groupcode: &str) -> Result<String, ()> {
if groupcode == "" {
return Err(());
}
let query = "SELECT id let query = "SELECT id
FROM usergroup FROM usergroup
WHERE groupcode = ?1"; WHERE groupcode = ?1";
......
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