Skip to content

Commit 3e9d572

Browse files
odelcroisandhose
andcommitted
Update crates/handlers/src/upstream_oauth2/link.rs
Co-authored-by: Quentin Gliech <[email protected]>
1 parent 2866f79 commit 3e9d572

File tree

1 file changed

+5
-2
lines changed
  • crates/handlers/src/upstream_oauth2

1 file changed

+5
-2
lines changed

crates/handlers/src/upstream_oauth2/link.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -694,9 +694,12 @@ pub(crate) async fn post(
694694
.as_deref()
695695
.unwrap_or(DEFAULT_LOCALPART_TEMPLATE);
696696

697-
let localpart = render_attribute_template(&env, template, &context, true)?;
697+
let Some(localpart) = render_attribute_template(&env, template, &context, true)? else {
698+
// This should never be the case at this point
699+
return Err(RouteError::InvalidFormAction);
700+
};
698701

699-
let maybe_user = repo.user().find_by_username(&localpart.unwrap()).await?;
702+
let maybe_user = repo.user().find_by_username(&localpart).await?;
700703

701704
let Some(user) = maybe_user else {
702705
// user cannot be None at this stage

0 commit comments

Comments
 (0)