Update crates/handlers/src/upstream_oauth2/link.rs

Co-authored-by: Quentin Gliech <quenting@element.io>
This commit is contained in:
Olivier D
2025-07-21 09:52:24 +02:00
co-authored by Quentin Gliech
parent 2866f7994d
commit 3e9d572e2f
+5 -2
View File
@@ -694,9 +694,12 @@ pub(crate) async fn post(
.as_deref()
.unwrap_or(DEFAULT_LOCALPART_TEMPLATE);
let localpart = render_attribute_template(&env, template, &context, true)?;
let Some(localpart) = render_attribute_template(&env, template, &context, true)? else {
// This should never be the case at this point
return Err(RouteError::InvalidFormAction);
};
let maybe_user = repo.user().find_by_username(&localpart.unwrap()).await?;
let maybe_user = repo.user().find_by_username(&localpart).await?;
let Some(user) = maybe_user else {
// user cannot be None at this stage