1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-07-29 22:01:14 +03:00

Make the email verification state more configurable on upstream OAuth 2.0 registration

This also marks the email as primary
This commit is contained in:
Quentin Gliech
2023-08-31 11:31:06 +02:00
parent 8e5ebcd03f
commit ae3213fe87
8 changed files with 162 additions and 18 deletions

View File

@ -527,11 +527,19 @@ pub(crate) async fn post(
.add(&mut rng, &clock, &user, email)
.await?;
// Mark the email as verified if the upstream provider says it is.
if payload.email_verified {
repo.user_email()
// Mark the email as verified according to the policy and whether the provider
// claims it is, and make it the primary email.
if provider
.claims_imports
.verify_email
.should_mark_as_verified(payload.email_verified)
{
let user_email = repo
.user_email()
.mark_as_verified(&clock, user_email)
.await?;
repo.user_email().set_as_primary(&user_email).await?;
}
}