Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

fix(users): Mark user as verified if user logins from SSO (#6694)

Mani Chandra880ad1e883fb
diff --git a/crates/router/src/core/user.rs b/crates/router/src/core/user.rs
index 2087d01dbb..b181cf797e 100644
--- a/crates/router/src/core/user.rs
+++ b/crates/router/src/core/user.rs
@@ -2345,13 +2345,24 @@ pub async fn sso_sign(
.await?;
// TODO: Use config to handle not found error
- let user_from_db = state
+ let user_from_db: domain::UserFromStorage = state
.global_store
.find_user_by_email(&email.into_inner())
.await
.map(Into::into)
.to_not_found_response(UserErrors::UserNotFound)?;
+ if !user_from_db.is_verified() {
+ state
+ .global_store
+ .update_user_by_user_id(
+ user_from_db.get_user_id(),
+ storage_user::UserUpdate::VerifyUser,
+ )
+ .await
+ .change_context(UserErrors::InternalServerError)?;
+ }
+
let next_flow = if let Some(user_from_single_purpose_token) = user_from_single_purpose_token {
let current_flow =
domain::CurrentFlow::new(user_from_single_purpose_token, domain::SPTFlow::SSO.into())?;