Skip to content

Commit

Permalink
[autofix.ci] apply automated fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-ci[bot] authored May 20, 2024
1 parent bfd0650 commit 4b3ad08
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 11 deletions.
52 changes: 44 additions & 8 deletions ee/tabby-db/src/users.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,14 @@ impl DbConn {
invitation_id: i64,
name: Option<String>,
) -> Result<i64> {
self.create_user_impl(email, password_encrypted, is_admin, Some(invitation_id), name)
.await
self.create_user_impl(
email,
password_encrypted,
is_admin,
Some(invitation_id),
name,
)
.await
}

async fn create_user_impl(
Expand Down Expand Up @@ -295,7 +301,12 @@ mod tests {
let conn = DbConn::new_in_memory().await.unwrap();

let id = conn
.create_user("[email protected]".into(), Some("123456".into()), false, Some("name1".into()))
.create_user(
"[email protected]".into(),
Some("123456".into()),
false,
Some("name1".into()),
)
.await
.unwrap();
let user = conn.get_user(id).await.unwrap().unwrap();
Expand Down Expand Up @@ -447,7 +458,12 @@ mod tests {
);

let id1 = conn
.create_user("[email protected]".into(), Some("123456".into()), false, None)
.create_user(
"[email protected]".into(),
Some("123456".into()),
false,
None,
)
.await
.unwrap();

Expand Down Expand Up @@ -516,19 +532,39 @@ mod tests {
);

let id2 = conn
.create_user("[email protected]".into(), Some("123456".into()), false, None)
.create_user(
"[email protected]".into(),
Some("123456".into()),
false,
None,
)
.await
.unwrap();
let id3 = conn
.create_user("[email protected]".into(), Some("123456".into()), false, None)
.create_user(
"[email protected]".into(),
Some("123456".into()),
false,
None,
)
.await
.unwrap();
let id4 = conn
.create_user("[email protected]".into(), Some("123456".into()), false, None)
.create_user(
"[email protected]".into(),
Some("123456".into()),
false,
None,
)
.await
.unwrap();
let id5 = conn
.create_user("[email protected]".into(), Some("123456".into()), false, None)
.create_user(
"[email protected]".into(),
Some("123456".into()),
false,
None,
)
.await
.unwrap();

Expand Down
17 changes: 14 additions & 3 deletions ee/tabby-webserver/src/service/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,8 @@ impl AuthenticationService for AuthenticationServiceImpl {
.await
.context("Failed to read license info")?;
let user_id =
get_or_create_oauth_user(&license, &self.db, &self.setting, &self.mail, &email, &name).await?;
get_or_create_oauth_user(&license, &self.db, &self.setting, &self.mail, &email, &name)
.await?;

let refresh_token = self.db.create_refresh_token(user_id).await?;

Expand Down Expand Up @@ -1361,7 +1362,12 @@ mod tests {
let (service, _mail) = test_authentication_service_with_mail().await;
let id = service
.db
.create_user("[email protected]".into(), password_hash("pass").ok(), true, None)
.create_user(
"[email protected]".into(),
password_hash("pass").ok(),
true,
None,
)
.await
.unwrap();

Expand Down Expand Up @@ -1389,7 +1395,12 @@ mod tests {

let id = service
.db
.create_user("[email protected]".into(), password_hash("pass").ok(), true, None)
.create_user(
"[email protected]".into(),
password_hash("pass").ok(),
true,
None,
)
.await
.unwrap();

Expand Down

0 comments on commit 4b3ad08

Please sign in to comment.