You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-07-29 22:01:14 +03:00
Handle password strength verification through OPA
This commit is contained in:
@ -133,7 +133,7 @@ pub(crate) async fn post(
|
||||
|
||||
let mut policy = policy_factory.instantiate().await?;
|
||||
let res = policy
|
||||
.evaluate_register(&form.username, &form.email)
|
||||
.evaluate_register(&form.username, &form.password, &form.email)
|
||||
.await?;
|
||||
|
||||
for violation in res.violations {
|
||||
@ -150,6 +150,12 @@ pub(crate) async fn post(
|
||||
message: violation.msg,
|
||||
},
|
||||
),
|
||||
Some("password") => state.add_error_on_field(
|
||||
RegisterFormField::Password,
|
||||
FieldError::Policy {
|
||||
message: violation.msg,
|
||||
},
|
||||
),
|
||||
_ => state.add_error_on_form(FormError::Policy {
|
||||
message: violation.msg,
|
||||
}),
|
||||
|
Reference in New Issue
Block a user