-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bfd0650
commit 4b3ad08
Showing
2 changed files
with
58 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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( | ||
|
@@ -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(); | ||
|
@@ -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(); | ||
|
||
|
@@ -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(); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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?; | ||
|
||
|
@@ -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(); | ||
|
||
|
@@ -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(); | ||
|
||
|