Disable OAuth account deduplication by email (#1419)
* Disable OAuth account deduplication by email We intend to add explicit OAuth account linking in the future to replace this issue. * remove unused function find_user_by_email
This commit is contained in:
@@ -1,58 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n SELECT\n id AS \"id!: Uuid\",\n email AS \"email!\",\n first_name AS \"first_name?\",\n last_name AS \"last_name?\",\n username AS \"username?\",\n created_at AS \"created_at!\",\n updated_at AS \"updated_at!\"\n FROM users\n WHERE lower(email) = lower($1)\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id!: Uuid",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "email!",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "first_name?",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "last_name?",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "username?",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "created_at!",
|
||||
"type_info": "Timestamptz"
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "updated_at!",
|
||||
"type_info": "Timestamptz"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Text"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "f084eebbcd2ba73ab4783bccc0b665b47bf2dd72b82c08847f0de58425d9eb6a"
|
||||
}
|
||||
@@ -439,13 +439,7 @@ impl OAuthHandoffService {
|
||||
|
||||
let user_id = match existing_account {
|
||||
Some(account) => account.user_id,
|
||||
None => {
|
||||
if let Some(found) = user_repo.find_user_by_email(&email).await? {
|
||||
found.id
|
||||
} else {
|
||||
Uuid::new_v4()
|
||||
}
|
||||
}
|
||||
None => Uuid::new_v4(),
|
||||
};
|
||||
|
||||
let (first_name, last_name) = split_name(profile.name.as_deref());
|
||||
|
||||
@@ -72,28 +72,6 @@ impl<'a> UserRepository<'a> {
|
||||
.ok_or(IdentityError::NotFound)
|
||||
}
|
||||
|
||||
pub async fn find_user_by_email(&self, email: &str) -> Result<Option<User>, IdentityError> {
|
||||
sqlx::query_as!(
|
||||
User,
|
||||
r#"
|
||||
SELECT
|
||||
id AS "id!: Uuid",
|
||||
email AS "email!",
|
||||
first_name AS "first_name?",
|
||||
last_name AS "last_name?",
|
||||
username AS "username?",
|
||||
created_at AS "created_at!",
|
||||
updated_at AS "updated_at!"
|
||||
FROM users
|
||||
WHERE lower(email) = lower($1)
|
||||
"#,
|
||||
email
|
||||
)
|
||||
.fetch_optional(self.pool)
|
||||
.await
|
||||
.map_err(IdentityError::from)
|
||||
}
|
||||
|
||||
/// Fetch all assignees for a given project id.
|
||||
/// Returns Vec<UserData> containing all unique users assigned to tasks in the project.
|
||||
pub async fn fetch_assignees_by_project(
|
||||
|
||||
Reference in New Issue
Block a user