Compare commits
2 Commits
develop
...
c369f166be
| Author | SHA1 | Date | |
|---|---|---|---|
|
c369f166be
|
|||
|
03bd411c18
|
@@ -32,7 +32,6 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
outputs = {
|
outputs = {
|
||||||
self,
|
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
flake-utils,
|
flake-utils,
|
||||||
rust-overlay,
|
rust-overlay,
|
||||||
@@ -52,7 +51,7 @@
|
|||||||
formatter = alejandra.defaultPackage.${system};
|
formatter = alejandra.defaultPackage.${system};
|
||||||
packages = import ./nix/package.nix {inherit pkgs rustPlatform;};
|
packages = import ./nix/package.nix {inherit pkgs rustPlatform;};
|
||||||
devShell = import ./nix/shell.nix {
|
devShell = import ./nix/shell.nix {
|
||||||
inherit inputs pkgs self rustVersion;
|
inherit inputs pkgs rustVersion;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
inputs,
|
inputs,
|
||||||
pkgs,
|
pkgs,
|
||||||
self,
|
|
||||||
rustVersion,
|
rustVersion,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|||||||
@@ -93,10 +93,14 @@ impl From<ValidationErrors> for ContactError {
|
|||||||
return Self::ValidationNameError("backend.contact.errors.validation.name".to_owned());
|
return Self::ValidationNameError("backend.contact.errors.validation.name".to_owned());
|
||||||
}
|
}
|
||||||
if validator::ValidationErrors::has_error(&Err(value.clone()), "email") {
|
if validator::ValidationErrors::has_error(&Err(value.clone()), "email") {
|
||||||
return Self::ValidationEmailError("backend.contact.errors.validation.email".to_owned());
|
return Self::ValidationEmailError(
|
||||||
|
"backend.contact.errors.validation.email".to_owned(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if validator::ValidationErrors::has_error(&Err(value), "message") {
|
if validator::ValidationErrors::has_error(&Err(value), "message") {
|
||||||
return Self::ValidationMessageError("backend.contact.errors.validation.message".to_owned());
|
return Self::ValidationMessageError(
|
||||||
|
"backend.contact.errors.validation.message".to_owned(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
Self::ValidationError("backend.contact.errors.validation.other".to_owned())
|
Self::ValidationError("backend.contact.errors.validation.other".to_owned())
|
||||||
}
|
}
|
||||||
@@ -113,9 +117,13 @@ impl From<ContactError> for ContactResponse {
|
|||||||
success: false,
|
success: false,
|
||||||
message: match value {
|
message: match value {
|
||||||
ContactError::CouldNotParseRequestEmailAddress(_)
|
ContactError::CouldNotParseRequestEmailAddress(_)
|
||||||
| ContactError::ValidationEmailError(_) => "backend.contact.errors.validation.email",
|
| ContactError::ValidationEmailError(_) => {
|
||||||
|
"backend.contact.errors.validation.email"
|
||||||
|
}
|
||||||
ContactError::ValidationNameError(_) => "backend.contact.errors.validation.name",
|
ContactError::ValidationNameError(_) => "backend.contact.errors.validation.name",
|
||||||
ContactError::ValidationMessageError(_) => "backend.contact.errors.validation.message",
|
ContactError::ValidationMessageError(_) => {
|
||||||
|
"backend.contact.errors.validation.message"
|
||||||
|
}
|
||||||
ContactError::CouldNotParseSettingsEmail(_)
|
ContactError::CouldNotParseSettingsEmail(_)
|
||||||
| ContactError::FailedToBuildMessage(_)
|
| ContactError::FailedToBuildMessage(_)
|
||||||
| ContactError::CouldNotSendEmail(_)
|
| ContactError::CouldNotSendEmail(_)
|
||||||
|
|||||||
@@ -161,7 +161,9 @@ impl ContactApi {
|
|||||||
remote_addr: Option<poem::web::Data<&poem::web::RemoteAddr>>,
|
remote_addr: Option<poem::web::Data<&poem::web::RemoteAddr>>,
|
||||||
) -> ContactApiResponse {
|
) -> ContactApiResponse {
|
||||||
let body = body.0;
|
let body = body.0;
|
||||||
if body.honeypot.is_some() {
|
if let Some(ref honeypot) = body.honeypot
|
||||||
|
&& honeypot.trim().is_empty()
|
||||||
|
{
|
||||||
tracing::event!(
|
tracing::event!(
|
||||||
target: "backend::contact",
|
target: "backend::contact",
|
||||||
tracing::Level::INFO,
|
tracing::Level::INFO,
|
||||||
|
|||||||
Reference in New Issue
Block a user