fix: check is new before creating user (#545)

This commit is contained in:
Zack 2024-05-10 16:23:15 +08:00 committed by GitHub
parent d9d874ab8a
commit 348217a117
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 0 deletions

View File

@ -22,6 +22,11 @@ pub async fn verify_token(access_token: &str, state: &AppState) -> Result<bool,
let user_uuid = uuid::Uuid::parse_str(&user.id)?;
let name = name_from_user_metadata(&user.user_metadata);
let is_new = !is_user_exist(&state.pg_pool, &user_uuid).await?;
if !is_new {
return Ok(false);
}
let mut txn = state
.pg_pool
.begin()