Remove was_validated from params
This commit is contained in:
parent
45f664bf9c
commit
aef4a809d6
2 changed files with 2 additions and 5 deletions
|
@ -19,7 +19,6 @@ use crate::{
|
||||||
pub struct ContactFormParams<'a> {
|
pub struct ContactFormParams<'a> {
|
||||||
config: Arc<Config>,
|
config: Arc<Config>,
|
||||||
captcha_solutions: Arc<Mutex<CaptchaSolutions>>,
|
captcha_solutions: Arc<Mutex<CaptchaSolutions>>,
|
||||||
was_validated: bool,
|
|
||||||
persistant_fields: Option<PersistantContactFormFields>,
|
persistant_fields: Option<PersistantContactFormFields>,
|
||||||
error_message: Option<&'a str>,
|
error_message: Option<&'a str>,
|
||||||
}
|
}
|
||||||
|
@ -33,7 +32,6 @@ pub async fn index(
|
||||||
render_contact_form(ContactFormParams {
|
render_contact_form(ContactFormParams {
|
||||||
config,
|
config,
|
||||||
captcha_solutions,
|
captcha_solutions,
|
||||||
was_validated: false,
|
|
||||||
persistant_fields: None,
|
persistant_fields: None,
|
||||||
error_message: None,
|
error_message: None,
|
||||||
})
|
})
|
||||||
|
@ -53,7 +51,7 @@ pub async fn render_contact_form(params: ContactFormParams<'_>) -> Result<Respon
|
||||||
lang: ¶ms.config.lang,
|
lang: ¶ms.config.lang,
|
||||||
path_prefix: ¶ms.config.path_prefix,
|
path_prefix: ¶ms.config.path_prefix,
|
||||||
},
|
},
|
||||||
was_validated: params.was_validated,
|
was_validated: params.persistant_fields.is_some(),
|
||||||
id,
|
id,
|
||||||
persistant_fields: params.persistant_fields.unwrap_or_default(),
|
persistant_fields: params.persistant_fields.unwrap_or_default(),
|
||||||
captcha: captcha_base64,
|
captcha: captcha_base64,
|
||||||
|
@ -73,7 +71,6 @@ async fn failed_submission(
|
||||||
let params = ContactFormParams {
|
let params = ContactFormParams {
|
||||||
config,
|
config,
|
||||||
captcha_solutions,
|
captcha_solutions,
|
||||||
was_validated: true,
|
|
||||||
persistant_fields: Some(form.persistant_fields),
|
persistant_fields: Some(form.persistant_fields),
|
||||||
error_message: Some(error_message),
|
error_message: Some(error_message),
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<form id="contact-form"
|
<form id="contact-form"
|
||||||
action="{{ base.path_prefix }}/"
|
action="{{ base.path_prefix }}/"
|
||||||
method="post"
|
method="post"
|
||||||
{% if was_validated %} class="was-validated"{% endif %}
|
{% if was_validated %}class="was-validated"{% endif %}
|
||||||
novalidate>
|
novalidate>
|
||||||
<input type="hidden" name="id" value="{{ id }}" required>
|
<input type="hidden" name="id" value="{{ id }}" required>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue