Skip to content

Commit

Permalink
fix(users): Mark user as verified if user logins from SSO (#6694)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThisIsMani authored Nov 29, 2024
1 parent b1d1073 commit 880ad1e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion crates/router/src/core/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())?;
Expand Down

0 comments on commit 880ad1e

Please sign in to comment.