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
Fix the login template not rendering on policy error
This commit is contained in:
@ -32,7 +32,7 @@ use ulid::Ulid;
|
||||
use url::Url;
|
||||
|
||||
pub use self::branding::SiteBranding;
|
||||
use crate::{FormField, FormState};
|
||||
use crate::{FieldError, FormField, FormState};
|
||||
|
||||
/// Helper trait to construct context wrappers
|
||||
pub trait TemplateContext: Serialize {
|
||||
@ -408,6 +408,26 @@ impl TemplateContext for LoginContext {
|
||||
password_disabled: false,
|
||||
providers: Vec::new(),
|
||||
},
|
||||
LoginContext {
|
||||
form: FormState::default()
|
||||
.with_error_on_field(LoginFormField::Username, FieldError::Required)
|
||||
.with_error_on_field(
|
||||
LoginFormField::Password,
|
||||
FieldError::Policy {
|
||||
message: "password too short".to_owned(),
|
||||
},
|
||||
),
|
||||
next: None,
|
||||
password_disabled: false,
|
||||
providers: Vec::new(),
|
||||
},
|
||||
LoginContext {
|
||||
form: FormState::default()
|
||||
.with_error_on_field(LoginFormField::Username, FieldError::Exists),
|
||||
next: None,
|
||||
password_disabled: false,
|
||||
providers: Vec::new(),
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user