Commit 2180d9e8 authored by Robert Czechowski's avatar Robert Czechowski

Fix clippy lint about too many arguments in login_foreign

parent 0e6f5640
Pipeline #690 passed with stages
in 28 minutes and 10 seconds
......@@ -1259,15 +1259,15 @@ pub fn login_oauth<T: MedalConnection>(conn: &T, user_data: ForeignUserData, oau
match conn.login_foreign(None,
&oauth_provider_id,
&user_data.foreign_id,
user_data.foreign_type != UserType::User,
user_data.foreign_type == UserType::Admin,
&user_data.firstname,
&user_data.lastname,
match user_data.sex {
UserSex::Male => Some(1),
UserSex::Female => Some(2),
UserSex::Unknown => Some(0),
}) {
(user_data.foreign_type != UserType::User,
user_data.foreign_type == UserType::Admin,
&user_data.firstname,
&user_data.lastname,
match user_data.sex {
UserSex::Male => Some(1),
UserSex::Female => Some(2),
UserSex::Unknown => Some(0),
})) {
Ok(session_token) => Ok(session_token),
Err(()) => {
let mut data = json_val::Map::new();
......
......@@ -441,8 +441,8 @@ impl MedalConnection for Connection {
}
//TODO: use session
fn login_foreign(&self, _session: Option<&str>, provider_id: &str, foreign_id: &str, is_teacher: bool,
is_admin: bool, firstname: &str, lastname: &str, sex: Option<i32>)
fn login_foreign(&self, _session: Option<&str>, provider_id: &str, foreign_id: &str,
(is_teacher, is_admin, firstname, lastname, sex): (bool, bool, &str, &str, Option<i32>))
-> Result<String, ()>
{
let session_token = helpers::make_session_token();
......@@ -459,7 +459,17 @@ impl MedalConnection for Connection {
SET session_token = $1, csrf_token = $2, last_login = $3, last_activity = $3,
is_teacher = $4, is_admin = $5, firstname = $6, lastname = $7, sex = $8
WHERE id = $9";
self.execute(query, &[&session_token, &csrf_token, &now, &is_teacher, &is_admin, &firstname, &lastname, &sex, &id]).unwrap();
self.execute(query,
&[&session_token,
&csrf_token,
&now,
&is_teacher,
&is_admin,
&firstname,
&lastname,
&sex,
&id])
.unwrap();
Ok(session_token)
}
......
......@@ -32,8 +32,8 @@ pub trait MedalConnection {
fn login(&self, session: Option<&str>, username: &str, password: &str) -> Result<String, ()>;
fn login_with_code(&self, session: Option<&str>, logincode: &str) -> Result<String, ()>;
fn login_foreign(&self, session: Option<&str>, provider_id: &str, foreign_id: &str, is_teacher: bool,
is_admin: bool, firstname: &str, lastname: &str, sex: Option<i32>)
fn login_foreign(&self, session: Option<&str>, provider_id: &str, foreign_id: &str,
_: (bool, bool, &str, &str, Option<i32>))
-> Result<String, ()>;
fn create_user_with_groupcode(&self, session: Option<&str>, groupcode: &str) -> Result<String, ()>;
fn create_group_with_users(&self, group: Group);
......
......@@ -551,8 +551,8 @@ impl MedalConnection for Connection {
}
//TODO: use session
fn login_foreign(&self, _session: Option<&str>, provider_id: &str, foreign_id: &str, is_teacher: bool,
is_admin: bool, firstname: &str, lastname: &str, sex: Option<i32>)
fn login_foreign(&self, _session: Option<&str>, provider_id: &str, foreign_id: &str,
(is_teacher, is_admin, firstname, lastname, sex): (bool, bool, &str, &str, Option<i32>))
-> Result<String, ()>
{
let session_token = helpers::make_session_token();
......
......@@ -551,8 +551,8 @@ impl MedalConnection for Connection {
}
//TODO: use session
fn login_foreign(&self, _session: Option<&str>, provider_id: &str, foreign_id: &str, is_teacher: bool,
is_admin: bool, firstname: &str, lastname: &str, sex: Option<i32>)
fn login_foreign(&self, _session: Option<&str>, provider_id: &str, foreign_id: &str,
(is_teacher, is_admin, firstname, lastname, sex): (bool, bool, &str, &str, Option<i32>))
-> Result<String, ()>
{
let session_token = helpers::make_session_token();
......
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